web/res/js/jquery-ui.js
changeset 1304 10974bff4dae
parent 1198 ff4b567d51f2
child 1514 5869151a1f2f
equal deleted inserted replaced
1303:20e00017dd60 1304:10974bff4dae
     1 /*! jQuery UI - v1.10.3 - 2013-05-03
     1 /*! jQuery UI - v1.11.4 - 2015-03-11
     2 * http://jqueryui.com
     2 * http://jqueryui.com
     3 * Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.effect.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
     3 * Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.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, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js
     4 * Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
     4 * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
     5 (function( $, undefined ) {
     5 
     6 
     6 (function( factory ) {
     7 var uuid = 0,
     7 	if ( typeof define === "function" && define.amd ) {
     8 	runiqueId = /^ui-id-\d+$/;
     8 
       
     9 		// AMD. Register as an anonymous module.
       
    10 		define([ "jquery" ], factory );
       
    11 	} else {
       
    12 
       
    13 		// Browser globals
       
    14 		factory( jQuery );
       
    15 	}
       
    16 }(function( $ ) {
       
    17 /*!
       
    18  * jQuery UI Core 1.11.4
       
    19  * http://jqueryui.com
       
    20  *
       
    21  * Copyright jQuery Foundation and other contributors
       
    22  * Released under the MIT license.
       
    23  * http://jquery.org/license
       
    24  *
       
    25  * http://api.jqueryui.com/category/ui-core/
       
    26  */
       
    27 
     9 
    28 
    10 // $.ui might exist from components with no dependencies, e.g., $.ui.position
    29 // $.ui might exist from components with no dependencies, e.g., $.ui.position
    11 $.ui = $.ui || {};
    30 $.ui = $.ui || {};
    12 
    31 
    13 $.extend( $.ui, {
    32 $.extend( $.ui, {
    14 	version: "1.10.3",
    33 	version: "1.11.4",
    15 
    34 
    16 	keyCode: {
    35 	keyCode: {
    17 		BACKSPACE: 8,
    36 		BACKSPACE: 8,
    18 		COMMA: 188,
    37 		COMMA: 188,
    19 		DELETE: 46,
    38 		DELETE: 46,
    21 		END: 35,
    40 		END: 35,
    22 		ENTER: 13,
    41 		ENTER: 13,
    23 		ESCAPE: 27,
    42 		ESCAPE: 27,
    24 		HOME: 36,
    43 		HOME: 36,
    25 		LEFT: 37,
    44 		LEFT: 37,
    26 		NUMPAD_ADD: 107,
       
    27 		NUMPAD_DECIMAL: 110,
       
    28 		NUMPAD_DIVIDE: 111,
       
    29 		NUMPAD_ENTER: 108,
       
    30 		NUMPAD_MULTIPLY: 106,
       
    31 		NUMPAD_SUBTRACT: 109,
       
    32 		PAGE_DOWN: 34,
    45 		PAGE_DOWN: 34,
    33 		PAGE_UP: 33,
    46 		PAGE_UP: 33,
    34 		PERIOD: 190,
    47 		PERIOD: 190,
    35 		RIGHT: 39,
    48 		RIGHT: 39,
    36 		SPACE: 32,
    49 		SPACE: 32,
    38 		UP: 38
    51 		UP: 38
    39 	}
    52 	}
    40 });
    53 });
    41 
    54 
    42 // plugins
    55 // plugins
       
    56 $.fn.extend({
       
    57 	scrollParent: function( includeHidden ) {
       
    58 		var position = this.css( "position" ),
       
    59 			excludeStaticParent = position === "absolute",
       
    60 			overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
       
    61 			scrollParent = this.parents().filter( function() {
       
    62 				var parent = $( this );
       
    63 				if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
       
    64 					return false;
       
    65 				}
       
    66 				return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
       
    67 			}).eq( 0 );
       
    68 
       
    69 		return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
       
    70 	},
       
    71 
       
    72 	uniqueId: (function() {
       
    73 		var uuid = 0;
       
    74 
       
    75 		return function() {
       
    76 			return this.each(function() {
       
    77 				if ( !this.id ) {
       
    78 					this.id = "ui-id-" + ( ++uuid );
       
    79 				}
       
    80 			});
       
    81 		};
       
    82 	})(),
       
    83 
       
    84 	removeUniqueId: function() {
       
    85 		return this.each(function() {
       
    86 			if ( /^ui-id-\d+$/.test( this.id ) ) {
       
    87 				$( this ).removeAttr( "id" );
       
    88 			}
       
    89 		});
       
    90 	}
       
    91 });
       
    92 
       
    93 // selectors
       
    94 function focusable( element, isTabIndexNotNaN ) {
       
    95 	var map, mapName, img,
       
    96 		nodeName = element.nodeName.toLowerCase();
       
    97 	if ( "area" === nodeName ) {
       
    98 		map = element.parentNode;
       
    99 		mapName = map.name;
       
   100 		if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
       
   101 			return false;
       
   102 		}
       
   103 		img = $( "img[usemap='#" + mapName + "']" )[ 0 ];
       
   104 		return !!img && visible( img );
       
   105 	}
       
   106 	return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ?
       
   107 		!element.disabled :
       
   108 		"a" === nodeName ?
       
   109 			element.href || isTabIndexNotNaN :
       
   110 			isTabIndexNotNaN) &&
       
   111 		// the element and all of its ancestors must be visible
       
   112 		visible( element );
       
   113 }
       
   114 
       
   115 function visible( element ) {
       
   116 	return $.expr.filters.visible( element ) &&
       
   117 		!$( element ).parents().addBack().filter(function() {
       
   118 			return $.css( this, "visibility" ) === "hidden";
       
   119 		}).length;
       
   120 }
       
   121 
       
   122 $.extend( $.expr[ ":" ], {
       
   123 	data: $.expr.createPseudo ?
       
   124 		$.expr.createPseudo(function( dataName ) {
       
   125 			return function( elem ) {
       
   126 				return !!$.data( elem, dataName );
       
   127 			};
       
   128 		}) :
       
   129 		// support: jQuery <1.8
       
   130 		function( elem, i, match ) {
       
   131 			return !!$.data( elem, match[ 3 ] );
       
   132 		},
       
   133 
       
   134 	focusable: function( element ) {
       
   135 		return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
       
   136 	},
       
   137 
       
   138 	tabbable: function( element ) {
       
   139 		var tabIndex = $.attr( element, "tabindex" ),
       
   140 			isTabIndexNaN = isNaN( tabIndex );
       
   141 		return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
       
   142 	}
       
   143 });
       
   144 
       
   145 // support: jQuery <1.8
       
   146 if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
       
   147 	$.each( [ "Width", "Height" ], function( i, name ) {
       
   148 		var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
       
   149 			type = name.toLowerCase(),
       
   150 			orig = {
       
   151 				innerWidth: $.fn.innerWidth,
       
   152 				innerHeight: $.fn.innerHeight,
       
   153 				outerWidth: $.fn.outerWidth,
       
   154 				outerHeight: $.fn.outerHeight
       
   155 			};
       
   156 
       
   157 		function reduce( elem, size, border, margin ) {
       
   158 			$.each( side, function() {
       
   159 				size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
       
   160 				if ( border ) {
       
   161 					size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
       
   162 				}
       
   163 				if ( margin ) {
       
   164 					size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
       
   165 				}
       
   166 			});
       
   167 			return size;
       
   168 		}
       
   169 
       
   170 		$.fn[ "inner" + name ] = function( size ) {
       
   171 			if ( size === undefined ) {
       
   172 				return orig[ "inner" + name ].call( this );
       
   173 			}
       
   174 
       
   175 			return this.each(function() {
       
   176 				$( this ).css( type, reduce( this, size ) + "px" );
       
   177 			});
       
   178 		};
       
   179 
       
   180 		$.fn[ "outer" + name] = function( size, margin ) {
       
   181 			if ( typeof size !== "number" ) {
       
   182 				return orig[ "outer" + name ].call( this, size );
       
   183 			}
       
   184 
       
   185 			return this.each(function() {
       
   186 				$( this).css( type, reduce( this, size, true, margin ) + "px" );
       
   187 			});
       
   188 		};
       
   189 	});
       
   190 }
       
   191 
       
   192 // support: jQuery <1.8
       
   193 if ( !$.fn.addBack ) {
       
   194 	$.fn.addBack = function( selector ) {
       
   195 		return this.add( selector == null ?
       
   196 			this.prevObject : this.prevObject.filter( selector )
       
   197 		);
       
   198 	};
       
   199 }
       
   200 
       
   201 // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
       
   202 if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
       
   203 	$.fn.removeData = (function( removeData ) {
       
   204 		return function( key ) {
       
   205 			if ( arguments.length ) {
       
   206 				return removeData.call( this, $.camelCase( key ) );
       
   207 			} else {
       
   208 				return removeData.call( this );
       
   209 			}
       
   210 		};
       
   211 	})( $.fn.removeData );
       
   212 }
       
   213 
       
   214 // deprecated
       
   215 $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
       
   216 
    43 $.fn.extend({
   217 $.fn.extend({
    44 	focus: (function( orig ) {
   218 	focus: (function( orig ) {
    45 		return function( delay, fn ) {
   219 		return function( delay, fn ) {
    46 			return typeof delay === "number" ?
   220 			return typeof delay === "number" ?
    47 				this.each(function() {
   221 				this.each(function() {
    55 				}) :
   229 				}) :
    56 				orig.apply( this, arguments );
   230 				orig.apply( this, arguments );
    57 		};
   231 		};
    58 	})( $.fn.focus ),
   232 	})( $.fn.focus ),
    59 
   233 
    60 	scrollParent: function() {
   234 	disableSelection: (function() {
    61 		var scrollParent;
   235 		var eventType = "onselectstart" in document.createElement( "div" ) ?
    62 		if (($.ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) {
   236 			"selectstart" :
    63 			scrollParent = this.parents().filter(function() {
   237 			"mousedown";
    64 				return (/(relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
   238 
    65 			}).eq(0);
   239 		return function() {
    66 		} else {
   240 			return this.bind( eventType + ".ui-disableSelection", function( event ) {
    67 			scrollParent = this.parents().filter(function() {
   241 				event.preventDefault();
    68 				return (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
   242 			});
    69 			}).eq(0);
   243 		};
    70 		}
   244 	})(),
    71 
   245 
    72 		return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent;
   246 	enableSelection: function() {
       
   247 		return this.unbind( ".ui-disableSelection" );
    73 	},
   248 	},
    74 
   249 
    75 	zIndex: function( zIndex ) {
   250 	zIndex: function( zIndex ) {
    76 		if ( zIndex !== undefined ) {
   251 		if ( zIndex !== undefined ) {
    77 			return this.css( "zIndex", zIndex );
   252 			return this.css( "zIndex", zIndex );
    97 				elem = elem.parent();
   272 				elem = elem.parent();
    98 			}
   273 			}
    99 		}
   274 		}
   100 
   275 
   101 		return 0;
   276 		return 0;
   102 	},
       
   103 
       
   104 	uniqueId: function() {
       
   105 		return this.each(function() {
       
   106 			if ( !this.id ) {
       
   107 				this.id = "ui-id-" + (++uuid);
       
   108 			}
       
   109 		});
       
   110 	},
       
   111 
       
   112 	removeUniqueId: function() {
       
   113 		return this.each(function() {
       
   114 			if ( runiqueId.test( this.id ) ) {
       
   115 				$( this ).removeAttr( "id" );
       
   116 			}
       
   117 		});
       
   118 	}
   277 	}
   119 });
   278 });
   120 
   279 
   121 // selectors
   280 // $.ui.plugin is deprecated. Use $.widget() extensions instead.
   122 function focusable( element, isTabIndexNotNaN ) {
   281 $.ui.plugin = {
   123 	var map, mapName, img,
   282 	add: function( module, option, set ) {
   124 		nodeName = element.nodeName.toLowerCase();
   283 		var i,
   125 	if ( "area" === nodeName ) {
   284 			proto = $.ui[ module ].prototype;
   126 		map = element.parentNode;
   285 		for ( i in set ) {
   127 		mapName = map.name;
   286 			proto.plugins[ i ] = proto.plugins[ i ] || [];
   128 		if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
   287 			proto.plugins[ i ].push( [ option, set[ i ] ] );
   129 			return false;
   288 		}
   130 		}
   289 	},
   131 		img = $( "img[usemap=#" + mapName + "]" )[0];
   290 	call: function( instance, name, args, allowDisconnected ) {
   132 		return !!img && visible( img );
   291 		var i,
       
   292 			set = instance.plugins[ name ];
       
   293 
       
   294 		if ( !set ) {
       
   295 			return;
       
   296 		}
       
   297 
       
   298 		if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
       
   299 			return;
       
   300 		}
       
   301 
       
   302 		for ( i = 0; i < set.length; i++ ) {
       
   303 			if ( instance.options[ set[ i ][ 0 ] ] ) {
       
   304 				set[ i ][ 1 ].apply( instance.element, args );
       
   305 			}
       
   306 		}
   133 	}
   307 	}
   134 	return ( /input|select|textarea|button|object/.test( nodeName ) ?
   308 };
   135 		!element.disabled :
   309 
   136 		"a" === nodeName ?
   310 
   137 			element.href || isTabIndexNotNaN :
   311 /*!
   138 			isTabIndexNotNaN) &&
   312  * jQuery UI Widget 1.11.4
   139 		// the element and all of its ancestors must be visible
   313  * http://jqueryui.com
   140 		visible( element );
   314  *
   141 }
   315  * Copyright jQuery Foundation and other contributors
   142 
   316  * Released under the MIT license.
   143 function visible( element ) {
   317  * http://jquery.org/license
   144 	return $.expr.filters.visible( element ) &&
   318  *
   145 		!$( element ).parents().addBack().filter(function() {
   319  * http://api.jqueryui.com/jQuery.widget/
   146 			return $.css( this, "visibility" ) === "hidden";
   320  */
   147 		}).length;
   321 
   148 }
   322 
   149 
   323 var widget_uuid = 0,
   150 $.extend( $.expr[ ":" ], {
   324 	widget_slice = Array.prototype.slice;
   151 	data: $.expr.createPseudo ?
   325 
   152 		$.expr.createPseudo(function( dataName ) {
   326 $.cleanData = (function( orig ) {
   153 			return function( elem ) {
   327 	return function( elems ) {
   154 				return !!$.data( elem, dataName );
   328 		var events, elem, i;
   155 			};
   329 		for ( i = 0; (elem = elems[i]) != null; i++ ) {
   156 		}) :
   330 			try {
   157 		// support: jQuery <1.8
   331 
   158 		function( elem, i, match ) {
   332 				// Only trigger remove when necessary to save time
   159 			return !!$.data( elem, match[ 3 ] );
   333 				events = $._data( elem, "events" );
   160 		},
   334 				if ( events && events.remove ) {
   161 
   335 					$( elem ).triggerHandler( "remove" );
   162 	focusable: function( element ) {
   336 				}
   163 		return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
   337 
   164 	},
   338 			// http://bugs.jquery.com/ticket/8235
   165 
   339 			} catch ( e ) {}
   166 	tabbable: function( element ) {
   340 		}
   167 		var tabIndex = $.attr( element, "tabindex" ),
   341 		orig( elems );
   168 			isTabIndexNaN = isNaN( tabIndex );
       
   169 		return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
       
   170 	}
       
   171 });
       
   172 
       
   173 // support: jQuery <1.8
       
   174 if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
       
   175 	$.each( [ "Width", "Height" ], function( i, name ) {
       
   176 		var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
       
   177 			type = name.toLowerCase(),
       
   178 			orig = {
       
   179 				innerWidth: $.fn.innerWidth,
       
   180 				innerHeight: $.fn.innerHeight,
       
   181 				outerWidth: $.fn.outerWidth,
       
   182 				outerHeight: $.fn.outerHeight
       
   183 			};
       
   184 
       
   185 		function reduce( elem, size, border, margin ) {
       
   186 			$.each( side, function() {
       
   187 				size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
       
   188 				if ( border ) {
       
   189 					size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
       
   190 				}
       
   191 				if ( margin ) {
       
   192 					size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
       
   193 				}
       
   194 			});
       
   195 			return size;
       
   196 		}
       
   197 
       
   198 		$.fn[ "inner" + name ] = function( size ) {
       
   199 			if ( size === undefined ) {
       
   200 				return orig[ "inner" + name ].call( this );
       
   201 			}
       
   202 
       
   203 			return this.each(function() {
       
   204 				$( this ).css( type, reduce( this, size ) + "px" );
       
   205 			});
       
   206 		};
       
   207 
       
   208 		$.fn[ "outer" + name] = function( size, margin ) {
       
   209 			if ( typeof size !== "number" ) {
       
   210 				return orig[ "outer" + name ].call( this, size );
       
   211 			}
       
   212 
       
   213 			return this.each(function() {
       
   214 				$( this).css( type, reduce( this, size, true, margin ) + "px" );
       
   215 			});
       
   216 		};
       
   217 	});
       
   218 }
       
   219 
       
   220 // support: jQuery <1.8
       
   221 if ( !$.fn.addBack ) {
       
   222 	$.fn.addBack = function( selector ) {
       
   223 		return this.add( selector == null ?
       
   224 			this.prevObject : this.prevObject.filter( selector )
       
   225 		);
       
   226 	};
   342 	};
   227 }
   343 })( $.cleanData );
   228 
       
   229 // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
       
   230 if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
       
   231 	$.fn.removeData = (function( removeData ) {
       
   232 		return function( key ) {
       
   233 			if ( arguments.length ) {
       
   234 				return removeData.call( this, $.camelCase( key ) );
       
   235 			} else {
       
   236 				return removeData.call( this );
       
   237 			}
       
   238 		};
       
   239 	})( $.fn.removeData );
       
   240 }
       
   241 
       
   242 
       
   243 
       
   244 
       
   245 
       
   246 // deprecated
       
   247 $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
       
   248 
       
   249 $.support.selectstart = "onselectstart" in document.createElement( "div" );
       
   250 $.fn.extend({
       
   251 	disableSelection: function() {
       
   252 		return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
       
   253 			".ui-disableSelection", function( event ) {
       
   254 				event.preventDefault();
       
   255 			});
       
   256 	},
       
   257 
       
   258 	enableSelection: function() {
       
   259 		return this.unbind( ".ui-disableSelection" );
       
   260 	}
       
   261 });
       
   262 
       
   263 $.extend( $.ui, {
       
   264 	// $.ui.plugin is deprecated. Use $.widget() extensions instead.
       
   265 	plugin: {
       
   266 		add: function( module, option, set ) {
       
   267 			var i,
       
   268 				proto = $.ui[ module ].prototype;
       
   269 			for ( i in set ) {
       
   270 				proto.plugins[ i ] = proto.plugins[ i ] || [];
       
   271 				proto.plugins[ i ].push( [ option, set[ i ] ] );
       
   272 			}
       
   273 		},
       
   274 		call: function( instance, name, args ) {
       
   275 			var i,
       
   276 				set = instance.plugins[ name ];
       
   277 			if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) {
       
   278 				return;
       
   279 			}
       
   280 
       
   281 			for ( i = 0; i < set.length; i++ ) {
       
   282 				if ( instance.options[ set[ i ][ 0 ] ] ) {
       
   283 					set[ i ][ 1 ].apply( instance.element, args );
       
   284 				}
       
   285 			}
       
   286 		}
       
   287 	},
       
   288 
       
   289 	// only used by resizable
       
   290 	hasScroll: function( el, a ) {
       
   291 
       
   292 		//If overflow is hidden, the element might have extra content, but the user wants to hide it
       
   293 		if ( $( el ).css( "overflow" ) === "hidden") {
       
   294 			return false;
       
   295 		}
       
   296 
       
   297 		var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
       
   298 			has = false;
       
   299 
       
   300 		if ( el[ scroll ] > 0 ) {
       
   301 			return true;
       
   302 		}
       
   303 
       
   304 		// TODO: determine which cases actually cause this to happen
       
   305 		// if the element doesn't have the scroll set, see if it's possible to
       
   306 		// set the scroll
       
   307 		el[ scroll ] = 1;
       
   308 		has = ( el[ scroll ] > 0 );
       
   309 		el[ scroll ] = 0;
       
   310 		return has;
       
   311 	}
       
   312 });
       
   313 
       
   314 })( jQuery );
       
   315 
       
   316 (function( $, undefined ) {
       
   317 
       
   318 var uuid = 0,
       
   319 	slice = Array.prototype.slice,
       
   320 	_cleanData = $.cleanData;
       
   321 $.cleanData = function( elems ) {
       
   322 	for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
       
   323 		try {
       
   324 			$( elem ).triggerHandler( "remove" );
       
   325 		// http://bugs.jquery.com/ticket/8235
       
   326 		} catch( e ) {}
       
   327 	}
       
   328 	_cleanData( elems );
       
   329 };
       
   330 
   344 
   331 $.widget = function( name, base, prototype ) {
   345 $.widget = function( name, base, prototype ) {
   332 	var fullName, existingConstructor, constructor, basePrototype,
   346 	var fullName, existingConstructor, constructor, basePrototype,
   333 		// proxiedPrototype allows the provided prototype to remain unmodified
   347 		// proxiedPrototype allows the provided prototype to remain unmodified
   334 		// so that it can be used as a mixin for multiple widgets (#8876)
   348 		// so that it can be used as a mixin for multiple widgets (#8876)
   409 	});
   423 	});
   410 	constructor.prototype = $.widget.extend( basePrototype, {
   424 	constructor.prototype = $.widget.extend( basePrototype, {
   411 		// TODO: remove support for widgetEventPrefix
   425 		// TODO: remove support for widgetEventPrefix
   412 		// always use the name + a colon as the prefix, e.g., draggable:start
   426 		// always use the name + a colon as the prefix, e.g., draggable:start
   413 		// don't prefix for widgets that aren't DOM-based
   427 		// don't prefix for widgets that aren't DOM-based
   414 		widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
   428 		widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
   415 	}, proxiedPrototype, {
   429 	}, proxiedPrototype, {
   416 		constructor: constructor,
   430 		constructor: constructor,
   417 		namespace: namespace,
   431 		namespace: namespace,
   418 		widgetName: name,
   432 		widgetName: name,
   419 		widgetFullName: fullName
   433 		widgetFullName: fullName
   437 	} else {
   451 	} else {
   438 		base._childConstructors.push( constructor );
   452 		base._childConstructors.push( constructor );
   439 	}
   453 	}
   440 
   454 
   441 	$.widget.bridge( name, constructor );
   455 	$.widget.bridge( name, constructor );
       
   456 
       
   457 	return constructor;
   442 };
   458 };
   443 
   459 
   444 $.widget.extend = function( target ) {
   460 $.widget.extend = function( target ) {
   445 	var input = slice.call( arguments, 1 ),
   461 	var input = widget_slice.call( arguments, 1 ),
   446 		inputIndex = 0,
   462 		inputIndex = 0,
   447 		inputLength = input.length,
   463 		inputLength = input.length,
   448 		key,
   464 		key,
   449 		value;
   465 		value;
   450 	for ( ; inputIndex < inputLength; inputIndex++ ) {
   466 	for ( ; inputIndex < inputLength; inputIndex++ ) {
   469 
   485 
   470 $.widget.bridge = function( name, object ) {
   486 $.widget.bridge = function( name, object ) {
   471 	var fullName = object.prototype.widgetFullName || name;
   487 	var fullName = object.prototype.widgetFullName || name;
   472 	$.fn[ name ] = function( options ) {
   488 	$.fn[ name ] = function( options ) {
   473 		var isMethodCall = typeof options === "string",
   489 		var isMethodCall = typeof options === "string",
   474 			args = slice.call( arguments, 1 ),
   490 			args = widget_slice.call( arguments, 1 ),
   475 			returnValue = this;
   491 			returnValue = this;
   476 
       
   477 		// allow multiple hashes to be passed on init
       
   478 		options = !isMethodCall && args.length ?
       
   479 			$.widget.extend.apply( null, [ options ].concat(args) ) :
       
   480 			options;
       
   481 
   492 
   482 		if ( isMethodCall ) {
   493 		if ( isMethodCall ) {
   483 			this.each(function() {
   494 			this.each(function() {
   484 				var methodValue,
   495 				var methodValue,
   485 					instance = $.data( this, fullName );
   496 					instance = $.data( this, fullName );
       
   497 				if ( options === "instance" ) {
       
   498 					returnValue = instance;
       
   499 					return false;
       
   500 				}
   486 				if ( !instance ) {
   501 				if ( !instance ) {
   487 					return $.error( "cannot call methods on " + name + " prior to initialization; " +
   502 					return $.error( "cannot call methods on " + name + " prior to initialization; " +
   488 						"attempted to call method '" + options + "'" );
   503 						"attempted to call method '" + options + "'" );
   489 				}
   504 				}
   490 				if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
   505 				if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
   497 						methodValue;
   512 						methodValue;
   498 					return false;
   513 					return false;
   499 				}
   514 				}
   500 			});
   515 			});
   501 		} else {
   516 		} else {
       
   517 
       
   518 			// Allow multiple hashes to be passed on init
       
   519 			if ( args.length ) {
       
   520 				options = $.widget.extend.apply( null, [ options ].concat(args) );
       
   521 			}
       
   522 
   502 			this.each(function() {
   523 			this.each(function() {
   503 				var instance = $.data( this, fullName );
   524 				var instance = $.data( this, fullName );
   504 				if ( instance ) {
   525 				if ( instance ) {
   505 					instance.option( options || {} )._init();
   526 					instance.option( options || {} );
       
   527 					if ( instance._init ) {
       
   528 						instance._init();
       
   529 					}
   506 				} else {
   530 				} else {
   507 					$.data( this, fullName, new object( options, this ) );
   531 					$.data( this, fullName, new object( options, this ) );
   508 				}
   532 				}
   509 			});
   533 			});
   510 		}
   534 		}
   527 		create: null
   551 		create: null
   528 	},
   552 	},
   529 	_createWidget: function( options, element ) {
   553 	_createWidget: function( options, element ) {
   530 		element = $( element || this.defaultElement || this )[ 0 ];
   554 		element = $( element || this.defaultElement || this )[ 0 ];
   531 		this.element = $( element );
   555 		this.element = $( element );
   532 		this.uuid = uuid++;
   556 		this.uuid = widget_uuid++;
   533 		this.eventNamespace = "." + this.widgetName + this.uuid;
   557 		this.eventNamespace = "." + this.widgetName + this.uuid;
   534 		this.options = $.widget.extend( {},
       
   535 			this.options,
       
   536 			this._getCreateOptions(),
       
   537 			options );
       
   538 
   558 
   539 		this.bindings = $();
   559 		this.bindings = $();
   540 		this.hoverable = $();
   560 		this.hoverable = $();
   541 		this.focusable = $();
   561 		this.focusable = $();
   542 
   562 
   555 				// element is window or document
   575 				// element is window or document
   556 				element.document || element );
   576 				element.document || element );
   557 			this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
   577 			this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
   558 		}
   578 		}
   559 
   579 
       
   580 		this.options = $.widget.extend( {},
       
   581 			this.options,
       
   582 			this._getCreateOptions(),
       
   583 			options );
       
   584 
   560 		this._create();
   585 		this._create();
   561 		this._trigger( "create", null, this._getCreateEventData() );
   586 		this._trigger( "create", null, this._getCreateEventData() );
   562 		this._init();
   587 		this._init();
   563 	},
   588 	},
   564 	_getCreateOptions: $.noop,
   589 	_getCreateOptions: $.noop,
   570 		this._destroy();
   595 		this._destroy();
   571 		// we can probably remove the unbind calls in 2.0
   596 		// we can probably remove the unbind calls in 2.0
   572 		// all event bindings should go through this._on()
   597 		// all event bindings should go through this._on()
   573 		this.element
   598 		this.element
   574 			.unbind( this.eventNamespace )
   599 			.unbind( this.eventNamespace )
   575 			// 1.9 BC for #7810
       
   576 			// TODO remove dual storage
       
   577 			.removeData( this.widgetName )
       
   578 			.removeData( this.widgetFullName )
   600 			.removeData( this.widgetFullName )
   579 			// support: jquery <1.6.3
   601 			// support: jquery <1.6.3
   580 			// http://bugs.jquery.com/ticket/9413
   602 			// http://bugs.jquery.com/ticket/9413
   581 			.removeData( $.camelCase( this.widgetFullName ) );
   603 			.removeData( $.camelCase( this.widgetFullName ) );
   582 		this.widget()
   604 		this.widget()
   618 				for ( i = 0; i < parts.length - 1; i++ ) {
   640 				for ( i = 0; i < parts.length - 1; i++ ) {
   619 					curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
   641 					curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
   620 					curOption = curOption[ parts[ i ] ];
   642 					curOption = curOption[ parts[ i ] ];
   621 				}
   643 				}
   622 				key = parts.pop();
   644 				key = parts.pop();
   623 				if ( value === undefined ) {
   645 				if ( arguments.length === 1 ) {
   624 					return curOption[ key ] === undefined ? null : curOption[ key ];
   646 					return curOption[ key ] === undefined ? null : curOption[ key ];
   625 				}
   647 				}
   626 				curOption[ key ] = value;
   648 				curOption[ key ] = value;
   627 			} else {
   649 			} else {
   628 				if ( value === undefined ) {
   650 				if ( arguments.length === 1 ) {
   629 					return this.options[ key ] === undefined ? null : this.options[ key ];
   651 					return this.options[ key ] === undefined ? null : this.options[ key ];
   630 				}
   652 				}
   631 				options[ key ] = value;
   653 				options[ key ] = value;
   632 			}
   654 			}
   633 		}
   655 		}
   648 	_setOption: function( key, value ) {
   670 	_setOption: function( key, value ) {
   649 		this.options[ key ] = value;
   671 		this.options[ key ] = value;
   650 
   672 
   651 		if ( key === "disabled" ) {
   673 		if ( key === "disabled" ) {
   652 			this.widget()
   674 			this.widget()
   653 				.toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
   675 				.toggleClass( this.widgetFullName + "-disabled", !!value );
   654 				.attr( "aria-disabled", value );
   676 
   655 			this.hoverable.removeClass( "ui-state-hover" );
   677 			// If the widget is becoming disabled, then nothing is interactive
   656 			this.focusable.removeClass( "ui-state-focus" );
   678 			if ( value ) {
       
   679 				this.hoverable.removeClass( "ui-state-hover" );
       
   680 				this.focusable.removeClass( "ui-state-focus" );
       
   681 			}
   657 		}
   682 		}
   658 
   683 
   659 		return this;
   684 		return this;
   660 	},
   685 	},
   661 
   686 
   662 	enable: function() {
   687 	enable: function() {
   663 		return this._setOption( "disabled", false );
   688 		return this._setOptions({ disabled: false });
   664 	},
   689 	},
   665 	disable: function() {
   690 	disable: function() {
   666 		return this._setOption( "disabled", true );
   691 		return this._setOptions({ disabled: true });
   667 	},
   692 	},
   668 
   693 
   669 	_on: function( suppressDisabledCheck, element, handlers ) {
   694 	_on: function( suppressDisabledCheck, element, handlers ) {
   670 		var delegateElement,
   695 		var delegateElement,
   671 			instance = this;
   696 			instance = this;
   681 		if ( !handlers ) {
   706 		if ( !handlers ) {
   682 			handlers = element;
   707 			handlers = element;
   683 			element = this.element;
   708 			element = this.element;
   684 			delegateElement = this.widget();
   709 			delegateElement = this.widget();
   685 		} else {
   710 		} else {
   686 			// accept selectors, DOM elements
       
   687 			element = delegateElement = $( element );
   711 			element = delegateElement = $( element );
   688 			this.bindings = this.bindings.add( element );
   712 			this.bindings = this.bindings.add( element );
   689 		}
   713 		}
   690 
   714 
   691 		$.each( handlers, function( event, handler ) {
   715 		$.each( handlers, function( event, handler ) {
   706 			if ( typeof handler !== "string" ) {
   730 			if ( typeof handler !== "string" ) {
   707 				handlerProxy.guid = handler.guid =
   731 				handlerProxy.guid = handler.guid =
   708 					handler.guid || handlerProxy.guid || $.guid++;
   732 					handler.guid || handlerProxy.guid || $.guid++;
   709 			}
   733 			}
   710 
   734 
   711 			var match = event.match( /^(\w+)\s*(.*)$/ ),
   735 			var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
   712 				eventName = match[1] + instance.eventNamespace,
   736 				eventName = match[1] + instance.eventNamespace,
   713 				selector = match[2];
   737 				selector = match[2];
   714 			if ( selector ) {
   738 			if ( selector ) {
   715 				delegateElement.delegate( selector, eventName, handlerProxy );
   739 				delegateElement.delegate( selector, eventName, handlerProxy );
   716 			} else {
   740 			} else {
   718 			}
   742 			}
   719 		});
   743 		});
   720 	},
   744 	},
   721 
   745 
   722 	_off: function( element, eventName ) {
   746 	_off: function( element, eventName ) {
   723 		eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
   747 		eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
       
   748 			this.eventNamespace;
   724 		element.unbind( eventName ).undelegate( eventName );
   749 		element.unbind( eventName ).undelegate( eventName );
       
   750 
       
   751 		// Clear the stack to avoid memory leaks (#10056)
       
   752 		this.bindings = $( this.bindings.not( element ).get() );
       
   753 		this.focusable = $( this.focusable.not( element ).get() );
       
   754 		this.hoverable = $( this.hoverable.not( element ).get() );
   725 	},
   755 	},
   726 
   756 
   727 	_delay: function( handler, delay ) {
   757 	_delay: function( handler, delay ) {
   728 		function handlerProxy() {
   758 		function handlerProxy() {
   729 			return ( typeof handler === "string" ? instance[ handler ] : handler )
   759 			return ( typeof handler === "string" ? instance[ handler ] : handler )
   821 			});
   851 			});
   822 		}
   852 		}
   823 	};
   853 	};
   824 });
   854 });
   825 
   855 
   826 })( jQuery );
   856 var widget = $.widget;
   827 
   857 
   828 (function( $, undefined ) {
   858 
       
   859 /*!
       
   860  * jQuery UI Mouse 1.11.4
       
   861  * http://jqueryui.com
       
   862  *
       
   863  * Copyright jQuery Foundation and other contributors
       
   864  * Released under the MIT license.
       
   865  * http://jquery.org/license
       
   866  *
       
   867  * http://api.jqueryui.com/mouse/
       
   868  */
       
   869 
   829 
   870 
   830 var mouseHandled = false;
   871 var mouseHandled = false;
   831 $( document ).mouseup( function() {
   872 $( document ).mouseup( function() {
   832 	mouseHandled = false;
   873 	mouseHandled = false;
   833 });
   874 });
   834 
   875 
   835 $.widget("ui.mouse", {
   876 var mouse = $.widget("ui.mouse", {
   836 	version: "1.10.3",
   877 	version: "1.11.4",
   837 	options: {
   878 	options: {
   838 		cancel: "input,textarea,button,select,option",
   879 		cancel: "input,textarea,button,select,option",
   839 		distance: 1,
   880 		distance: 1,
   840 		delay: 0
   881 		delay: 0
   841 	},
   882 	},
   842 	_mouseInit: function() {
   883 	_mouseInit: function() {
   843 		var that = this;
   884 		var that = this;
   844 
   885 
   845 		this.element
   886 		this.element
   846 			.bind("mousedown."+this.widgetName, function(event) {
   887 			.bind("mousedown." + this.widgetName, function(event) {
   847 				return that._mouseDown(event);
   888 				return that._mouseDown(event);
   848 			})
   889 			})
   849 			.bind("click."+this.widgetName, function(event) {
   890 			.bind("click." + this.widgetName, function(event) {
   850 				if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
   891 				if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
   851 					$.removeData(event.target, that.widgetName + ".preventClickEvent");
   892 					$.removeData(event.target, that.widgetName + ".preventClickEvent");
   852 					event.stopImmediatePropagation();
   893 					event.stopImmediatePropagation();
   853 					return false;
   894 					return false;
   854 				}
   895 				}
   858 	},
   899 	},
   859 
   900 
   860 	// TODO: make sure destroying one instance of mouse doesn't mess with
   901 	// TODO: make sure destroying one instance of mouse doesn't mess with
   861 	// other instances of mouse
   902 	// other instances of mouse
   862 	_mouseDestroy: function() {
   903 	_mouseDestroy: function() {
   863 		this.element.unbind("."+this.widgetName);
   904 		this.element.unbind("." + this.widgetName);
   864 		if ( this._mouseMoveDelegate ) {
   905 		if ( this._mouseMoveDelegate ) {
   865 			$(document)
   906 			this.document
   866 				.unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
   907 				.unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
   867 				.unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
   908 				.unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
   868 		}
   909 		}
   869 	},
   910 	},
   870 
   911 
   871 	_mouseDown: function(event) {
   912 	_mouseDown: function(event) {
   872 		// don't let more than one widget handle mouseStart
   913 		// don't let more than one widget handle mouseStart
   873 		if( mouseHandled ) { return; }
   914 		if ( mouseHandled ) {
       
   915 			return;
       
   916 		}
       
   917 
       
   918 		this._mouseMoved = false;
   874 
   919 
   875 		// we may have missed mouseup (out of window)
   920 		// we may have missed mouseup (out of window)
   876 		(this._mouseStarted && this._mouseUp(event));
   921 		(this._mouseStarted && this._mouseUp(event));
   877 
   922 
   878 		this._mouseDownEvent = event;
   923 		this._mouseDownEvent = event;
   911 			return that._mouseMove(event);
   956 			return that._mouseMove(event);
   912 		};
   957 		};
   913 		this._mouseUpDelegate = function(event) {
   958 		this._mouseUpDelegate = function(event) {
   914 			return that._mouseUp(event);
   959 			return that._mouseUp(event);
   915 		};
   960 		};
   916 		$(document)
   961 
   917 			.bind("mousemove."+this.widgetName, this._mouseMoveDelegate)
   962 		this.document
   918 			.bind("mouseup."+this.widgetName, this._mouseUpDelegate);
   963 			.bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
       
   964 			.bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
   919 
   965 
   920 		event.preventDefault();
   966 		event.preventDefault();
   921 
   967 
   922 		mouseHandled = true;
   968 		mouseHandled = true;
   923 		return true;
   969 		return true;
   924 	},
   970 	},
   925 
   971 
   926 	_mouseMove: function(event) {
   972 	_mouseMove: function(event) {
   927 		// IE mouseup check - mouseup happened when mouse was out of window
   973 		// Only check for mouseups outside the document if you've moved inside the document
   928 		if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
   974 		// at least once. This prevents the firing of mouseup in the case of IE<9, which will
   929 			return this._mouseUp(event);
   975 		// fire a mousemove event if content is placed under the cursor. See #7778
       
   976 		// Support: IE <9
       
   977 		if ( this._mouseMoved ) {
       
   978 			// IE mouseup check - mouseup happened when mouse was out of window
       
   979 			if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
       
   980 				return this._mouseUp(event);
       
   981 
       
   982 			// Iframe mouseup check - mouseup occurred in another document
       
   983 			} else if ( !event.which ) {
       
   984 				return this._mouseUp( event );
       
   985 			}
       
   986 		}
       
   987 
       
   988 		if ( event.which || event.button ) {
       
   989 			this._mouseMoved = true;
   930 		}
   990 		}
   931 
   991 
   932 		if (this._mouseStarted) {
   992 		if (this._mouseStarted) {
   933 			this._mouseDrag(event);
   993 			this._mouseDrag(event);
   934 			return event.preventDefault();
   994 			return event.preventDefault();
   942 
  1002 
   943 		return !this._mouseStarted;
  1003 		return !this._mouseStarted;
   944 	},
  1004 	},
   945 
  1005 
   946 	_mouseUp: function(event) {
  1006 	_mouseUp: function(event) {
   947 		$(document)
  1007 		this.document
   948 			.unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
  1008 			.unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
   949 			.unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
  1009 			.unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
   950 
  1010 
   951 		if (this._mouseStarted) {
  1011 		if (this._mouseStarted) {
   952 			this._mouseStarted = false;
  1012 			this._mouseStarted = false;
   953 
  1013 
   954 			if (event.target === this._mouseDownEvent.target) {
  1014 			if (event.target === this._mouseDownEvent.target) {
   956 			}
  1016 			}
   957 
  1017 
   958 			this._mouseStop(event);
  1018 			this._mouseStop(event);
   959 		}
  1019 		}
   960 
  1020 
       
  1021 		mouseHandled = false;
   961 		return false;
  1022 		return false;
   962 	},
  1023 	},
   963 
  1024 
   964 	_mouseDistanceMet: function(event) {
  1025 	_mouseDistanceMet: function(event) {
   965 		return (Math.max(
  1026 		return (Math.max(
   978 	_mouseDrag: function(/* event */) {},
  1039 	_mouseDrag: function(/* event */) {},
   979 	_mouseStop: function(/* event */) {},
  1040 	_mouseStop: function(/* event */) {},
   980 	_mouseCapture: function(/* event */) { return true; }
  1041 	_mouseCapture: function(/* event */) { return true; }
   981 });
  1042 });
   982 
  1043 
   983 })(jQuery);
       
   984 
       
   985 (function( $, undefined ) {
       
   986 
       
   987 $.widget("ui.draggable", $.ui.mouse, {
       
   988 	version: "1.10.3",
       
   989 	widgetEventPrefix: "drag",
       
   990 	options: {
       
   991 		addClasses: true,
       
   992 		appendTo: "parent",
       
   993 		axis: false,
       
   994 		connectToSortable: false,
       
   995 		containment: false,
       
   996 		cursor: "auto",
       
   997 		cursorAt: false,
       
   998 		grid: false,
       
   999 		handle: false,
       
  1000 		helper: "original",
       
  1001 		iframeFix: false,
       
  1002 		opacity: false,
       
  1003 		refreshPositions: false,
       
  1004 		revert: false,
       
  1005 		revertDuration: 500,
       
  1006 		scope: "default",
       
  1007 		scroll: true,
       
  1008 		scrollSensitivity: 20,
       
  1009 		scrollSpeed: 20,
       
  1010 		snap: false,
       
  1011 		snapMode: "both",
       
  1012 		snapTolerance: 20,
       
  1013 		stack: false,
       
  1014 		zIndex: false,
       
  1015 
       
  1016 		// callbacks
       
  1017 		drag: null,
       
  1018 		start: null,
       
  1019 		stop: null
       
  1020 	},
       
  1021 	_create: function() {
       
  1022 
       
  1023 		if (this.options.helper === "original" && !(/^(?:r|a|f)/).test(this.element.css("position"))) {
       
  1024 			this.element[0].style.position = "relative";
       
  1025 		}
       
  1026 		if (this.options.addClasses){
       
  1027 			this.element.addClass("ui-draggable");
       
  1028 		}
       
  1029 		if (this.options.disabled){
       
  1030 			this.element.addClass("ui-draggable-disabled");
       
  1031 		}
       
  1032 
       
  1033 		this._mouseInit();
       
  1034 
       
  1035 	},
       
  1036 
       
  1037 	_destroy: function() {
       
  1038 		this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
       
  1039 		this._mouseDestroy();
       
  1040 	},
       
  1041 
       
  1042 	_mouseCapture: function(event) {
       
  1043 
       
  1044 		var o = this.options;
       
  1045 
       
  1046 		// among others, prevent a drag on a resizable-handle
       
  1047 		if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
       
  1048 			return false;
       
  1049 		}
       
  1050 
       
  1051 		//Quit if we're not on a valid handle
       
  1052 		this.handle = this._getHandle(event);
       
  1053 		if (!this.handle) {
       
  1054 			return false;
       
  1055 		}
       
  1056 
       
  1057 		$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
       
  1058 			$("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>")
       
  1059 			.css({
       
  1060 				width: this.offsetWidth+"px", height: this.offsetHeight+"px",
       
  1061 				position: "absolute", opacity: "0.001", zIndex: 1000
       
  1062 			})
       
  1063 			.css($(this).offset())
       
  1064 			.appendTo("body");
       
  1065 		});
       
  1066 
       
  1067 		return true;
       
  1068 
       
  1069 	},
       
  1070 
       
  1071 	_mouseStart: function(event) {
       
  1072 
       
  1073 		var o = this.options;
       
  1074 
       
  1075 		//Create and append the visible helper
       
  1076 		this.helper = this._createHelper(event);
       
  1077 
       
  1078 		this.helper.addClass("ui-draggable-dragging");
       
  1079 
       
  1080 		//Cache the helper size
       
  1081 		this._cacheHelperProportions();
       
  1082 
       
  1083 		//If ddmanager is used for droppables, set the global draggable
       
  1084 		if($.ui.ddmanager) {
       
  1085 			$.ui.ddmanager.current = this;
       
  1086 		}
       
  1087 
       
  1088 		/*
       
  1089 		 * - Position generation -
       
  1090 		 * This block generates everything position related - it's the core of draggables.
       
  1091 		 */
       
  1092 
       
  1093 		//Cache the margins of the original element
       
  1094 		this._cacheMargins();
       
  1095 
       
  1096 		//Store the helper's css position
       
  1097 		this.cssPosition = this.helper.css( "position" );
       
  1098 		this.scrollParent = this.helper.scrollParent();
       
  1099 		this.offsetParent = this.helper.offsetParent();
       
  1100 		this.offsetParentCssPosition = this.offsetParent.css( "position" );
       
  1101 
       
  1102 		//The element's absolute position on the page minus margins
       
  1103 		this.offset = this.positionAbs = this.element.offset();
       
  1104 		this.offset = {
       
  1105 			top: this.offset.top - this.margins.top,
       
  1106 			left: this.offset.left - this.margins.left
       
  1107 		};
       
  1108 
       
  1109 		//Reset scroll cache
       
  1110 		this.offset.scroll = false;
       
  1111 
       
  1112 		$.extend(this.offset, {
       
  1113 			click: { //Where the click happened, relative to the element
       
  1114 				left: event.pageX - this.offset.left,
       
  1115 				top: event.pageY - this.offset.top
       
  1116 			},
       
  1117 			parent: this._getParentOffset(),
       
  1118 			relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
       
  1119 		});
       
  1120 
       
  1121 		//Generate the original position
       
  1122 		this.originalPosition = this.position = this._generatePosition(event);
       
  1123 		this.originalPageX = event.pageX;
       
  1124 		this.originalPageY = event.pageY;
       
  1125 
       
  1126 		//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
       
  1127 		(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
       
  1128 
       
  1129 		//Set a containment if given in the options
       
  1130 		this._setContainment();
       
  1131 
       
  1132 		//Trigger event + callbacks
       
  1133 		if(this._trigger("start", event) === false) {
       
  1134 			this._clear();
       
  1135 			return false;
       
  1136 		}
       
  1137 
       
  1138 		//Recache the helper size
       
  1139 		this._cacheHelperProportions();
       
  1140 
       
  1141 		//Prepare the droppable offsets
       
  1142 		if ($.ui.ddmanager && !o.dropBehaviour) {
       
  1143 			$.ui.ddmanager.prepareOffsets(this, event);
       
  1144 		}
       
  1145 
       
  1146 
       
  1147 		this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
       
  1148 
       
  1149 		//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
       
  1150 		if ( $.ui.ddmanager ) {
       
  1151 			$.ui.ddmanager.dragStart(this, event);
       
  1152 		}
       
  1153 
       
  1154 		return true;
       
  1155 	},
       
  1156 
       
  1157 	_mouseDrag: function(event, noPropagation) {
       
  1158 		// reset any necessary cached properties (see #5009)
       
  1159 		if ( this.offsetParentCssPosition === "fixed" ) {
       
  1160 			this.offset.parent = this._getParentOffset();
       
  1161 		}
       
  1162 
       
  1163 		//Compute the helpers position
       
  1164 		this.position = this._generatePosition(event);
       
  1165 		this.positionAbs = this._convertPositionTo("absolute");
       
  1166 
       
  1167 		//Call plugins and callbacks and use the resulting position if something is returned
       
  1168 		if (!noPropagation) {
       
  1169 			var ui = this._uiHash();
       
  1170 			if(this._trigger("drag", event, ui) === false) {
       
  1171 				this._mouseUp({});
       
  1172 				return false;
       
  1173 			}
       
  1174 			this.position = ui.position;
       
  1175 		}
       
  1176 
       
  1177 		if(!this.options.axis || this.options.axis !== "y") {
       
  1178 			this.helper[0].style.left = this.position.left+"px";
       
  1179 		}
       
  1180 		if(!this.options.axis || this.options.axis !== "x") {
       
  1181 			this.helper[0].style.top = this.position.top+"px";
       
  1182 		}
       
  1183 		if($.ui.ddmanager) {
       
  1184 			$.ui.ddmanager.drag(this, event);
       
  1185 		}
       
  1186 
       
  1187 		return false;
       
  1188 	},
       
  1189 
       
  1190 	_mouseStop: function(event) {
       
  1191 
       
  1192 		//If we are using droppables, inform the manager about the drop
       
  1193 		var that = this,
       
  1194 			dropped = false;
       
  1195 		if ($.ui.ddmanager && !this.options.dropBehaviour) {
       
  1196 			dropped = $.ui.ddmanager.drop(this, event);
       
  1197 		}
       
  1198 
       
  1199 		//if a drop comes from outside (a sortable)
       
  1200 		if(this.dropped) {
       
  1201 			dropped = this.dropped;
       
  1202 			this.dropped = false;
       
  1203 		}
       
  1204 
       
  1205 		//if the original element is no longer in the DOM don't bother to continue (see #8269)
       
  1206 		if ( this.options.helper === "original" && !$.contains( this.element[ 0 ].ownerDocument, this.element[ 0 ] ) ) {
       
  1207 			return false;
       
  1208 		}
       
  1209 
       
  1210 		if((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
       
  1211 			$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
       
  1212 				if(that._trigger("stop", event) !== false) {
       
  1213 					that._clear();
       
  1214 				}
       
  1215 			});
       
  1216 		} else {
       
  1217 			if(this._trigger("stop", event) !== false) {
       
  1218 				this._clear();
       
  1219 			}
       
  1220 		}
       
  1221 
       
  1222 		return false;
       
  1223 	},
       
  1224 
       
  1225 	_mouseUp: function(event) {
       
  1226 		//Remove frame helpers
       
  1227 		$("div.ui-draggable-iframeFix").each(function() {
       
  1228 			this.parentNode.removeChild(this);
       
  1229 		});
       
  1230 
       
  1231 		//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
       
  1232 		if( $.ui.ddmanager ) {
       
  1233 			$.ui.ddmanager.dragStop(this, event);
       
  1234 		}
       
  1235 
       
  1236 		return $.ui.mouse.prototype._mouseUp.call(this, event);
       
  1237 	},
       
  1238 
       
  1239 	cancel: function() {
       
  1240 
       
  1241 		if(this.helper.is(".ui-draggable-dragging")) {
       
  1242 			this._mouseUp({});
       
  1243 		} else {
       
  1244 			this._clear();
       
  1245 		}
       
  1246 
       
  1247 		return this;
       
  1248 
       
  1249 	},
       
  1250 
       
  1251 	_getHandle: function(event) {
       
  1252 		return this.options.handle ?
       
  1253 			!!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
       
  1254 			true;
       
  1255 	},
       
  1256 
       
  1257 	_createHelper: function(event) {
       
  1258 
       
  1259 		var o = this.options,
       
  1260 			helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element);
       
  1261 
       
  1262 		if(!helper.parents("body").length) {
       
  1263 			helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
       
  1264 		}
       
  1265 
       
  1266 		if(helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
       
  1267 			helper.css("position", "absolute");
       
  1268 		}
       
  1269 
       
  1270 		return helper;
       
  1271 
       
  1272 	},
       
  1273 
       
  1274 	_adjustOffsetFromHelper: function(obj) {
       
  1275 		if (typeof obj === "string") {
       
  1276 			obj = obj.split(" ");
       
  1277 		}
       
  1278 		if ($.isArray(obj)) {
       
  1279 			obj = {left: +obj[0], top: +obj[1] || 0};
       
  1280 		}
       
  1281 		if ("left" in obj) {
       
  1282 			this.offset.click.left = obj.left + this.margins.left;
       
  1283 		}
       
  1284 		if ("right" in obj) {
       
  1285 			this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
       
  1286 		}
       
  1287 		if ("top" in obj) {
       
  1288 			this.offset.click.top = obj.top + this.margins.top;
       
  1289 		}
       
  1290 		if ("bottom" in obj) {
       
  1291 			this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
       
  1292 		}
       
  1293 	},
       
  1294 
       
  1295 	_getParentOffset: function() {
       
  1296 
       
  1297 		//Get the offsetParent and cache its position
       
  1298 		var po = this.offsetParent.offset();
       
  1299 
       
  1300 		// This is a special case where we need to modify a offset calculated on start, since the following happened:
       
  1301 		// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
       
  1302 		// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
       
  1303 		//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
       
  1304 		if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
       
  1305 			po.left += this.scrollParent.scrollLeft();
       
  1306 			po.top += this.scrollParent.scrollTop();
       
  1307 		}
       
  1308 
       
  1309 		//This needs to be actually done for all browsers, since pageX/pageY includes this information
       
  1310 		//Ugly IE fix
       
  1311 		if((this.offsetParent[0] === document.body) ||
       
  1312 			(this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
       
  1313 			po = { top: 0, left: 0 };
       
  1314 		}
       
  1315 
       
  1316 		return {
       
  1317 			top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
       
  1318 			left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
       
  1319 		};
       
  1320 
       
  1321 	},
       
  1322 
       
  1323 	_getRelativeOffset: function() {
       
  1324 
       
  1325 		if(this.cssPosition === "relative") {
       
  1326 			var p = this.element.position();
       
  1327 			return {
       
  1328 				top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
       
  1329 				left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
       
  1330 			};
       
  1331 		} else {
       
  1332 			return { top: 0, left: 0 };
       
  1333 		}
       
  1334 
       
  1335 	},
       
  1336 
       
  1337 	_cacheMargins: function() {
       
  1338 		this.margins = {
       
  1339 			left: (parseInt(this.element.css("marginLeft"),10) || 0),
       
  1340 			top: (parseInt(this.element.css("marginTop"),10) || 0),
       
  1341 			right: (parseInt(this.element.css("marginRight"),10) || 0),
       
  1342 			bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
       
  1343 		};
       
  1344 	},
       
  1345 
       
  1346 	_cacheHelperProportions: function() {
       
  1347 		this.helperProportions = {
       
  1348 			width: this.helper.outerWidth(),
       
  1349 			height: this.helper.outerHeight()
       
  1350 		};
       
  1351 	},
       
  1352 
       
  1353 	_setContainment: function() {
       
  1354 
       
  1355 		var over, c, ce,
       
  1356 			o = this.options;
       
  1357 
       
  1358 		if ( !o.containment ) {
       
  1359 			this.containment = null;
       
  1360 			return;
       
  1361 		}
       
  1362 
       
  1363 		if ( o.containment === "window" ) {
       
  1364 			this.containment = [
       
  1365 				$( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
       
  1366 				$( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
       
  1367 				$( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left,
       
  1368 				$( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
       
  1369 			];
       
  1370 			return;
       
  1371 		}
       
  1372 
       
  1373 		if ( o.containment === "document") {
       
  1374 			this.containment = [
       
  1375 				0,
       
  1376 				0,
       
  1377 				$( document ).width() - this.helperProportions.width - this.margins.left,
       
  1378 				( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
       
  1379 			];
       
  1380 			return;
       
  1381 		}
       
  1382 
       
  1383 		if ( o.containment.constructor === Array ) {
       
  1384 			this.containment = o.containment;
       
  1385 			return;
       
  1386 		}
       
  1387 
       
  1388 		if ( o.containment === "parent" ) {
       
  1389 			o.containment = this.helper[ 0 ].parentNode;
       
  1390 		}
       
  1391 
       
  1392 		c = $( o.containment );
       
  1393 		ce = c[ 0 ];
       
  1394 
       
  1395 		if( !ce ) {
       
  1396 			return;
       
  1397 		}
       
  1398 
       
  1399 		over = c.css( "overflow" ) !== "hidden";
       
  1400 
       
  1401 		this.containment = [
       
  1402 			( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
       
  1403 			( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ) ,
       
  1404 			( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - this.helperProportions.width - this.margins.left - this.margins.right,
       
  1405 			( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - this.helperProportions.height - this.margins.top  - this.margins.bottom
       
  1406 		];
       
  1407 		this.relative_container = c;
       
  1408 	},
       
  1409 
       
  1410 	_convertPositionTo: function(d, pos) {
       
  1411 
       
  1412 		if(!pos) {
       
  1413 			pos = this.position;
       
  1414 		}
       
  1415 
       
  1416 		var mod = d === "absolute" ? 1 : -1,
       
  1417 			scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent;
       
  1418 
       
  1419 		//Cache the scroll
       
  1420 		if (!this.offset.scroll) {
       
  1421 			this.offset.scroll = {top : scroll.scrollTop(), left : scroll.scrollLeft()};
       
  1422 		}
       
  1423 
       
  1424 		return {
       
  1425 			top: (
       
  1426 				pos.top	+																// The absolute mouse position
       
  1427 				this.offset.relative.top * mod +										// Only for relative positioned nodes: Relative offset from element to offset parent
       
  1428 				this.offset.parent.top * mod -										// The offsetParent's offset without borders (offset + border)
       
  1429 				( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : this.offset.scroll.top ) * mod )
       
  1430 			),
       
  1431 			left: (
       
  1432 				pos.left +																// The absolute mouse position
       
  1433 				this.offset.relative.left * mod +										// Only for relative positioned nodes: Relative offset from element to offset parent
       
  1434 				this.offset.parent.left * mod	-										// The offsetParent's offset without borders (offset + border)
       
  1435 				( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : this.offset.scroll.left ) * mod )
       
  1436 			)
       
  1437 		};
       
  1438 
       
  1439 	},
       
  1440 
       
  1441 	_generatePosition: function(event) {
       
  1442 
       
  1443 		var containment, co, top, left,
       
  1444 			o = this.options,
       
  1445 			scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent,
       
  1446 			pageX = event.pageX,
       
  1447 			pageY = event.pageY;
       
  1448 
       
  1449 		//Cache the scroll
       
  1450 		if (!this.offset.scroll) {
       
  1451 			this.offset.scroll = {top : scroll.scrollTop(), left : scroll.scrollLeft()};
       
  1452 		}
       
  1453 
       
  1454 		/*
       
  1455 		 * - Position constraining -
       
  1456 		 * Constrain the position to a mix of grid, containment.
       
  1457 		 */
       
  1458 
       
  1459 		// If we are not dragging yet, we won't check for options
       
  1460 		if ( this.originalPosition ) {
       
  1461 			if ( this.containment ) {
       
  1462 				if ( this.relative_container ){
       
  1463 					co = this.relative_container.offset();
       
  1464 					containment = [
       
  1465 						this.containment[ 0 ] + co.left,
       
  1466 						this.containment[ 1 ] + co.top,
       
  1467 						this.containment[ 2 ] + co.left,
       
  1468 						this.containment[ 3 ] + co.top
       
  1469 					];
       
  1470 				}
       
  1471 				else {
       
  1472 					containment = this.containment;
       
  1473 				}
       
  1474 
       
  1475 				if(event.pageX - this.offset.click.left < containment[0]) {
       
  1476 					pageX = containment[0] + this.offset.click.left;
       
  1477 				}
       
  1478 				if(event.pageY - this.offset.click.top < containment[1]) {
       
  1479 					pageY = containment[1] + this.offset.click.top;
       
  1480 				}
       
  1481 				if(event.pageX - this.offset.click.left > containment[2]) {
       
  1482 					pageX = containment[2] + this.offset.click.left;
       
  1483 				}
       
  1484 				if(event.pageY - this.offset.click.top > containment[3]) {
       
  1485 					pageY = containment[3] + this.offset.click.top;
       
  1486 				}
       
  1487 			}
       
  1488 
       
  1489 			if(o.grid) {
       
  1490 				//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
       
  1491 				top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
       
  1492 				pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
       
  1493 
       
  1494 				left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
       
  1495 				pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
       
  1496 			}
       
  1497 
       
  1498 		}
       
  1499 
       
  1500 		return {
       
  1501 			top: (
       
  1502 				pageY -																	// The absolute mouse position
       
  1503 				this.offset.click.top	-												// Click offset (relative to the element)
       
  1504 				this.offset.relative.top -												// Only for relative positioned nodes: Relative offset from element to offset parent
       
  1505 				this.offset.parent.top +												// The offsetParent's offset without borders (offset + border)
       
  1506 				( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : this.offset.scroll.top )
       
  1507 			),
       
  1508 			left: (
       
  1509 				pageX -																	// The absolute mouse position
       
  1510 				this.offset.click.left -												// Click offset (relative to the element)
       
  1511 				this.offset.relative.left -												// Only for relative positioned nodes: Relative offset from element to offset parent
       
  1512 				this.offset.parent.left +												// The offsetParent's offset without borders (offset + border)
       
  1513 				( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : this.offset.scroll.left )
       
  1514 			)
       
  1515 		};
       
  1516 
       
  1517 	},
       
  1518 
       
  1519 	_clear: function() {
       
  1520 		this.helper.removeClass("ui-draggable-dragging");
       
  1521 		if(this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
       
  1522 			this.helper.remove();
       
  1523 		}
       
  1524 		this.helper = null;
       
  1525 		this.cancelHelperRemoval = false;
       
  1526 	},
       
  1527 
       
  1528 	// From now on bulk stuff - mainly helpers
       
  1529 
       
  1530 	_trigger: function(type, event, ui) {
       
  1531 		ui = ui || this._uiHash();
       
  1532 		$.ui.plugin.call(this, type, [event, ui]);
       
  1533 		//The absolute position has to be recalculated after plugins
       
  1534 		if(type === "drag") {
       
  1535 			this.positionAbs = this._convertPositionTo("absolute");
       
  1536 		}
       
  1537 		return $.Widget.prototype._trigger.call(this, type, event, ui);
       
  1538 	},
       
  1539 
       
  1540 	plugins: {},
       
  1541 
       
  1542 	_uiHash: function() {
       
  1543 		return {
       
  1544 			helper: this.helper,
       
  1545 			position: this.position,
       
  1546 			originalPosition: this.originalPosition,
       
  1547 			offset: this.positionAbs
       
  1548 		};
       
  1549 	}
       
  1550 
       
  1551 });
       
  1552 
       
  1553 $.ui.plugin.add("draggable", "connectToSortable", {
       
  1554 	start: function(event, ui) {
       
  1555 
       
  1556 		var inst = $(this).data("ui-draggable"), o = inst.options,
       
  1557 			uiSortable = $.extend({}, ui, { item: inst.element });
       
  1558 		inst.sortables = [];
       
  1559 		$(o.connectToSortable).each(function() {
       
  1560 			var sortable = $.data(this, "ui-sortable");
       
  1561 			if (sortable && !sortable.options.disabled) {
       
  1562 				inst.sortables.push({
       
  1563 					instance: sortable,
       
  1564 					shouldRevert: sortable.options.revert
       
  1565 				});
       
  1566 				sortable.refreshPositions();	// Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
       
  1567 				sortable._trigger("activate", event, uiSortable);
       
  1568 			}
       
  1569 		});
       
  1570 
       
  1571 	},
       
  1572 	stop: function(event, ui) {
       
  1573 
       
  1574 		//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
       
  1575 		var inst = $(this).data("ui-draggable"),
       
  1576 			uiSortable = $.extend({}, ui, { item: inst.element });
       
  1577 
       
  1578 		$.each(inst.sortables, function() {
       
  1579 			if(this.instance.isOver) {
       
  1580 
       
  1581 				this.instance.isOver = 0;
       
  1582 
       
  1583 				inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
       
  1584 				this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
       
  1585 
       
  1586 				//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: "valid/invalid"
       
  1587 				if(this.shouldRevert) {
       
  1588 					this.instance.options.revert = this.shouldRevert;
       
  1589 				}
       
  1590 
       
  1591 				//Trigger the stop of the sortable
       
  1592 				this.instance._mouseStop(event);
       
  1593 
       
  1594 				this.instance.options.helper = this.instance.options._helper;
       
  1595 
       
  1596 				//If the helper has been the original item, restore properties in the sortable
       
  1597 				if(inst.options.helper === "original") {
       
  1598 					this.instance.currentItem.css({ top: "auto", left: "auto" });
       
  1599 				}
       
  1600 
       
  1601 			} else {
       
  1602 				this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
       
  1603 				this.instance._trigger("deactivate", event, uiSortable);
       
  1604 			}
       
  1605 
       
  1606 		});
       
  1607 
       
  1608 	},
       
  1609 	drag: function(event, ui) {
       
  1610 
       
  1611 		var inst = $(this).data("ui-draggable"), that = this;
       
  1612 
       
  1613 		$.each(inst.sortables, function() {
       
  1614 
       
  1615 			var innermostIntersecting = false,
       
  1616 				thisSortable = this;
       
  1617 
       
  1618 			//Copy over some variables to allow calling the sortable's native _intersectsWith
       
  1619 			this.instance.positionAbs = inst.positionAbs;
       
  1620 			this.instance.helperProportions = inst.helperProportions;
       
  1621 			this.instance.offset.click = inst.offset.click;
       
  1622 
       
  1623 			if(this.instance._intersectsWith(this.instance.containerCache)) {
       
  1624 				innermostIntersecting = true;
       
  1625 				$.each(inst.sortables, function () {
       
  1626 					this.instance.positionAbs = inst.positionAbs;
       
  1627 					this.instance.helperProportions = inst.helperProportions;
       
  1628 					this.instance.offset.click = inst.offset.click;
       
  1629 					if (this !== thisSortable &&
       
  1630 						this.instance._intersectsWith(this.instance.containerCache) &&
       
  1631 						$.contains(thisSortable.instance.element[0], this.instance.element[0])
       
  1632 					) {
       
  1633 						innermostIntersecting = false;
       
  1634 					}
       
  1635 					return innermostIntersecting;
       
  1636 				});
       
  1637 			}
       
  1638 
       
  1639 
       
  1640 			if(innermostIntersecting) {
       
  1641 				//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
       
  1642 				if(!this.instance.isOver) {
       
  1643 
       
  1644 					this.instance.isOver = 1;
       
  1645 					//Now we fake the start of dragging for the sortable instance,
       
  1646 					//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
       
  1647 					//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
       
  1648 					this.instance.currentItem = $(that).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item", true);
       
  1649 					this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
       
  1650 					this.instance.options.helper = function() { return ui.helper[0]; };
       
  1651 
       
  1652 					event.target = this.instance.currentItem[0];
       
  1653 					this.instance._mouseCapture(event, true);
       
  1654 					this.instance._mouseStart(event, true, true);
       
  1655 
       
  1656 					//Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
       
  1657 					this.instance.offset.click.top = inst.offset.click.top;
       
  1658 					this.instance.offset.click.left = inst.offset.click.left;
       
  1659 					this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
       
  1660 					this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
       
  1661 
       
  1662 					inst._trigger("toSortable", event);
       
  1663 					inst.dropped = this.instance.element; //draggable revert needs that
       
  1664 					//hack so receive/update callbacks work (mostly)
       
  1665 					inst.currentItem = inst.element;
       
  1666 					this.instance.fromOutside = inst;
       
  1667 
       
  1668 				}
       
  1669 
       
  1670 				//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
       
  1671 				if(this.instance.currentItem) {
       
  1672 					this.instance._mouseDrag(event);
       
  1673 				}
       
  1674 
       
  1675 			} else {
       
  1676 
       
  1677 				//If it doesn't intersect with the sortable, and it intersected before,
       
  1678 				//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
       
  1679 				if(this.instance.isOver) {
       
  1680 
       
  1681 					this.instance.isOver = 0;
       
  1682 					this.instance.cancelHelperRemoval = true;
       
  1683 
       
  1684 					//Prevent reverting on this forced stop
       
  1685 					this.instance.options.revert = false;
       
  1686 
       
  1687 					// The out event needs to be triggered independently
       
  1688 					this.instance._trigger("out", event, this.instance._uiHash(this.instance));
       
  1689 
       
  1690 					this.instance._mouseStop(event, true);
       
  1691 					this.instance.options.helper = this.instance.options._helper;
       
  1692 
       
  1693 					//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
       
  1694 					this.instance.currentItem.remove();
       
  1695 					if(this.instance.placeholder) {
       
  1696 						this.instance.placeholder.remove();
       
  1697 					}
       
  1698 
       
  1699 					inst._trigger("fromSortable", event);
       
  1700 					inst.dropped = false; //draggable revert needs that
       
  1701 				}
       
  1702 
       
  1703 			}
       
  1704 
       
  1705 		});
       
  1706 
       
  1707 	}
       
  1708 });
       
  1709 
       
  1710 $.ui.plugin.add("draggable", "cursor", {
       
  1711 	start: function() {
       
  1712 		var t = $("body"), o = $(this).data("ui-draggable").options;
       
  1713 		if (t.css("cursor")) {
       
  1714 			o._cursor = t.css("cursor");
       
  1715 		}
       
  1716 		t.css("cursor", o.cursor);
       
  1717 	},
       
  1718 	stop: function() {
       
  1719 		var o = $(this).data("ui-draggable").options;
       
  1720 		if (o._cursor) {
       
  1721 			$("body").css("cursor", o._cursor);
       
  1722 		}
       
  1723 	}
       
  1724 });
       
  1725 
       
  1726 $.ui.plugin.add("draggable", "opacity", {
       
  1727 	start: function(event, ui) {
       
  1728 		var t = $(ui.helper), o = $(this).data("ui-draggable").options;
       
  1729 		if(t.css("opacity")) {
       
  1730 			o._opacity = t.css("opacity");
       
  1731 		}
       
  1732 		t.css("opacity", o.opacity);
       
  1733 	},
       
  1734 	stop: function(event, ui) {
       
  1735 		var o = $(this).data("ui-draggable").options;
       
  1736 		if(o._opacity) {
       
  1737 			$(ui.helper).css("opacity", o._opacity);
       
  1738 		}
       
  1739 	}
       
  1740 });
       
  1741 
       
  1742 $.ui.plugin.add("draggable", "scroll", {
       
  1743 	start: function() {
       
  1744 		var i = $(this).data("ui-draggable");
       
  1745 		if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") {
       
  1746 			i.overflowOffset = i.scrollParent.offset();
       
  1747 		}
       
  1748 	},
       
  1749 	drag: function( event ) {
       
  1750 
       
  1751 		var i = $(this).data("ui-draggable"), o = i.options, scrolled = false;
       
  1752 
       
  1753 		if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") {
       
  1754 
       
  1755 			if(!o.axis || o.axis !== "x") {
       
  1756 				if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
       
  1757 					i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
       
  1758 				} else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) {
       
  1759 					i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
       
  1760 				}
       
  1761 			}
       
  1762 
       
  1763 			if(!o.axis || o.axis !== "y") {
       
  1764 				if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
       
  1765 					i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
       
  1766 				} else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) {
       
  1767 					i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
       
  1768 				}
       
  1769 			}
       
  1770 
       
  1771 		} else {
       
  1772 
       
  1773 			if(!o.axis || o.axis !== "x") {
       
  1774 				if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
       
  1775 					scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
       
  1776 				} else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
       
  1777 					scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
       
  1778 				}
       
  1779 			}
       
  1780 
       
  1781 			if(!o.axis || o.axis !== "y") {
       
  1782 				if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
       
  1783 					scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
       
  1784 				} else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
       
  1785 					scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
       
  1786 				}
       
  1787 			}
       
  1788 
       
  1789 		}
       
  1790 
       
  1791 		if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
       
  1792 			$.ui.ddmanager.prepareOffsets(i, event);
       
  1793 		}
       
  1794 
       
  1795 	}
       
  1796 });
       
  1797 
       
  1798 $.ui.plugin.add("draggable", "snap", {
       
  1799 	start: function() {
       
  1800 
       
  1801 		var i = $(this).data("ui-draggable"),
       
  1802 			o = i.options;
       
  1803 
       
  1804 		i.snapElements = [];
       
  1805 
       
  1806 		$(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
       
  1807 			var $t = $(this),
       
  1808 				$o = $t.offset();
       
  1809 			if(this !== i.element[0]) {
       
  1810 				i.snapElements.push({
       
  1811 					item: this,
       
  1812 					width: $t.outerWidth(), height: $t.outerHeight(),
       
  1813 					top: $o.top, left: $o.left
       
  1814 				});
       
  1815 			}
       
  1816 		});
       
  1817 
       
  1818 	},
       
  1819 	drag: function(event, ui) {
       
  1820 
       
  1821 		var ts, bs, ls, rs, l, r, t, b, i, first,
       
  1822 			inst = $(this).data("ui-draggable"),
       
  1823 			o = inst.options,
       
  1824 			d = o.snapTolerance,
       
  1825 			x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
       
  1826 			y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
       
  1827 
       
  1828 		for (i = inst.snapElements.length - 1; i >= 0; i--){
       
  1829 
       
  1830 			l = inst.snapElements[i].left;
       
  1831 			r = l + inst.snapElements[i].width;
       
  1832 			t = inst.snapElements[i].top;
       
  1833 			b = t + inst.snapElements[i].height;
       
  1834 
       
  1835 			if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
       
  1836 				if(inst.snapElements[i].snapping) {
       
  1837 					(inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
       
  1838 				}
       
  1839 				inst.snapElements[i].snapping = false;
       
  1840 				continue;
       
  1841 			}
       
  1842 
       
  1843 			if(o.snapMode !== "inner") {
       
  1844 				ts = Math.abs(t - y2) <= d;
       
  1845 				bs = Math.abs(b - y1) <= d;
       
  1846 				ls = Math.abs(l - x2) <= d;
       
  1847 				rs = Math.abs(r - x1) <= d;
       
  1848 				if(ts) {
       
  1849 					ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
       
  1850 				}
       
  1851 				if(bs) {
       
  1852 					ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
       
  1853 				}
       
  1854 				if(ls) {
       
  1855 					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
       
  1856 				}
       
  1857 				if(rs) {
       
  1858 					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
       
  1859 				}
       
  1860 			}
       
  1861 
       
  1862 			first = (ts || bs || ls || rs);
       
  1863 
       
  1864 			if(o.snapMode !== "outer") {
       
  1865 				ts = Math.abs(t - y1) <= d;
       
  1866 				bs = Math.abs(b - y2) <= d;
       
  1867 				ls = Math.abs(l - x1) <= d;
       
  1868 				rs = Math.abs(r - x2) <= d;
       
  1869 				if(ts) {
       
  1870 					ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
       
  1871 				}
       
  1872 				if(bs) {
       
  1873 					ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
       
  1874 				}
       
  1875 				if(ls) {
       
  1876 					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
       
  1877 				}
       
  1878 				if(rs) {
       
  1879 					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
       
  1880 				}
       
  1881 			}
       
  1882 
       
  1883 			if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
       
  1884 				(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
       
  1885 			}
       
  1886 			inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
       
  1887 
       
  1888 		}
       
  1889 
       
  1890 	}
       
  1891 });
       
  1892 
       
  1893 $.ui.plugin.add("draggable", "stack", {
       
  1894 	start: function() {
       
  1895 		var min,
       
  1896 			o = this.data("ui-draggable").options,
       
  1897 			group = $.makeArray($(o.stack)).sort(function(a,b) {
       
  1898 				return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
       
  1899 			});
       
  1900 
       
  1901 		if (!group.length) { return; }
       
  1902 
       
  1903 		min = parseInt($(group[0]).css("zIndex"), 10) || 0;
       
  1904 		$(group).each(function(i) {
       
  1905 			$(this).css("zIndex", min + i);
       
  1906 		});
       
  1907 		this.css("zIndex", (min + group.length));
       
  1908 	}
       
  1909 });
       
  1910 
       
  1911 $.ui.plugin.add("draggable", "zIndex", {
       
  1912 	start: function(event, ui) {
       
  1913 		var t = $(ui.helper), o = $(this).data("ui-draggable").options;
       
  1914 		if(t.css("zIndex")) {
       
  1915 			o._zIndex = t.css("zIndex");
       
  1916 		}
       
  1917 		t.css("zIndex", o.zIndex);
       
  1918 	},
       
  1919 	stop: function(event, ui) {
       
  1920 		var o = $(this).data("ui-draggable").options;
       
  1921 		if(o._zIndex) {
       
  1922 			$(ui.helper).css("zIndex", o._zIndex);
       
  1923 		}
       
  1924 	}
       
  1925 });
       
  1926 
       
  1927 })(jQuery);
       
  1928 
       
  1929 (function( $, undefined ) {
       
  1930 
       
  1931 function isOverAxis( x, reference, size ) {
       
  1932 	return ( x > reference ) && ( x < ( reference + size ) );
       
  1933 }
       
  1934 
       
  1935 $.widget("ui.droppable", {
       
  1936 	version: "1.10.3",
       
  1937 	widgetEventPrefix: "drop",
       
  1938 	options: {
       
  1939 		accept: "*",
       
  1940 		activeClass: false,
       
  1941 		addClasses: true,
       
  1942 		greedy: false,
       
  1943 		hoverClass: false,
       
  1944 		scope: "default",
       
  1945 		tolerance: "intersect",
       
  1946 
       
  1947 		// callbacks
       
  1948 		activate: null,
       
  1949 		deactivate: null,
       
  1950 		drop: null,
       
  1951 		out: null,
       
  1952 		over: null
       
  1953 	},
       
  1954 	_create: function() {
       
  1955 
       
  1956 		var o = this.options,
       
  1957 			accept = o.accept;
       
  1958 
       
  1959 		this.isover = false;
       
  1960 		this.isout = true;
       
  1961 
       
  1962 		this.accept = $.isFunction(accept) ? accept : function(d) {
       
  1963 			return d.is(accept);
       
  1964 		};
       
  1965 
       
  1966 		//Store the droppable's proportions
       
  1967 		this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
       
  1968 
       
  1969 		// Add the reference and positions to the manager
       
  1970 		$.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
       
  1971 		$.ui.ddmanager.droppables[o.scope].push(this);
       
  1972 
       
  1973 		(o.addClasses && this.element.addClass("ui-droppable"));
       
  1974 
       
  1975 	},
       
  1976 
       
  1977 	_destroy: function() {
       
  1978 		var i = 0,
       
  1979 			drop = $.ui.ddmanager.droppables[this.options.scope];
       
  1980 
       
  1981 		for ( ; i < drop.length; i++ ) {
       
  1982 			if ( drop[i] === this ) {
       
  1983 				drop.splice(i, 1);
       
  1984 			}
       
  1985 		}
       
  1986 
       
  1987 		this.element.removeClass("ui-droppable ui-droppable-disabled");
       
  1988 	},
       
  1989 
       
  1990 	_setOption: function(key, value) {
       
  1991 
       
  1992 		if(key === "accept") {
       
  1993 			this.accept = $.isFunction(value) ? value : function(d) {
       
  1994 				return d.is(value);
       
  1995 			};
       
  1996 		}
       
  1997 		$.Widget.prototype._setOption.apply(this, arguments);
       
  1998 	},
       
  1999 
       
  2000 	_activate: function(event) {
       
  2001 		var draggable = $.ui.ddmanager.current;
       
  2002 		if(this.options.activeClass) {
       
  2003 			this.element.addClass(this.options.activeClass);
       
  2004 		}
       
  2005 		if(draggable){
       
  2006 			this._trigger("activate", event, this.ui(draggable));
       
  2007 		}
       
  2008 	},
       
  2009 
       
  2010 	_deactivate: function(event) {
       
  2011 		var draggable = $.ui.ddmanager.current;
       
  2012 		if(this.options.activeClass) {
       
  2013 			this.element.removeClass(this.options.activeClass);
       
  2014 		}
       
  2015 		if(draggable){
       
  2016 			this._trigger("deactivate", event, this.ui(draggable));
       
  2017 		}
       
  2018 	},
       
  2019 
       
  2020 	_over: function(event) {
       
  2021 
       
  2022 		var draggable = $.ui.ddmanager.current;
       
  2023 
       
  2024 		// Bail if draggable and droppable are same element
       
  2025 		if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
       
  2026 			return;
       
  2027 		}
       
  2028 
       
  2029 		if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
       
  2030 			if(this.options.hoverClass) {
       
  2031 				this.element.addClass(this.options.hoverClass);
       
  2032 			}
       
  2033 			this._trigger("over", event, this.ui(draggable));
       
  2034 		}
       
  2035 
       
  2036 	},
       
  2037 
       
  2038 	_out: function(event) {
       
  2039 
       
  2040 		var draggable = $.ui.ddmanager.current;
       
  2041 
       
  2042 		// Bail if draggable and droppable are same element
       
  2043 		if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
       
  2044 			return;
       
  2045 		}
       
  2046 
       
  2047 		if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
       
  2048 			if(this.options.hoverClass) {
       
  2049 				this.element.removeClass(this.options.hoverClass);
       
  2050 			}
       
  2051 			this._trigger("out", event, this.ui(draggable));
       
  2052 		}
       
  2053 
       
  2054 	},
       
  2055 
       
  2056 	_drop: function(event,custom) {
       
  2057 
       
  2058 		var draggable = custom || $.ui.ddmanager.current,
       
  2059 			childrenIntersection = false;
       
  2060 
       
  2061 		// Bail if draggable and droppable are same element
       
  2062 		if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
       
  2063 			return false;
       
  2064 		}
       
  2065 
       
  2066 		this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() {
       
  2067 			var inst = $.data(this, "ui-droppable");
       
  2068 			if(
       
  2069 				inst.options.greedy &&
       
  2070 				!inst.options.disabled &&
       
  2071 				inst.options.scope === draggable.options.scope &&
       
  2072 				inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) &&
       
  2073 				$.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
       
  2074 			) { childrenIntersection = true; return false; }
       
  2075 		});
       
  2076 		if(childrenIntersection) {
       
  2077 			return false;
       
  2078 		}
       
  2079 
       
  2080 		if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
       
  2081 			if(this.options.activeClass) {
       
  2082 				this.element.removeClass(this.options.activeClass);
       
  2083 			}
       
  2084 			if(this.options.hoverClass) {
       
  2085 				this.element.removeClass(this.options.hoverClass);
       
  2086 			}
       
  2087 			this._trigger("drop", event, this.ui(draggable));
       
  2088 			return this.element;
       
  2089 		}
       
  2090 
       
  2091 		return false;
       
  2092 
       
  2093 	},
       
  2094 
       
  2095 	ui: function(c) {
       
  2096 		return {
       
  2097 			draggable: (c.currentItem || c.element),
       
  2098 			helper: c.helper,
       
  2099 			position: c.position,
       
  2100 			offset: c.positionAbs
       
  2101 		};
       
  2102 	}
       
  2103 
       
  2104 });
       
  2105 
       
  2106 $.ui.intersect = function(draggable, droppable, toleranceMode) {
       
  2107 
       
  2108 	if (!droppable.offset) {
       
  2109 		return false;
       
  2110 	}
       
  2111 
       
  2112 	var draggableLeft, draggableTop,
       
  2113 		x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
       
  2114 		y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height,
       
  2115 		l = droppable.offset.left, r = l + droppable.proportions.width,
       
  2116 		t = droppable.offset.top, b = t + droppable.proportions.height;
       
  2117 
       
  2118 	switch (toleranceMode) {
       
  2119 		case "fit":
       
  2120 			return (l <= x1 && x2 <= r && t <= y1 && y2 <= b);
       
  2121 		case "intersect":
       
  2122 			return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half
       
  2123 				x2 - (draggable.helperProportions.width / 2) < r && // Left Half
       
  2124 				t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half
       
  2125 				y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
       
  2126 		case "pointer":
       
  2127 			draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left);
       
  2128 			draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top);
       
  2129 			return isOverAxis( draggableTop, t, droppable.proportions.height ) && isOverAxis( draggableLeft, l, droppable.proportions.width );
       
  2130 		case "touch":
       
  2131 			return (
       
  2132 				(y1 >= t && y1 <= b) ||	// Top edge touching
       
  2133 				(y2 >= t && y2 <= b) ||	// Bottom edge touching
       
  2134 				(y1 < t && y2 > b)		// Surrounded vertically
       
  2135 			) && (
       
  2136 				(x1 >= l && x1 <= r) ||	// Left edge touching
       
  2137 				(x2 >= l && x2 <= r) ||	// Right edge touching
       
  2138 				(x1 < l && x2 > r)		// Surrounded horizontally
       
  2139 			);
       
  2140 		default:
       
  2141 			return false;
       
  2142 		}
       
  2143 
       
  2144 };
       
  2145 
       
  2146 /*
       
  2147 	This manager tracks offsets of draggables and droppables
       
  2148 */
       
  2149 $.ui.ddmanager = {
       
  2150 	current: null,
       
  2151 	droppables: { "default": [] },
       
  2152 	prepareOffsets: function(t, event) {
       
  2153 
       
  2154 		var i, j,
       
  2155 			m = $.ui.ddmanager.droppables[t.options.scope] || [],
       
  2156 			type = event ? event.type : null, // workaround for #2317
       
  2157 			list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack();
       
  2158 
       
  2159 		droppablesLoop: for (i = 0; i < m.length; i++) {
       
  2160 
       
  2161 			//No disabled and non-accepted
       
  2162 			if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) {
       
  2163 				continue;
       
  2164 			}
       
  2165 
       
  2166 			// Filter out elements in the current dragged item
       
  2167 			for (j=0; j < list.length; j++) {
       
  2168 				if(list[j] === m[i].element[0]) {
       
  2169 					m[i].proportions.height = 0;
       
  2170 					continue droppablesLoop;
       
  2171 				}
       
  2172 			}
       
  2173 
       
  2174 			m[i].visible = m[i].element.css("display") !== "none";
       
  2175 			if(!m[i].visible) {
       
  2176 				continue;
       
  2177 			}
       
  2178 
       
  2179 			//Activate the droppable if used directly from draggables
       
  2180 			if(type === "mousedown") {
       
  2181 				m[i]._activate.call(m[i], event);
       
  2182 			}
       
  2183 
       
  2184 			m[i].offset = m[i].element.offset();
       
  2185 			m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
       
  2186 
       
  2187 		}
       
  2188 
       
  2189 	},
       
  2190 	drop: function(draggable, event) {
       
  2191 
       
  2192 		var dropped = false;
       
  2193 		// Create a copy of the droppables in case the list changes during the drop (#9116)
       
  2194 		$.each(($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), function() {
       
  2195 
       
  2196 			if(!this.options) {
       
  2197 				return;
       
  2198 			}
       
  2199 			if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) {
       
  2200 				dropped = this._drop.call(this, event) || dropped;
       
  2201 			}
       
  2202 
       
  2203 			if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
       
  2204 				this.isout = true;
       
  2205 				this.isover = false;
       
  2206 				this._deactivate.call(this, event);
       
  2207 			}
       
  2208 
       
  2209 		});
       
  2210 		return dropped;
       
  2211 
       
  2212 	},
       
  2213 	dragStart: function( draggable, event ) {
       
  2214 		//Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
       
  2215 		draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
       
  2216 			if( !draggable.options.refreshPositions ) {
       
  2217 				$.ui.ddmanager.prepareOffsets( draggable, event );
       
  2218 			}
       
  2219 		});
       
  2220 	},
       
  2221 	drag: function(draggable, event) {
       
  2222 
       
  2223 		//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
       
  2224 		if(draggable.options.refreshPositions) {
       
  2225 			$.ui.ddmanager.prepareOffsets(draggable, event);
       
  2226 		}
       
  2227 
       
  2228 		//Run through all droppables and check their positions based on specific tolerance options
       
  2229 		$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
       
  2230 
       
  2231 			if(this.options.disabled || this.greedyChild || !this.visible) {
       
  2232 				return;
       
  2233 			}
       
  2234 
       
  2235 			var parentInstance, scope, parent,
       
  2236 				intersects = $.ui.intersect(draggable, this, this.options.tolerance),
       
  2237 				c = !intersects && this.isover ? "isout" : (intersects && !this.isover ? "isover" : null);
       
  2238 			if(!c) {
       
  2239 				return;
       
  2240 			}
       
  2241 
       
  2242 			if (this.options.greedy) {
       
  2243 				// find droppable parents with same scope
       
  2244 				scope = this.options.scope;
       
  2245 				parent = this.element.parents(":data(ui-droppable)").filter(function () {
       
  2246 					return $.data(this, "ui-droppable").options.scope === scope;
       
  2247 				});
       
  2248 
       
  2249 				if (parent.length) {
       
  2250 					parentInstance = $.data(parent[0], "ui-droppable");
       
  2251 					parentInstance.greedyChild = (c === "isover");
       
  2252 				}
       
  2253 			}
       
  2254 
       
  2255 			// we just moved into a greedy child
       
  2256 			if (parentInstance && c === "isover") {
       
  2257 				parentInstance.isover = false;
       
  2258 				parentInstance.isout = true;
       
  2259 				parentInstance._out.call(parentInstance, event);
       
  2260 			}
       
  2261 
       
  2262 			this[c] = true;
       
  2263 			this[c === "isout" ? "isover" : "isout"] = false;
       
  2264 			this[c === "isover" ? "_over" : "_out"].call(this, event);
       
  2265 
       
  2266 			// we just moved out of a greedy child
       
  2267 			if (parentInstance && c === "isout") {
       
  2268 				parentInstance.isout = false;
       
  2269 				parentInstance.isover = true;
       
  2270 				parentInstance._over.call(parentInstance, event);
       
  2271 			}
       
  2272 		});
       
  2273 
       
  2274 	},
       
  2275 	dragStop: function( draggable, event ) {
       
  2276 		draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
       
  2277 		//Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
       
  2278 		if( !draggable.options.refreshPositions ) {
       
  2279 			$.ui.ddmanager.prepareOffsets( draggable, event );
       
  2280 		}
       
  2281 	}
       
  2282 };
       
  2283 
       
  2284 })(jQuery);
       
  2285 
       
  2286 (function( $, undefined ) {
       
  2287 
       
  2288 function num(v) {
       
  2289 	return parseInt(v, 10) || 0;
       
  2290 }
       
  2291 
       
  2292 function isNumber(value) {
       
  2293 	return !isNaN(parseInt(value, 10));
       
  2294 }
       
  2295 
       
  2296 $.widget("ui.resizable", $.ui.mouse, {
       
  2297 	version: "1.10.3",
       
  2298 	widgetEventPrefix: "resize",
       
  2299 	options: {
       
  2300 		alsoResize: false,
       
  2301 		animate: false,
       
  2302 		animateDuration: "slow",
       
  2303 		animateEasing: "swing",
       
  2304 		aspectRatio: false,
       
  2305 		autoHide: false,
       
  2306 		containment: false,
       
  2307 		ghost: false,
       
  2308 		grid: false,
       
  2309 		handles: "e,s,se",
       
  2310 		helper: false,
       
  2311 		maxHeight: null,
       
  2312 		maxWidth: null,
       
  2313 		minHeight: 10,
       
  2314 		minWidth: 10,
       
  2315 		// See #7960
       
  2316 		zIndex: 90,
       
  2317 
       
  2318 		// callbacks
       
  2319 		resize: null,
       
  2320 		start: null,
       
  2321 		stop: null
       
  2322 	},
       
  2323 	_create: function() {
       
  2324 
       
  2325 		var n, i, handle, axis, hname,
       
  2326 			that = this,
       
  2327 			o = this.options;
       
  2328 		this.element.addClass("ui-resizable");
       
  2329 
       
  2330 		$.extend(this, {
       
  2331 			_aspectRatio: !!(o.aspectRatio),
       
  2332 			aspectRatio: o.aspectRatio,
       
  2333 			originalElement: this.element,
       
  2334 			_proportionallyResizeElements: [],
       
  2335 			_helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
       
  2336 		});
       
  2337 
       
  2338 		//Wrap the element if it cannot hold child nodes
       
  2339 		if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
       
  2340 
       
  2341 			//Create a wrapper element and set the wrapper to the new current internal element
       
  2342 			this.element.wrap(
       
  2343 				$("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
       
  2344 					position: this.element.css("position"),
       
  2345 					width: this.element.outerWidth(),
       
  2346 					height: this.element.outerHeight(),
       
  2347 					top: this.element.css("top"),
       
  2348 					left: this.element.css("left")
       
  2349 				})
       
  2350 			);
       
  2351 
       
  2352 			//Overwrite the original this.element
       
  2353 			this.element = this.element.parent().data(
       
  2354 				"ui-resizable", this.element.data("ui-resizable")
       
  2355 			);
       
  2356 
       
  2357 			this.elementIsWrapper = true;
       
  2358 
       
  2359 			//Move margins to the wrapper
       
  2360 			this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
       
  2361 			this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
       
  2362 
       
  2363 			//Prevent Safari textarea resize
       
  2364 			this.originalResizeStyle = this.originalElement.css("resize");
       
  2365 			this.originalElement.css("resize", "none");
       
  2366 
       
  2367 			//Push the actual element to our proportionallyResize internal array
       
  2368 			this._proportionallyResizeElements.push(this.originalElement.css({ position: "static", zoom: 1, display: "block" }));
       
  2369 
       
  2370 			// avoid IE jump (hard set the margin)
       
  2371 			this.originalElement.css({ margin: this.originalElement.css("margin") });
       
  2372 
       
  2373 			// fix handlers offset
       
  2374 			this._proportionallyResize();
       
  2375 
       
  2376 		}
       
  2377 
       
  2378 		this.handles = o.handles || (!$(".ui-resizable-handle", this.element).length ? "e,s,se" : { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw" });
       
  2379 		if(this.handles.constructor === String) {
       
  2380 
       
  2381 			if ( this.handles === "all") {
       
  2382 				this.handles = "n,e,s,w,se,sw,ne,nw";
       
  2383 			}
       
  2384 
       
  2385 			n = this.handles.split(",");
       
  2386 			this.handles = {};
       
  2387 
       
  2388 			for(i = 0; i < n.length; i++) {
       
  2389 
       
  2390 				handle = $.trim(n[i]);
       
  2391 				hname = "ui-resizable-"+handle;
       
  2392 				axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
       
  2393 
       
  2394 				// Apply zIndex to all handles - see #7960
       
  2395 				axis.css({ zIndex: o.zIndex });
       
  2396 
       
  2397 				//TODO : What's going on here?
       
  2398 				if ("se" === handle) {
       
  2399 					axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
       
  2400 				}
       
  2401 
       
  2402 				//Insert into internal handles object and append to element
       
  2403 				this.handles[handle] = ".ui-resizable-"+handle;
       
  2404 				this.element.append(axis);
       
  2405 			}
       
  2406 
       
  2407 		}
       
  2408 
       
  2409 		this._renderAxis = function(target) {
       
  2410 
       
  2411 			var i, axis, padPos, padWrapper;
       
  2412 
       
  2413 			target = target || this.element;
       
  2414 
       
  2415 			for(i in this.handles) {
       
  2416 
       
  2417 				if(this.handles[i].constructor === String) {
       
  2418 					this.handles[i] = $(this.handles[i], this.element).show();
       
  2419 				}
       
  2420 
       
  2421 				//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
       
  2422 				if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
       
  2423 
       
  2424 					axis = $(this.handles[i], this.element);
       
  2425 
       
  2426 					//Checking the correct pad and border
       
  2427 					padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
       
  2428 
       
  2429 					//The padding type i have to apply...
       
  2430 					padPos = [ "padding",
       
  2431 						/ne|nw|n/.test(i) ? "Top" :
       
  2432 						/se|sw|s/.test(i) ? "Bottom" :
       
  2433 						/^e$/.test(i) ? "Right" : "Left" ].join("");
       
  2434 
       
  2435 					target.css(padPos, padWrapper);
       
  2436 
       
  2437 					this._proportionallyResize();
       
  2438 
       
  2439 				}
       
  2440 
       
  2441 				//TODO: What's that good for? There's not anything to be executed left
       
  2442 				if(!$(this.handles[i]).length) {
       
  2443 					continue;
       
  2444 				}
       
  2445 			}
       
  2446 		};
       
  2447 
       
  2448 		//TODO: make renderAxis a prototype function
       
  2449 		this._renderAxis(this.element);
       
  2450 
       
  2451 		this._handles = $(".ui-resizable-handle", this.element)
       
  2452 			.disableSelection();
       
  2453 
       
  2454 		//Matching axis name
       
  2455 		this._handles.mouseover(function() {
       
  2456 			if (!that.resizing) {
       
  2457 				if (this.className) {
       
  2458 					axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
       
  2459 				}
       
  2460 				//Axis, default = se
       
  2461 				that.axis = axis && axis[1] ? axis[1] : "se";
       
  2462 			}
       
  2463 		});
       
  2464 
       
  2465 		//If we want to auto hide the elements
       
  2466 		if (o.autoHide) {
       
  2467 			this._handles.hide();
       
  2468 			$(this.element)
       
  2469 				.addClass("ui-resizable-autohide")
       
  2470 				.mouseenter(function() {
       
  2471 					if (o.disabled) {
       
  2472 						return;
       
  2473 					}
       
  2474 					$(this).removeClass("ui-resizable-autohide");
       
  2475 					that._handles.show();
       
  2476 				})
       
  2477 				.mouseleave(function(){
       
  2478 					if (o.disabled) {
       
  2479 						return;
       
  2480 					}
       
  2481 					if (!that.resizing) {
       
  2482 						$(this).addClass("ui-resizable-autohide");
       
  2483 						that._handles.hide();
       
  2484 					}
       
  2485 				});
       
  2486 		}
       
  2487 
       
  2488 		//Initialize the mouse interaction
       
  2489 		this._mouseInit();
       
  2490 
       
  2491 	},
       
  2492 
       
  2493 	_destroy: function() {
       
  2494 
       
  2495 		this._mouseDestroy();
       
  2496 
       
  2497 		var wrapper,
       
  2498 			_destroy = function(exp) {
       
  2499 				$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
       
  2500 					.removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove();
       
  2501 			};
       
  2502 
       
  2503 		//TODO: Unwrap at same DOM position
       
  2504 		if (this.elementIsWrapper) {
       
  2505 			_destroy(this.element);
       
  2506 			wrapper = this.element;
       
  2507 			this.originalElement.css({
       
  2508 				position: wrapper.css("position"),
       
  2509 				width: wrapper.outerWidth(),
       
  2510 				height: wrapper.outerHeight(),
       
  2511 				top: wrapper.css("top"),
       
  2512 				left: wrapper.css("left")
       
  2513 			}).insertAfter( wrapper );
       
  2514 			wrapper.remove();
       
  2515 		}
       
  2516 
       
  2517 		this.originalElement.css("resize", this.originalResizeStyle);
       
  2518 		_destroy(this.originalElement);
       
  2519 
       
  2520 		return this;
       
  2521 	},
       
  2522 
       
  2523 	_mouseCapture: function(event) {
       
  2524 		var i, handle,
       
  2525 			capture = false;
       
  2526 
       
  2527 		for (i in this.handles) {
       
  2528 			handle = $(this.handles[i])[0];
       
  2529 			if (handle === event.target || $.contains(handle, event.target)) {
       
  2530 				capture = true;
       
  2531 			}
       
  2532 		}
       
  2533 
       
  2534 		return !this.options.disabled && capture;
       
  2535 	},
       
  2536 
       
  2537 	_mouseStart: function(event) {
       
  2538 
       
  2539 		var curleft, curtop, cursor,
       
  2540 			o = this.options,
       
  2541 			iniPos = this.element.position(),
       
  2542 			el = this.element;
       
  2543 
       
  2544 		this.resizing = true;
       
  2545 
       
  2546 		// bugfix for http://dev.jquery.com/ticket/1749
       
  2547 		if ( (/absolute/).test( el.css("position") ) ) {
       
  2548 			el.css({ position: "absolute", top: el.css("top"), left: el.css("left") });
       
  2549 		} else if (el.is(".ui-draggable")) {
       
  2550 			el.css({ position: "absolute", top: iniPos.top, left: iniPos.left });
       
  2551 		}
       
  2552 
       
  2553 		this._renderProxy();
       
  2554 
       
  2555 		curleft = num(this.helper.css("left"));
       
  2556 		curtop = num(this.helper.css("top"));
       
  2557 
       
  2558 		if (o.containment) {
       
  2559 			curleft += $(o.containment).scrollLeft() || 0;
       
  2560 			curtop += $(o.containment).scrollTop() || 0;
       
  2561 		}
       
  2562 
       
  2563 		//Store needed variables
       
  2564 		this.offset = this.helper.offset();
       
  2565 		this.position = { left: curleft, top: curtop };
       
  2566 		this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
       
  2567 		this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
       
  2568 		this.originalPosition = { left: curleft, top: curtop };
       
  2569 		this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
       
  2570 		this.originalMousePosition = { left: event.pageX, top: event.pageY };
       
  2571 
       
  2572 		//Aspect Ratio
       
  2573 		this.aspectRatio = (typeof o.aspectRatio === "number") ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
       
  2574 
       
  2575 		cursor = $(".ui-resizable-" + this.axis).css("cursor");
       
  2576 		$("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
       
  2577 
       
  2578 		el.addClass("ui-resizable-resizing");
       
  2579 		this._propagate("start", event);
       
  2580 		return true;
       
  2581 	},
       
  2582 
       
  2583 	_mouseDrag: function(event) {
       
  2584 
       
  2585 		//Increase performance, avoid regex
       
  2586 		var data,
       
  2587 			el = this.helper, props = {},
       
  2588 			smp = this.originalMousePosition,
       
  2589 			a = this.axis,
       
  2590 			prevTop = this.position.top,
       
  2591 			prevLeft = this.position.left,
       
  2592 			prevWidth = this.size.width,
       
  2593 			prevHeight = this.size.height,
       
  2594 			dx = (event.pageX-smp.left)||0,
       
  2595 			dy = (event.pageY-smp.top)||0,
       
  2596 			trigger = this._change[a];
       
  2597 
       
  2598 		if (!trigger) {
       
  2599 			return false;
       
  2600 		}
       
  2601 
       
  2602 		// Calculate the attrs that will be change
       
  2603 		data = trigger.apply(this, [event, dx, dy]);
       
  2604 
       
  2605 		// Put this in the mouseDrag handler since the user can start pressing shift while resizing
       
  2606 		this._updateVirtualBoundaries(event.shiftKey);
       
  2607 		if (this._aspectRatio || event.shiftKey) {
       
  2608 			data = this._updateRatio(data, event);
       
  2609 		}
       
  2610 
       
  2611 		data = this._respectSize(data, event);
       
  2612 
       
  2613 		this._updateCache(data);
       
  2614 
       
  2615 		// plugins callbacks need to be called first
       
  2616 		this._propagate("resize", event);
       
  2617 
       
  2618 		if (this.position.top !== prevTop) {
       
  2619 			props.top = this.position.top + "px";
       
  2620 		}
       
  2621 		if (this.position.left !== prevLeft) {
       
  2622 			props.left = this.position.left + "px";
       
  2623 		}
       
  2624 		if (this.size.width !== prevWidth) {
       
  2625 			props.width = this.size.width + "px";
       
  2626 		}
       
  2627 		if (this.size.height !== prevHeight) {
       
  2628 			props.height = this.size.height + "px";
       
  2629 		}
       
  2630 		el.css(props);
       
  2631 
       
  2632 		if (!this._helper && this._proportionallyResizeElements.length) {
       
  2633 			this._proportionallyResize();
       
  2634 		}
       
  2635 
       
  2636 		// Call the user callback if the element was resized
       
  2637 		if ( ! $.isEmptyObject(props) ) {
       
  2638 			this._trigger("resize", event, this.ui());
       
  2639 		}
       
  2640 
       
  2641 		return false;
       
  2642 	},
       
  2643 
       
  2644 	_mouseStop: function(event) {
       
  2645 
       
  2646 		this.resizing = false;
       
  2647 		var pr, ista, soffseth, soffsetw, s, left, top,
       
  2648 			o = this.options, that = this;
       
  2649 
       
  2650 		if(this._helper) {
       
  2651 
       
  2652 			pr = this._proportionallyResizeElements;
       
  2653 			ista = pr.length && (/textarea/i).test(pr[0].nodeName);
       
  2654 			soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height;
       
  2655 			soffsetw = ista ? 0 : that.sizeDiff.width;
       
  2656 
       
  2657 			s = { width: (that.helper.width()  - soffsetw), height: (that.helper.height() - soffseth) };
       
  2658 			left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null;
       
  2659 			top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
       
  2660 
       
  2661 			if (!o.animate) {
       
  2662 				this.element.css($.extend(s, { top: top, left: left }));
       
  2663 			}
       
  2664 
       
  2665 			that.helper.height(that.size.height);
       
  2666 			that.helper.width(that.size.width);
       
  2667 
       
  2668 			if (this._helper && !o.animate) {
       
  2669 				this._proportionallyResize();
       
  2670 			}
       
  2671 		}
       
  2672 
       
  2673 		$("body").css("cursor", "auto");
       
  2674 
       
  2675 		this.element.removeClass("ui-resizable-resizing");
       
  2676 
       
  2677 		this._propagate("stop", event);
       
  2678 
       
  2679 		if (this._helper) {
       
  2680 			this.helper.remove();
       
  2681 		}
       
  2682 
       
  2683 		return false;
       
  2684 
       
  2685 	},
       
  2686 
       
  2687 	_updateVirtualBoundaries: function(forceAspectRatio) {
       
  2688 		var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
       
  2689 			o = this.options;
       
  2690 
       
  2691 		b = {
       
  2692 			minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
       
  2693 			maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
       
  2694 			minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
       
  2695 			maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
       
  2696 		};
       
  2697 
       
  2698 		if(this._aspectRatio || forceAspectRatio) {
       
  2699 			// We want to create an enclosing box whose aspect ration is the requested one
       
  2700 			// First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
       
  2701 			pMinWidth = b.minHeight * this.aspectRatio;
       
  2702 			pMinHeight = b.minWidth / this.aspectRatio;
       
  2703 			pMaxWidth = b.maxHeight * this.aspectRatio;
       
  2704 			pMaxHeight = b.maxWidth / this.aspectRatio;
       
  2705 
       
  2706 			if(pMinWidth > b.minWidth) {
       
  2707 				b.minWidth = pMinWidth;
       
  2708 			}
       
  2709 			if(pMinHeight > b.minHeight) {
       
  2710 				b.minHeight = pMinHeight;
       
  2711 			}
       
  2712 			if(pMaxWidth < b.maxWidth) {
       
  2713 				b.maxWidth = pMaxWidth;
       
  2714 			}
       
  2715 			if(pMaxHeight < b.maxHeight) {
       
  2716 				b.maxHeight = pMaxHeight;
       
  2717 			}
       
  2718 		}
       
  2719 		this._vBoundaries = b;
       
  2720 	},
       
  2721 
       
  2722 	_updateCache: function(data) {
       
  2723 		this.offset = this.helper.offset();
       
  2724 		if (isNumber(data.left)) {
       
  2725 			this.position.left = data.left;
       
  2726 		}
       
  2727 		if (isNumber(data.top)) {
       
  2728 			this.position.top = data.top;
       
  2729 		}
       
  2730 		if (isNumber(data.height)) {
       
  2731 			this.size.height = data.height;
       
  2732 		}
       
  2733 		if (isNumber(data.width)) {
       
  2734 			this.size.width = data.width;
       
  2735 		}
       
  2736 	},
       
  2737 
       
  2738 	_updateRatio: function( data ) {
       
  2739 
       
  2740 		var cpos = this.position,
       
  2741 			csize = this.size,
       
  2742 			a = this.axis;
       
  2743 
       
  2744 		if (isNumber(data.height)) {
       
  2745 			data.width = (data.height * this.aspectRatio);
       
  2746 		} else if (isNumber(data.width)) {
       
  2747 			data.height = (data.width / this.aspectRatio);
       
  2748 		}
       
  2749 
       
  2750 		if (a === "sw") {
       
  2751 			data.left = cpos.left + (csize.width - data.width);
       
  2752 			data.top = null;
       
  2753 		}
       
  2754 		if (a === "nw") {
       
  2755 			data.top = cpos.top + (csize.height - data.height);
       
  2756 			data.left = cpos.left + (csize.width - data.width);
       
  2757 		}
       
  2758 
       
  2759 		return data;
       
  2760 	},
       
  2761 
       
  2762 	_respectSize: function( data ) {
       
  2763 
       
  2764 		var o = this._vBoundaries,
       
  2765 			a = this.axis,
       
  2766 			ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
       
  2767 			isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
       
  2768 			dw = this.originalPosition.left + this.originalSize.width,
       
  2769 			dh = this.position.top + this.size.height,
       
  2770 			cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
       
  2771 		if (isminw) {
       
  2772 			data.width = o.minWidth;
       
  2773 		}
       
  2774 		if (isminh) {
       
  2775 			data.height = o.minHeight;
       
  2776 		}
       
  2777 		if (ismaxw) {
       
  2778 			data.width = o.maxWidth;
       
  2779 		}
       
  2780 		if (ismaxh) {
       
  2781 			data.height = o.maxHeight;
       
  2782 		}
       
  2783 
       
  2784 		if (isminw && cw) {
       
  2785 			data.left = dw - o.minWidth;
       
  2786 		}
       
  2787 		if (ismaxw && cw) {
       
  2788 			data.left = dw - o.maxWidth;
       
  2789 		}
       
  2790 		if (isminh && ch) {
       
  2791 			data.top = dh - o.minHeight;
       
  2792 		}
       
  2793 		if (ismaxh && ch) {
       
  2794 			data.top = dh - o.maxHeight;
       
  2795 		}
       
  2796 
       
  2797 		// fixing jump error on top/left - bug #2330
       
  2798 		if (!data.width && !data.height && !data.left && data.top) {
       
  2799 			data.top = null;
       
  2800 		} else if (!data.width && !data.height && !data.top && data.left) {
       
  2801 			data.left = null;
       
  2802 		}
       
  2803 
       
  2804 		return data;
       
  2805 	},
       
  2806 
       
  2807 	_proportionallyResize: function() {
       
  2808 
       
  2809 		if (!this._proportionallyResizeElements.length) {
       
  2810 			return;
       
  2811 		}
       
  2812 
       
  2813 		var i, j, borders, paddings, prel,
       
  2814 			element = this.helper || this.element;
       
  2815 
       
  2816 		for ( i=0; i < this._proportionallyResizeElements.length; i++) {
       
  2817 
       
  2818 			prel = this._proportionallyResizeElements[i];
       
  2819 
       
  2820 			if (!this.borderDif) {
       
  2821 				this.borderDif = [];
       
  2822 				borders = [prel.css("borderTopWidth"), prel.css("borderRightWidth"), prel.css("borderBottomWidth"), prel.css("borderLeftWidth")];
       
  2823 				paddings = [prel.css("paddingTop"), prel.css("paddingRight"), prel.css("paddingBottom"), prel.css("paddingLeft")];
       
  2824 
       
  2825 				for ( j = 0; j < borders.length; j++ ) {
       
  2826 					this.borderDif[ j ] = ( parseInt( borders[ j ], 10 ) || 0 ) + ( parseInt( paddings[ j ], 10 ) || 0 );
       
  2827 				}
       
  2828 			}
       
  2829 
       
  2830 			prel.css({
       
  2831 				height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
       
  2832 				width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
       
  2833 			});
       
  2834 
       
  2835 		}
       
  2836 
       
  2837 	},
       
  2838 
       
  2839 	_renderProxy: function() {
       
  2840 
       
  2841 		var el = this.element, o = this.options;
       
  2842 		this.elementOffset = el.offset();
       
  2843 
       
  2844 		if(this._helper) {
       
  2845 
       
  2846 			this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
       
  2847 
       
  2848 			this.helper.addClass(this._helper).css({
       
  2849 				width: this.element.outerWidth() - 1,
       
  2850 				height: this.element.outerHeight() - 1,
       
  2851 				position: "absolute",
       
  2852 				left: this.elementOffset.left +"px",
       
  2853 				top: this.elementOffset.top +"px",
       
  2854 				zIndex: ++o.zIndex //TODO: Don't modify option
       
  2855 			});
       
  2856 
       
  2857 			this.helper
       
  2858 				.appendTo("body")
       
  2859 				.disableSelection();
       
  2860 
       
  2861 		} else {
       
  2862 			this.helper = this.element;
       
  2863 		}
       
  2864 
       
  2865 	},
       
  2866 
       
  2867 	_change: {
       
  2868 		e: function(event, dx) {
       
  2869 			return { width: this.originalSize.width + dx };
       
  2870 		},
       
  2871 		w: function(event, dx) {
       
  2872 			var cs = this.originalSize, sp = this.originalPosition;
       
  2873 			return { left: sp.left + dx, width: cs.width - dx };
       
  2874 		},
       
  2875 		n: function(event, dx, dy) {
       
  2876 			var cs = this.originalSize, sp = this.originalPosition;
       
  2877 			return { top: sp.top + dy, height: cs.height - dy };
       
  2878 		},
       
  2879 		s: function(event, dx, dy) {
       
  2880 			return { height: this.originalSize.height + dy };
       
  2881 		},
       
  2882 		se: function(event, dx, dy) {
       
  2883 			return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
       
  2884 		},
       
  2885 		sw: function(event, dx, dy) {
       
  2886 			return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
       
  2887 		},
       
  2888 		ne: function(event, dx, dy) {
       
  2889 			return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
       
  2890 		},
       
  2891 		nw: function(event, dx, dy) {
       
  2892 			return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
       
  2893 		}
       
  2894 	},
       
  2895 
       
  2896 	_propagate: function(n, event) {
       
  2897 		$.ui.plugin.call(this, n, [event, this.ui()]);
       
  2898 		(n !== "resize" && this._trigger(n, event, this.ui()));
       
  2899 	},
       
  2900 
       
  2901 	plugins: {},
       
  2902 
       
  2903 	ui: function() {
       
  2904 		return {
       
  2905 			originalElement: this.originalElement,
       
  2906 			element: this.element,
       
  2907 			helper: this.helper,
       
  2908 			position: this.position,
       
  2909 			size: this.size,
       
  2910 			originalSize: this.originalSize,
       
  2911 			originalPosition: this.originalPosition
       
  2912 		};
       
  2913 	}
       
  2914 
       
  2915 });
       
  2916 
       
  2917 /*
       
  2918  * Resizable Extensions
       
  2919  */
       
  2920 
       
  2921 $.ui.plugin.add("resizable", "animate", {
       
  2922 
       
  2923 	stop: function( event ) {
       
  2924 		var that = $(this).data("ui-resizable"),
       
  2925 			o = that.options,
       
  2926 			pr = that._proportionallyResizeElements,
       
  2927 			ista = pr.length && (/textarea/i).test(pr[0].nodeName),
       
  2928 			soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height,
       
  2929 			soffsetw = ista ? 0 : that.sizeDiff.width,
       
  2930 			style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
       
  2931 			left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null,
       
  2932 			top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
       
  2933 
       
  2934 		that.element.animate(
       
  2935 			$.extend(style, top && left ? { top: top, left: left } : {}), {
       
  2936 				duration: o.animateDuration,
       
  2937 				easing: o.animateEasing,
       
  2938 				step: function() {
       
  2939 
       
  2940 					var data = {
       
  2941 						width: parseInt(that.element.css("width"), 10),
       
  2942 						height: parseInt(that.element.css("height"), 10),
       
  2943 						top: parseInt(that.element.css("top"), 10),
       
  2944 						left: parseInt(that.element.css("left"), 10)
       
  2945 					};
       
  2946 
       
  2947 					if (pr && pr.length) {
       
  2948 						$(pr[0]).css({ width: data.width, height: data.height });
       
  2949 					}
       
  2950 
       
  2951 					// propagating resize, and updating values for each animation step
       
  2952 					that._updateCache(data);
       
  2953 					that._propagate("resize", event);
       
  2954 
       
  2955 				}
       
  2956 			}
       
  2957 		);
       
  2958 	}
       
  2959 
       
  2960 });
       
  2961 
       
  2962 $.ui.plugin.add("resizable", "containment", {
       
  2963 
       
  2964 	start: function() {
       
  2965 		var element, p, co, ch, cw, width, height,
       
  2966 			that = $(this).data("ui-resizable"),
       
  2967 			o = that.options,
       
  2968 			el = that.element,
       
  2969 			oc = o.containment,
       
  2970 			ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
       
  2971 
       
  2972 		if (!ce) {
       
  2973 			return;
       
  2974 		}
       
  2975 
       
  2976 		that.containerElement = $(ce);
       
  2977 
       
  2978 		if (/document/.test(oc) || oc === document) {
       
  2979 			that.containerOffset = { left: 0, top: 0 };
       
  2980 			that.containerPosition = { left: 0, top: 0 };
       
  2981 
       
  2982 			that.parentData = {
       
  2983 				element: $(document), left: 0, top: 0,
       
  2984 				width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
       
  2985 			};
       
  2986 		}
       
  2987 
       
  2988 		// i'm a node, so compute top, left, right, bottom
       
  2989 		else {
       
  2990 			element = $(ce);
       
  2991 			p = [];
       
  2992 			$([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
       
  2993 
       
  2994 			that.containerOffset = element.offset();
       
  2995 			that.containerPosition = element.position();
       
  2996 			that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
       
  2997 
       
  2998 			co = that.containerOffset;
       
  2999 			ch = that.containerSize.height;
       
  3000 			cw = that.containerSize.width;
       
  3001 			width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw );
       
  3002 			height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
       
  3003 
       
  3004 			that.parentData = {
       
  3005 				element: ce, left: co.left, top: co.top, width: width, height: height
       
  3006 			};
       
  3007 		}
       
  3008 	},
       
  3009 
       
  3010 	resize: function( event ) {
       
  3011 		var woset, hoset, isParent, isOffsetRelative,
       
  3012 			that = $(this).data("ui-resizable"),
       
  3013 			o = that.options,
       
  3014 			co = that.containerOffset, cp = that.position,
       
  3015 			pRatio = that._aspectRatio || event.shiftKey,
       
  3016 			cop = { top:0, left:0 }, ce = that.containerElement;
       
  3017 
       
  3018 		if (ce[0] !== document && (/static/).test(ce.css("position"))) {
       
  3019 			cop = co;
       
  3020 		}
       
  3021 
       
  3022 		if (cp.left < (that._helper ? co.left : 0)) {
       
  3023 			that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left));
       
  3024 			if (pRatio) {
       
  3025 				that.size.height = that.size.width / that.aspectRatio;
       
  3026 			}
       
  3027 			that.position.left = o.helper ? co.left : 0;
       
  3028 		}
       
  3029 
       
  3030 		if (cp.top < (that._helper ? co.top : 0)) {
       
  3031 			that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top);
       
  3032 			if (pRatio) {
       
  3033 				that.size.width = that.size.height * that.aspectRatio;
       
  3034 			}
       
  3035 			that.position.top = that._helper ? co.top : 0;
       
  3036 		}
       
  3037 
       
  3038 		that.offset.left = that.parentData.left+that.position.left;
       
  3039 		that.offset.top = that.parentData.top+that.position.top;
       
  3040 
       
  3041 		woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width );
       
  3042 		hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height );
       
  3043 
       
  3044 		isParent = that.containerElement.get(0) === that.element.parent().get(0);
       
  3045 		isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position"));
       
  3046 
       
  3047 		if(isParent && isOffsetRelative) {
       
  3048 			woset -= that.parentData.left;
       
  3049 		}
       
  3050 
       
  3051 		if (woset + that.size.width >= that.parentData.width) {
       
  3052 			that.size.width = that.parentData.width - woset;
       
  3053 			if (pRatio) {
       
  3054 				that.size.height = that.size.width / that.aspectRatio;
       
  3055 			}
       
  3056 		}
       
  3057 
       
  3058 		if (hoset + that.size.height >= that.parentData.height) {
       
  3059 			that.size.height = that.parentData.height - hoset;
       
  3060 			if (pRatio) {
       
  3061 				that.size.width = that.size.height * that.aspectRatio;
       
  3062 			}
       
  3063 		}
       
  3064 	},
       
  3065 
       
  3066 	stop: function(){
       
  3067 		var that = $(this).data("ui-resizable"),
       
  3068 			o = that.options,
       
  3069 			co = that.containerOffset,
       
  3070 			cop = that.containerPosition,
       
  3071 			ce = that.containerElement,
       
  3072 			helper = $(that.helper),
       
  3073 			ho = helper.offset(),
       
  3074 			w = helper.outerWidth() - that.sizeDiff.width,
       
  3075 			h = helper.outerHeight() - that.sizeDiff.height;
       
  3076 
       
  3077 		if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) {
       
  3078 			$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
       
  3079 		}
       
  3080 
       
  3081 		if (that._helper && !o.animate && (/static/).test(ce.css("position"))) {
       
  3082 			$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
       
  3083 		}
       
  3084 
       
  3085 	}
       
  3086 });
       
  3087 
       
  3088 $.ui.plugin.add("resizable", "alsoResize", {
       
  3089 
       
  3090 	start: function () {
       
  3091 		var that = $(this).data("ui-resizable"),
       
  3092 			o = that.options,
       
  3093 			_store = function (exp) {
       
  3094 				$(exp).each(function() {
       
  3095 					var el = $(this);
       
  3096 					el.data("ui-resizable-alsoresize", {
       
  3097 						width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
       
  3098 						left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
       
  3099 					});
       
  3100 				});
       
  3101 			};
       
  3102 
       
  3103 		if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) {
       
  3104 			if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
       
  3105 			else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
       
  3106 		}else{
       
  3107 			_store(o.alsoResize);
       
  3108 		}
       
  3109 	},
       
  3110 
       
  3111 	resize: function (event, ui) {
       
  3112 		var that = $(this).data("ui-resizable"),
       
  3113 			o = that.options,
       
  3114 			os = that.originalSize,
       
  3115 			op = that.originalPosition,
       
  3116 			delta = {
       
  3117 				height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0,
       
  3118 				top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0
       
  3119 			},
       
  3120 
       
  3121 			_alsoResize = function (exp, c) {
       
  3122 				$(exp).each(function() {
       
  3123 					var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
       
  3124 						css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"];
       
  3125 
       
  3126 					$.each(css, function (i, prop) {
       
  3127 						var sum = (start[prop]||0) + (delta[prop]||0);
       
  3128 						if (sum && sum >= 0) {
       
  3129 							style[prop] = sum || null;
       
  3130 						}
       
  3131 					});
       
  3132 
       
  3133 					el.css(style);
       
  3134 				});
       
  3135 			};
       
  3136 
       
  3137 		if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) {
       
  3138 			$.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
       
  3139 		}else{
       
  3140 			_alsoResize(o.alsoResize);
       
  3141 		}
       
  3142 	},
       
  3143 
       
  3144 	stop: function () {
       
  3145 		$(this).removeData("resizable-alsoresize");
       
  3146 	}
       
  3147 });
       
  3148 
       
  3149 $.ui.plugin.add("resizable", "ghost", {
       
  3150 
       
  3151 	start: function() {
       
  3152 
       
  3153 		var that = $(this).data("ui-resizable"), o = that.options, cs = that.size;
       
  3154 
       
  3155 		that.ghost = that.originalElement.clone();
       
  3156 		that.ghost
       
  3157 			.css({ opacity: 0.25, display: "block", position: "relative", height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
       
  3158 			.addClass("ui-resizable-ghost")
       
  3159 			.addClass(typeof o.ghost === "string" ? o.ghost : "");
       
  3160 
       
  3161 		that.ghost.appendTo(that.helper);
       
  3162 
       
  3163 	},
       
  3164 
       
  3165 	resize: function(){
       
  3166 		var that = $(this).data("ui-resizable");
       
  3167 		if (that.ghost) {
       
  3168 			that.ghost.css({ position: "relative", height: that.size.height, width: that.size.width });
       
  3169 		}
       
  3170 	},
       
  3171 
       
  3172 	stop: function() {
       
  3173 		var that = $(this).data("ui-resizable");
       
  3174 		if (that.ghost && that.helper) {
       
  3175 			that.helper.get(0).removeChild(that.ghost.get(0));
       
  3176 		}
       
  3177 	}
       
  3178 
       
  3179 });
       
  3180 
       
  3181 $.ui.plugin.add("resizable", "grid", {
       
  3182 
       
  3183 	resize: function() {
       
  3184 		var that = $(this).data("ui-resizable"),
       
  3185 			o = that.options,
       
  3186 			cs = that.size,
       
  3187 			os = that.originalSize,
       
  3188 			op = that.originalPosition,
       
  3189 			a = that.axis,
       
  3190 			grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid,
       
  3191 			gridX = (grid[0]||1),
       
  3192 			gridY = (grid[1]||1),
       
  3193 			ox = Math.round((cs.width - os.width) / gridX) * gridX,
       
  3194 			oy = Math.round((cs.height - os.height) / gridY) * gridY,
       
  3195 			newWidth = os.width + ox,
       
  3196 			newHeight = os.height + oy,
       
  3197 			isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
       
  3198 			isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
       
  3199 			isMinWidth = o.minWidth && (o.minWidth > newWidth),
       
  3200 			isMinHeight = o.minHeight && (o.minHeight > newHeight);
       
  3201 
       
  3202 		o.grid = grid;
       
  3203 
       
  3204 		if (isMinWidth) {
       
  3205 			newWidth = newWidth + gridX;
       
  3206 		}
       
  3207 		if (isMinHeight) {
       
  3208 			newHeight = newHeight + gridY;
       
  3209 		}
       
  3210 		if (isMaxWidth) {
       
  3211 			newWidth = newWidth - gridX;
       
  3212 		}
       
  3213 		if (isMaxHeight) {
       
  3214 			newHeight = newHeight - gridY;
       
  3215 		}
       
  3216 
       
  3217 		if (/^(se|s|e)$/.test(a)) {
       
  3218 			that.size.width = newWidth;
       
  3219 			that.size.height = newHeight;
       
  3220 		} else if (/^(ne)$/.test(a)) {
       
  3221 			that.size.width = newWidth;
       
  3222 			that.size.height = newHeight;
       
  3223 			that.position.top = op.top - oy;
       
  3224 		} else if (/^(sw)$/.test(a)) {
       
  3225 			that.size.width = newWidth;
       
  3226 			that.size.height = newHeight;
       
  3227 			that.position.left = op.left - ox;
       
  3228 		} else {
       
  3229 			that.size.width = newWidth;
       
  3230 			that.size.height = newHeight;
       
  3231 			that.position.top = op.top - oy;
       
  3232 			that.position.left = op.left - ox;
       
  3233 		}
       
  3234 	}
       
  3235 
       
  3236 });
       
  3237 
       
  3238 })(jQuery);
       
  3239 
       
  3240 (function( $, undefined ) {
       
  3241 
       
  3242 $.widget("ui.selectable", $.ui.mouse, {
       
  3243 	version: "1.10.3",
       
  3244 	options: {
       
  3245 		appendTo: "body",
       
  3246 		autoRefresh: true,
       
  3247 		distance: 0,
       
  3248 		filter: "*",
       
  3249 		tolerance: "touch",
       
  3250 
       
  3251 		// callbacks
       
  3252 		selected: null,
       
  3253 		selecting: null,
       
  3254 		start: null,
       
  3255 		stop: null,
       
  3256 		unselected: null,
       
  3257 		unselecting: null
       
  3258 	},
       
  3259 	_create: function() {
       
  3260 		var selectees,
       
  3261 			that = this;
       
  3262 
       
  3263 		this.element.addClass("ui-selectable");
       
  3264 
       
  3265 		this.dragged = false;
       
  3266 
       
  3267 		// cache selectee children based on filter
       
  3268 		this.refresh = function() {
       
  3269 			selectees = $(that.options.filter, that.element[0]);
       
  3270 			selectees.addClass("ui-selectee");
       
  3271 			selectees.each(function() {
       
  3272 				var $this = $(this),
       
  3273 					pos = $this.offset();
       
  3274 				$.data(this, "selectable-item", {
       
  3275 					element: this,
       
  3276 					$element: $this,
       
  3277 					left: pos.left,
       
  3278 					top: pos.top,
       
  3279 					right: pos.left + $this.outerWidth(),
       
  3280 					bottom: pos.top + $this.outerHeight(),
       
  3281 					startselected: false,
       
  3282 					selected: $this.hasClass("ui-selected"),
       
  3283 					selecting: $this.hasClass("ui-selecting"),
       
  3284 					unselecting: $this.hasClass("ui-unselecting")
       
  3285 				});
       
  3286 			});
       
  3287 		};
       
  3288 		this.refresh();
       
  3289 
       
  3290 		this.selectees = selectees.addClass("ui-selectee");
       
  3291 
       
  3292 		this._mouseInit();
       
  3293 
       
  3294 		this.helper = $("<div class='ui-selectable-helper'></div>");
       
  3295 	},
       
  3296 
       
  3297 	_destroy: function() {
       
  3298 		this.selectees
       
  3299 			.removeClass("ui-selectee")
       
  3300 			.removeData("selectable-item");
       
  3301 		this.element
       
  3302 			.removeClass("ui-selectable ui-selectable-disabled");
       
  3303 		this._mouseDestroy();
       
  3304 	},
       
  3305 
       
  3306 	_mouseStart: function(event) {
       
  3307 		var that = this,
       
  3308 			options = this.options;
       
  3309 
       
  3310 		this.opos = [event.pageX, event.pageY];
       
  3311 
       
  3312 		if (this.options.disabled) {
       
  3313 			return;
       
  3314 		}
       
  3315 
       
  3316 		this.selectees = $(options.filter, this.element[0]);
       
  3317 
       
  3318 		this._trigger("start", event);
       
  3319 
       
  3320 		$(options.appendTo).append(this.helper);
       
  3321 		// position helper (lasso)
       
  3322 		this.helper.css({
       
  3323 			"left": event.pageX,
       
  3324 			"top": event.pageY,
       
  3325 			"width": 0,
       
  3326 			"height": 0
       
  3327 		});
       
  3328 
       
  3329 		if (options.autoRefresh) {
       
  3330 			this.refresh();
       
  3331 		}
       
  3332 
       
  3333 		this.selectees.filter(".ui-selected").each(function() {
       
  3334 			var selectee = $.data(this, "selectable-item");
       
  3335 			selectee.startselected = true;
       
  3336 			if (!event.metaKey && !event.ctrlKey) {
       
  3337 				selectee.$element.removeClass("ui-selected");
       
  3338 				selectee.selected = false;
       
  3339 				selectee.$element.addClass("ui-unselecting");
       
  3340 				selectee.unselecting = true;
       
  3341 				// selectable UNSELECTING callback
       
  3342 				that._trigger("unselecting", event, {
       
  3343 					unselecting: selectee.element
       
  3344 				});
       
  3345 			}
       
  3346 		});
       
  3347 
       
  3348 		$(event.target).parents().addBack().each(function() {
       
  3349 			var doSelect,
       
  3350 				selectee = $.data(this, "selectable-item");
       
  3351 			if (selectee) {
       
  3352 				doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected");
       
  3353 				selectee.$element
       
  3354 					.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
       
  3355 					.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
       
  3356 				selectee.unselecting = !doSelect;
       
  3357 				selectee.selecting = doSelect;
       
  3358 				selectee.selected = doSelect;
       
  3359 				// selectable (UN)SELECTING callback
       
  3360 				if (doSelect) {
       
  3361 					that._trigger("selecting", event, {
       
  3362 						selecting: selectee.element
       
  3363 					});
       
  3364 				} else {
       
  3365 					that._trigger("unselecting", event, {
       
  3366 						unselecting: selectee.element
       
  3367 					});
       
  3368 				}
       
  3369 				return false;
       
  3370 			}
       
  3371 		});
       
  3372 
       
  3373 	},
       
  3374 
       
  3375 	_mouseDrag: function(event) {
       
  3376 
       
  3377 		this.dragged = true;
       
  3378 
       
  3379 		if (this.options.disabled) {
       
  3380 			return;
       
  3381 		}
       
  3382 
       
  3383 		var tmp,
       
  3384 			that = this,
       
  3385 			options = this.options,
       
  3386 			x1 = this.opos[0],
       
  3387 			y1 = this.opos[1],
       
  3388 			x2 = event.pageX,
       
  3389 			y2 = event.pageY;
       
  3390 
       
  3391 		if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; }
       
  3392 		if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; }
       
  3393 		this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
       
  3394 
       
  3395 		this.selectees.each(function() {
       
  3396 			var selectee = $.data(this, "selectable-item"),
       
  3397 				hit = false;
       
  3398 
       
  3399 			//prevent helper from being selected if appendTo: selectable
       
  3400 			if (!selectee || selectee.element === that.element[0]) {
       
  3401 				return;
       
  3402 			}
       
  3403 
       
  3404 			if (options.tolerance === "touch") {
       
  3405 				hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
       
  3406 			} else if (options.tolerance === "fit") {
       
  3407 				hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
       
  3408 			}
       
  3409 
       
  3410 			if (hit) {
       
  3411 				// SELECT
       
  3412 				if (selectee.selected) {
       
  3413 					selectee.$element.removeClass("ui-selected");
       
  3414 					selectee.selected = false;
       
  3415 				}
       
  3416 				if (selectee.unselecting) {
       
  3417 					selectee.$element.removeClass("ui-unselecting");
       
  3418 					selectee.unselecting = false;
       
  3419 				}
       
  3420 				if (!selectee.selecting) {
       
  3421 					selectee.$element.addClass("ui-selecting");
       
  3422 					selectee.selecting = true;
       
  3423 					// selectable SELECTING callback
       
  3424 					that._trigger("selecting", event, {
       
  3425 						selecting: selectee.element
       
  3426 					});
       
  3427 				}
       
  3428 			} else {
       
  3429 				// UNSELECT
       
  3430 				if (selectee.selecting) {
       
  3431 					if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
       
  3432 						selectee.$element.removeClass("ui-selecting");
       
  3433 						selectee.selecting = false;
       
  3434 						selectee.$element.addClass("ui-selected");
       
  3435 						selectee.selected = true;
       
  3436 					} else {
       
  3437 						selectee.$element.removeClass("ui-selecting");
       
  3438 						selectee.selecting = false;
       
  3439 						if (selectee.startselected) {
       
  3440 							selectee.$element.addClass("ui-unselecting");
       
  3441 							selectee.unselecting = true;
       
  3442 						}
       
  3443 						// selectable UNSELECTING callback
       
  3444 						that._trigger("unselecting", event, {
       
  3445 							unselecting: selectee.element
       
  3446 						});
       
  3447 					}
       
  3448 				}
       
  3449 				if (selectee.selected) {
       
  3450 					if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
       
  3451 						selectee.$element.removeClass("ui-selected");
       
  3452 						selectee.selected = false;
       
  3453 
       
  3454 						selectee.$element.addClass("ui-unselecting");
       
  3455 						selectee.unselecting = true;
       
  3456 						// selectable UNSELECTING callback
       
  3457 						that._trigger("unselecting", event, {
       
  3458 							unselecting: selectee.element
       
  3459 						});
       
  3460 					}
       
  3461 				}
       
  3462 			}
       
  3463 		});
       
  3464 
       
  3465 		return false;
       
  3466 	},
       
  3467 
       
  3468 	_mouseStop: function(event) {
       
  3469 		var that = this;
       
  3470 
       
  3471 		this.dragged = false;
       
  3472 
       
  3473 		$(".ui-unselecting", this.element[0]).each(function() {
       
  3474 			var selectee = $.data(this, "selectable-item");
       
  3475 			selectee.$element.removeClass("ui-unselecting");
       
  3476 			selectee.unselecting = false;
       
  3477 			selectee.startselected = false;
       
  3478 			that._trigger("unselected", event, {
       
  3479 				unselected: selectee.element
       
  3480 			});
       
  3481 		});
       
  3482 		$(".ui-selecting", this.element[0]).each(function() {
       
  3483 			var selectee = $.data(this, "selectable-item");
       
  3484 			selectee.$element.removeClass("ui-selecting").addClass("ui-selected");
       
  3485 			selectee.selecting = false;
       
  3486 			selectee.selected = true;
       
  3487 			selectee.startselected = true;
       
  3488 			that._trigger("selected", event, {
       
  3489 				selected: selectee.element
       
  3490 			});
       
  3491 		});
       
  3492 		this._trigger("stop", event);
       
  3493 
       
  3494 		this.helper.remove();
       
  3495 
       
  3496 		return false;
       
  3497 	}
       
  3498 
       
  3499 });
       
  3500 
       
  3501 })(jQuery);
       
  3502 
       
  3503 (function( $, undefined ) {
       
  3504 
       
  3505 /*jshint loopfunc: true */
       
  3506 
       
  3507 function isOverAxis( x, reference, size ) {
       
  3508 	return ( x > reference ) && ( x < ( reference + size ) );
       
  3509 }
       
  3510 
       
  3511 function isFloating(item) {
       
  3512 	return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
       
  3513 }
       
  3514 
       
  3515 $.widget("ui.sortable", $.ui.mouse, {
       
  3516 	version: "1.10.3",
       
  3517 	widgetEventPrefix: "sort",
       
  3518 	ready: false,
       
  3519 	options: {
       
  3520 		appendTo: "parent",
       
  3521 		axis: false,
       
  3522 		connectWith: false,
       
  3523 		containment: false,
       
  3524 		cursor: "auto",
       
  3525 		cursorAt: false,
       
  3526 		dropOnEmpty: true,
       
  3527 		forcePlaceholderSize: false,
       
  3528 		forceHelperSize: false,
       
  3529 		grid: false,
       
  3530 		handle: false,
       
  3531 		helper: "original",
       
  3532 		items: "> *",
       
  3533 		opacity: false,
       
  3534 		placeholder: false,
       
  3535 		revert: false,
       
  3536 		scroll: true,
       
  3537 		scrollSensitivity: 20,
       
  3538 		scrollSpeed: 20,
       
  3539 		scope: "default",
       
  3540 		tolerance: "intersect",
       
  3541 		zIndex: 1000,
       
  3542 
       
  3543 		// callbacks
       
  3544 		activate: null,
       
  3545 		beforeStop: null,
       
  3546 		change: null,
       
  3547 		deactivate: null,
       
  3548 		out: null,
       
  3549 		over: null,
       
  3550 		receive: null,
       
  3551 		remove: null,
       
  3552 		sort: null,
       
  3553 		start: null,
       
  3554 		stop: null,
       
  3555 		update: null
       
  3556 	},
       
  3557 	_create: function() {
       
  3558 
       
  3559 		var o = this.options;
       
  3560 		this.containerCache = {};
       
  3561 		this.element.addClass("ui-sortable");
       
  3562 
       
  3563 		//Get the items
       
  3564 		this.refresh();
       
  3565 
       
  3566 		//Let's determine if the items are being displayed horizontally
       
  3567 		this.floating = this.items.length ? o.axis === "x" || isFloating(this.items[0].item) : false;
       
  3568 
       
  3569 		//Let's determine the parent's offset
       
  3570 		this.offset = this.element.offset();
       
  3571 
       
  3572 		//Initialize mouse events for interaction
       
  3573 		this._mouseInit();
       
  3574 
       
  3575 		//We're ready to go
       
  3576 		this.ready = true;
       
  3577 
       
  3578 	},
       
  3579 
       
  3580 	_destroy: function() {
       
  3581 		this.element
       
  3582 			.removeClass("ui-sortable ui-sortable-disabled");
       
  3583 		this._mouseDestroy();
       
  3584 
       
  3585 		for ( var i = this.items.length - 1; i >= 0; i-- ) {
       
  3586 			this.items[i].item.removeData(this.widgetName + "-item");
       
  3587 		}
       
  3588 
       
  3589 		return this;
       
  3590 	},
       
  3591 
       
  3592 	_setOption: function(key, value){
       
  3593 		if ( key === "disabled" ) {
       
  3594 			this.options[ key ] = value;
       
  3595 
       
  3596 			this.widget().toggleClass( "ui-sortable-disabled", !!value );
       
  3597 		} else {
       
  3598 			// Don't call widget base _setOption for disable as it adds ui-state-disabled class
       
  3599 			$.Widget.prototype._setOption.apply(this, arguments);
       
  3600 		}
       
  3601 	},
       
  3602 
       
  3603 	_mouseCapture: function(event, overrideHandle) {
       
  3604 		var currentItem = null,
       
  3605 			validHandle = false,
       
  3606 			that = this;
       
  3607 
       
  3608 		if (this.reverting) {
       
  3609 			return false;
       
  3610 		}
       
  3611 
       
  3612 		if(this.options.disabled || this.options.type === "static") {
       
  3613 			return false;
       
  3614 		}
       
  3615 
       
  3616 		//We have to refresh the items data once first
       
  3617 		this._refreshItems(event);
       
  3618 
       
  3619 		//Find out if the clicked node (or one of its parents) is a actual item in this.items
       
  3620 		$(event.target).parents().each(function() {
       
  3621 			if($.data(this, that.widgetName + "-item") === that) {
       
  3622 				currentItem = $(this);
       
  3623 				return false;
       
  3624 			}
       
  3625 		});
       
  3626 		if($.data(event.target, that.widgetName + "-item") === that) {
       
  3627 			currentItem = $(event.target);
       
  3628 		}
       
  3629 
       
  3630 		if(!currentItem) {
       
  3631 			return false;
       
  3632 		}
       
  3633 		if(this.options.handle && !overrideHandle) {
       
  3634 			$(this.options.handle, currentItem).find("*").addBack().each(function() {
       
  3635 				if(this === event.target) {
       
  3636 					validHandle = true;
       
  3637 				}
       
  3638 			});
       
  3639 			if(!validHandle) {
       
  3640 				return false;
       
  3641 			}
       
  3642 		}
       
  3643 
       
  3644 		this.currentItem = currentItem;
       
  3645 		this._removeCurrentsFromItems();
       
  3646 		return true;
       
  3647 
       
  3648 	},
       
  3649 
       
  3650 	_mouseStart: function(event, overrideHandle, noActivation) {
       
  3651 
       
  3652 		var i, body,
       
  3653 			o = this.options;
       
  3654 
       
  3655 		this.currentContainer = this;
       
  3656 
       
  3657 		//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
       
  3658 		this.refreshPositions();
       
  3659 
       
  3660 		//Create and append the visible helper
       
  3661 		this.helper = this._createHelper(event);
       
  3662 
       
  3663 		//Cache the helper size
       
  3664 		this._cacheHelperProportions();
       
  3665 
       
  3666 		/*
       
  3667 		 * - Position generation -
       
  3668 		 * This block generates everything position related - it's the core of draggables.
       
  3669 		 */
       
  3670 
       
  3671 		//Cache the margins of the original element
       
  3672 		this._cacheMargins();
       
  3673 
       
  3674 		//Get the next scrolling parent
       
  3675 		this.scrollParent = this.helper.scrollParent();
       
  3676 
       
  3677 		//The element's absolute position on the page minus margins
       
  3678 		this.offset = this.currentItem.offset();
       
  3679 		this.offset = {
       
  3680 			top: this.offset.top - this.margins.top,
       
  3681 			left: this.offset.left - this.margins.left
       
  3682 		};
       
  3683 
       
  3684 		$.extend(this.offset, {
       
  3685 			click: { //Where the click happened, relative to the element
       
  3686 				left: event.pageX - this.offset.left,
       
  3687 				top: event.pageY - this.offset.top
       
  3688 			},
       
  3689 			parent: this._getParentOffset(),
       
  3690 			relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
       
  3691 		});
       
  3692 
       
  3693 		// Only after we got the offset, we can change the helper's position to absolute
       
  3694 		// TODO: Still need to figure out a way to make relative sorting possible
       
  3695 		this.helper.css("position", "absolute");
       
  3696 		this.cssPosition = this.helper.css("position");
       
  3697 
       
  3698 		//Generate the original position
       
  3699 		this.originalPosition = this._generatePosition(event);
       
  3700 		this.originalPageX = event.pageX;
       
  3701 		this.originalPageY = event.pageY;
       
  3702 
       
  3703 		//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
       
  3704 		(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
       
  3705 
       
  3706 		//Cache the former DOM position
       
  3707 		this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
       
  3708 
       
  3709 		//If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
       
  3710 		if(this.helper[0] !== this.currentItem[0]) {
       
  3711 			this.currentItem.hide();
       
  3712 		}
       
  3713 
       
  3714 		//Create the placeholder
       
  3715 		this._createPlaceholder();
       
  3716 
       
  3717 		//Set a containment if given in the options
       
  3718 		if(o.containment) {
       
  3719 			this._setContainment();
       
  3720 		}
       
  3721 
       
  3722 		if( o.cursor && o.cursor !== "auto" ) { // cursor option
       
  3723 			body = this.document.find( "body" );
       
  3724 
       
  3725 			// support: IE
       
  3726 			this.storedCursor = body.css( "cursor" );
       
  3727 			body.css( "cursor", o.cursor );
       
  3728 
       
  3729 			this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
       
  3730 		}
       
  3731 
       
  3732 		if(o.opacity) { // opacity option
       
  3733 			if (this.helper.css("opacity")) {
       
  3734 				this._storedOpacity = this.helper.css("opacity");
       
  3735 			}
       
  3736 			this.helper.css("opacity", o.opacity);
       
  3737 		}
       
  3738 
       
  3739 		if(o.zIndex) { // zIndex option
       
  3740 			if (this.helper.css("zIndex")) {
       
  3741 				this._storedZIndex = this.helper.css("zIndex");
       
  3742 			}
       
  3743 			this.helper.css("zIndex", o.zIndex);
       
  3744 		}
       
  3745 
       
  3746 		//Prepare scrolling
       
  3747 		if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") {
       
  3748 			this.overflowOffset = this.scrollParent.offset();
       
  3749 		}
       
  3750 
       
  3751 		//Call callbacks
       
  3752 		this._trigger("start", event, this._uiHash());
       
  3753 
       
  3754 		//Recache the helper size
       
  3755 		if(!this._preserveHelperProportions) {
       
  3756 			this._cacheHelperProportions();
       
  3757 		}
       
  3758 
       
  3759 
       
  3760 		//Post "activate" events to possible containers
       
  3761 		if( !noActivation ) {
       
  3762 			for ( i = this.containers.length - 1; i >= 0; i-- ) {
       
  3763 				this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
       
  3764 			}
       
  3765 		}
       
  3766 
       
  3767 		//Prepare possible droppables
       
  3768 		if($.ui.ddmanager) {
       
  3769 			$.ui.ddmanager.current = this;
       
  3770 		}
       
  3771 
       
  3772 		if ($.ui.ddmanager && !o.dropBehaviour) {
       
  3773 			$.ui.ddmanager.prepareOffsets(this, event);
       
  3774 		}
       
  3775 
       
  3776 		this.dragging = true;
       
  3777 
       
  3778 		this.helper.addClass("ui-sortable-helper");
       
  3779 		this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
       
  3780 		return true;
       
  3781 
       
  3782 	},
       
  3783 
       
  3784 	_mouseDrag: function(event) {
       
  3785 		var i, item, itemElement, intersection,
       
  3786 			o = this.options,
       
  3787 			scrolled = false;
       
  3788 
       
  3789 		//Compute the helpers position
       
  3790 		this.position = this._generatePosition(event);
       
  3791 		this.positionAbs = this._convertPositionTo("absolute");
       
  3792 
       
  3793 		if (!this.lastPositionAbs) {
       
  3794 			this.lastPositionAbs = this.positionAbs;
       
  3795 		}
       
  3796 
       
  3797 		//Do scrolling
       
  3798 		if(this.options.scroll) {
       
  3799 			if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") {
       
  3800 
       
  3801 				if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
       
  3802 					this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
       
  3803 				} else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
       
  3804 					this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
       
  3805 				}
       
  3806 
       
  3807 				if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
       
  3808 					this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
       
  3809 				} else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
       
  3810 					this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
       
  3811 				}
       
  3812 
       
  3813 			} else {
       
  3814 
       
  3815 				if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
       
  3816 					scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
       
  3817 				} else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
       
  3818 					scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
       
  3819 				}
       
  3820 
       
  3821 				if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
       
  3822 					scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
       
  3823 				} else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
       
  3824 					scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
       
  3825 				}
       
  3826 
       
  3827 			}
       
  3828 
       
  3829 			if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
       
  3830 				$.ui.ddmanager.prepareOffsets(this, event);
       
  3831 			}
       
  3832 		}
       
  3833 
       
  3834 		//Regenerate the absolute position used for position checks
       
  3835 		this.positionAbs = this._convertPositionTo("absolute");
       
  3836 
       
  3837 		//Set the helper position
       
  3838 		if(!this.options.axis || this.options.axis !== "y") {
       
  3839 			this.helper[0].style.left = this.position.left+"px";
       
  3840 		}
       
  3841 		if(!this.options.axis || this.options.axis !== "x") {
       
  3842 			this.helper[0].style.top = this.position.top+"px";
       
  3843 		}
       
  3844 
       
  3845 		//Rearrange
       
  3846 		for (i = this.items.length - 1; i >= 0; i--) {
       
  3847 
       
  3848 			//Cache variables and intersection, continue if no intersection
       
  3849 			item = this.items[i];
       
  3850 			itemElement = item.item[0];
       
  3851 			intersection = this._intersectsWithPointer(item);
       
  3852 			if (!intersection) {
       
  3853 				continue;
       
  3854 			}
       
  3855 
       
  3856 			// Only put the placeholder inside the current Container, skip all
       
  3857 			// items form other containers. This works because when moving
       
  3858 			// an item from one container to another the
       
  3859 			// currentContainer is switched before the placeholder is moved.
       
  3860 			//
       
  3861 			// Without this moving items in "sub-sortables" can cause the placeholder to jitter
       
  3862 			// beetween the outer and inner container.
       
  3863 			if (item.instance !== this.currentContainer) {
       
  3864 				continue;
       
  3865 			}
       
  3866 
       
  3867 			// cannot intersect with itself
       
  3868 			// no useless actions that have been done before
       
  3869 			// no action if the item moved is the parent of the item checked
       
  3870 			if (itemElement !== this.currentItem[0] &&
       
  3871 				this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
       
  3872 				!$.contains(this.placeholder[0], itemElement) &&
       
  3873 				(this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
       
  3874 			) {
       
  3875 
       
  3876 				this.direction = intersection === 1 ? "down" : "up";
       
  3877 
       
  3878 				if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
       
  3879 					this._rearrange(event, item);
       
  3880 				} else {
       
  3881 					break;
       
  3882 				}
       
  3883 
       
  3884 				this._trigger("change", event, this._uiHash());
       
  3885 				break;
       
  3886 			}
       
  3887 		}
       
  3888 
       
  3889 		//Post events to containers
       
  3890 		this._contactContainers(event);
       
  3891 
       
  3892 		//Interconnect with droppables
       
  3893 		if($.ui.ddmanager) {
       
  3894 			$.ui.ddmanager.drag(this, event);
       
  3895 		}
       
  3896 
       
  3897 		//Call callbacks
       
  3898 		this._trigger("sort", event, this._uiHash());
       
  3899 
       
  3900 		this.lastPositionAbs = this.positionAbs;
       
  3901 		return false;
       
  3902 
       
  3903 	},
       
  3904 
       
  3905 	_mouseStop: function(event, noPropagation) {
       
  3906 
       
  3907 		if(!event) {
       
  3908 			return;
       
  3909 		}
       
  3910 
       
  3911 		//If we are using droppables, inform the manager about the drop
       
  3912 		if ($.ui.ddmanager && !this.options.dropBehaviour) {
       
  3913 			$.ui.ddmanager.drop(this, event);
       
  3914 		}
       
  3915 
       
  3916 		if(this.options.revert) {
       
  3917 			var that = this,
       
  3918 				cur = this.placeholder.offset(),
       
  3919 				axis = this.options.axis,
       
  3920 				animation = {};
       
  3921 
       
  3922 			if ( !axis || axis === "x" ) {
       
  3923 				animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollLeft);
       
  3924 			}
       
  3925 			if ( !axis || axis === "y" ) {
       
  3926 				animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollTop);
       
  3927 			}
       
  3928 			this.reverting = true;
       
  3929 			$(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
       
  3930 				that._clear(event);
       
  3931 			});
       
  3932 		} else {
       
  3933 			this._clear(event, noPropagation);
       
  3934 		}
       
  3935 
       
  3936 		return false;
       
  3937 
       
  3938 	},
       
  3939 
       
  3940 	cancel: function() {
       
  3941 
       
  3942 		if(this.dragging) {
       
  3943 
       
  3944 			this._mouseUp({ target: null });
       
  3945 
       
  3946 			if(this.options.helper === "original") {
       
  3947 				this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
       
  3948 			} else {
       
  3949 				this.currentItem.show();
       
  3950 			}
       
  3951 
       
  3952 			//Post deactivating events to containers
       
  3953 			for (var i = this.containers.length - 1; i >= 0; i--){
       
  3954 				this.containers[i]._trigger("deactivate", null, this._uiHash(this));
       
  3955 				if(this.containers[i].containerCache.over) {
       
  3956 					this.containers[i]._trigger("out", null, this._uiHash(this));
       
  3957 					this.containers[i].containerCache.over = 0;
       
  3958 				}
       
  3959 			}
       
  3960 
       
  3961 		}
       
  3962 
       
  3963 		if (this.placeholder) {
       
  3964 			//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
       
  3965 			if(this.placeholder[0].parentNode) {
       
  3966 				this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
       
  3967 			}
       
  3968 			if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
       
  3969 				this.helper.remove();
       
  3970 			}
       
  3971 
       
  3972 			$.extend(this, {
       
  3973 				helper: null,
       
  3974 				dragging: false,
       
  3975 				reverting: false,
       
  3976 				_noFinalSort: null
       
  3977 			});
       
  3978 
       
  3979 			if(this.domPosition.prev) {
       
  3980 				$(this.domPosition.prev).after(this.currentItem);
       
  3981 			} else {
       
  3982 				$(this.domPosition.parent).prepend(this.currentItem);
       
  3983 			}
       
  3984 		}
       
  3985 
       
  3986 		return this;
       
  3987 
       
  3988 	},
       
  3989 
       
  3990 	serialize: function(o) {
       
  3991 
       
  3992 		var items = this._getItemsAsjQuery(o && o.connected),
       
  3993 			str = [];
       
  3994 		o = o || {};
       
  3995 
       
  3996 		$(items).each(function() {
       
  3997 			var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
       
  3998 			if (res) {
       
  3999 				str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2]));
       
  4000 			}
       
  4001 		});
       
  4002 
       
  4003 		if(!str.length && o.key) {
       
  4004 			str.push(o.key + "=");
       
  4005 		}
       
  4006 
       
  4007 		return str.join("&");
       
  4008 
       
  4009 	},
       
  4010 
       
  4011 	toArray: function(o) {
       
  4012 
       
  4013 		var items = this._getItemsAsjQuery(o && o.connected),
       
  4014 			ret = [];
       
  4015 
       
  4016 		o = o || {};
       
  4017 
       
  4018 		items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
       
  4019 		return ret;
       
  4020 
       
  4021 	},
       
  4022 
       
  4023 	/* Be careful with the following core functions */
       
  4024 	_intersectsWith: function(item) {
       
  4025 
       
  4026 		var x1 = this.positionAbs.left,
       
  4027 			x2 = x1 + this.helperProportions.width,
       
  4028 			y1 = this.positionAbs.top,
       
  4029 			y2 = y1 + this.helperProportions.height,
       
  4030 			l = item.left,
       
  4031 			r = l + item.width,
       
  4032 			t = item.top,
       
  4033 			b = t + item.height,
       
  4034 			dyClick = this.offset.click.top,
       
  4035 			dxClick = this.offset.click.left,
       
  4036 			isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
       
  4037 			isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
       
  4038 			isOverElement = isOverElementHeight && isOverElementWidth;
       
  4039 
       
  4040 		if ( this.options.tolerance === "pointer" ||
       
  4041 			this.options.forcePointerForContainers ||
       
  4042 			(this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
       
  4043 		) {
       
  4044 			return isOverElement;
       
  4045 		} else {
       
  4046 
       
  4047 			return (l < x1 + (this.helperProportions.width / 2) && // Right Half
       
  4048 				x2 - (this.helperProportions.width / 2) < r && // Left Half
       
  4049 				t < y1 + (this.helperProportions.height / 2) && // Bottom Half
       
  4050 				y2 - (this.helperProportions.height / 2) < b ); // Top Half
       
  4051 
       
  4052 		}
       
  4053 	},
       
  4054 
       
  4055 	_intersectsWithPointer: function(item) {
       
  4056 
       
  4057 		var isOverElementHeight = (this.options.axis === "x") || isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
       
  4058 			isOverElementWidth = (this.options.axis === "y") || isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
       
  4059 			isOverElement = isOverElementHeight && isOverElementWidth,
       
  4060 			verticalDirection = this._getDragVerticalDirection(),
       
  4061 			horizontalDirection = this._getDragHorizontalDirection();
       
  4062 
       
  4063 		if (!isOverElement) {
       
  4064 			return false;
       
  4065 		}
       
  4066 
       
  4067 		return this.floating ?
       
  4068 			( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
       
  4069 			: ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
       
  4070 
       
  4071 	},
       
  4072 
       
  4073 	_intersectsWithSides: function(item) {
       
  4074 
       
  4075 		var isOverBottomHalf = isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
       
  4076 			isOverRightHalf = isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
       
  4077 			verticalDirection = this._getDragVerticalDirection(),
       
  4078 			horizontalDirection = this._getDragHorizontalDirection();
       
  4079 
       
  4080 		if (this.floating && horizontalDirection) {
       
  4081 			return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
       
  4082 		} else {
       
  4083 			return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
       
  4084 		}
       
  4085 
       
  4086 	},
       
  4087 
       
  4088 	_getDragVerticalDirection: function() {
       
  4089 		var delta = this.positionAbs.top - this.lastPositionAbs.top;
       
  4090 		return delta !== 0 && (delta > 0 ? "down" : "up");
       
  4091 	},
       
  4092 
       
  4093 	_getDragHorizontalDirection: function() {
       
  4094 		var delta = this.positionAbs.left - this.lastPositionAbs.left;
       
  4095 		return delta !== 0 && (delta > 0 ? "right" : "left");
       
  4096 	},
       
  4097 
       
  4098 	refresh: function(event) {
       
  4099 		this._refreshItems(event);
       
  4100 		this.refreshPositions();
       
  4101 		return this;
       
  4102 	},
       
  4103 
       
  4104 	_connectWith: function() {
       
  4105 		var options = this.options;
       
  4106 		return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
       
  4107 	},
       
  4108 
       
  4109 	_getItemsAsjQuery: function(connected) {
       
  4110 
       
  4111 		var i, j, cur, inst,
       
  4112 			items = [],
       
  4113 			queries = [],
       
  4114 			connectWith = this._connectWith();
       
  4115 
       
  4116 		if(connectWith && connected) {
       
  4117 			for (i = connectWith.length - 1; i >= 0; i--){
       
  4118 				cur = $(connectWith[i]);
       
  4119 				for ( j = cur.length - 1; j >= 0; j--){
       
  4120 					inst = $.data(cur[j], this.widgetFullName);
       
  4121 					if(inst && inst !== this && !inst.options.disabled) {
       
  4122 						queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
       
  4123 					}
       
  4124 				}
       
  4125 			}
       
  4126 		}
       
  4127 
       
  4128 		queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
       
  4129 
       
  4130 		for (i = queries.length - 1; i >= 0; i--){
       
  4131 			queries[i][0].each(function() {
       
  4132 				items.push(this);
       
  4133 			});
       
  4134 		}
       
  4135 
       
  4136 		return $(items);
       
  4137 
       
  4138 	},
       
  4139 
       
  4140 	_removeCurrentsFromItems: function() {
       
  4141 
       
  4142 		var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
       
  4143 
       
  4144 		this.items = $.grep(this.items, function (item) {
       
  4145 			for (var j=0; j < list.length; j++) {
       
  4146 				if(list[j] === item.item[0]) {
       
  4147 					return false;
       
  4148 				}
       
  4149 			}
       
  4150 			return true;
       
  4151 		});
       
  4152 
       
  4153 	},
       
  4154 
       
  4155 	_refreshItems: function(event) {
       
  4156 
       
  4157 		this.items = [];
       
  4158 		this.containers = [this];
       
  4159 
       
  4160 		var i, j, cur, inst, targetData, _queries, item, queriesLength,
       
  4161 			items = this.items,
       
  4162 			queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
       
  4163 			connectWith = this._connectWith();
       
  4164 
       
  4165 		if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
       
  4166 			for (i = connectWith.length - 1; i >= 0; i--){
       
  4167 				cur = $(connectWith[i]);
       
  4168 				for (j = cur.length - 1; j >= 0; j--){
       
  4169 					inst = $.data(cur[j], this.widgetFullName);
       
  4170 					if(inst && inst !== this && !inst.options.disabled) {
       
  4171 						queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
       
  4172 						this.containers.push(inst);
       
  4173 					}
       
  4174 				}
       
  4175 			}
       
  4176 		}
       
  4177 
       
  4178 		for (i = queries.length - 1; i >= 0; i--) {
       
  4179 			targetData = queries[i][1];
       
  4180 			_queries = queries[i][0];
       
  4181 
       
  4182 			for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
       
  4183 				item = $(_queries[j]);
       
  4184 
       
  4185 				item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
       
  4186 
       
  4187 				items.push({
       
  4188 					item: item,
       
  4189 					instance: targetData,
       
  4190 					width: 0, height: 0,
       
  4191 					left: 0, top: 0
       
  4192 				});
       
  4193 			}
       
  4194 		}
       
  4195 
       
  4196 	},
       
  4197 
       
  4198 	refreshPositions: function(fast) {
       
  4199 
       
  4200 		//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
       
  4201 		if(this.offsetParent && this.helper) {
       
  4202 			this.offset.parent = this._getParentOffset();
       
  4203 		}
       
  4204 
       
  4205 		var i, item, t, p;
       
  4206 
       
  4207 		for (i = this.items.length - 1; i >= 0; i--){
       
  4208 			item = this.items[i];
       
  4209 
       
  4210 			//We ignore calculating positions of all connected containers when we're not over them
       
  4211 			if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
       
  4212 				continue;
       
  4213 			}
       
  4214 
       
  4215 			t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
       
  4216 
       
  4217 			if (!fast) {
       
  4218 				item.width = t.outerWidth();
       
  4219 				item.height = t.outerHeight();
       
  4220 			}
       
  4221 
       
  4222 			p = t.offset();
       
  4223 			item.left = p.left;
       
  4224 			item.top = p.top;
       
  4225 		}
       
  4226 
       
  4227 		if(this.options.custom && this.options.custom.refreshContainers) {
       
  4228 			this.options.custom.refreshContainers.call(this);
       
  4229 		} else {
       
  4230 			for (i = this.containers.length - 1; i >= 0; i--){
       
  4231 				p = this.containers[i].element.offset();
       
  4232 				this.containers[i].containerCache.left = p.left;
       
  4233 				this.containers[i].containerCache.top = p.top;
       
  4234 				this.containers[i].containerCache.width	= this.containers[i].element.outerWidth();
       
  4235 				this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
       
  4236 			}
       
  4237 		}
       
  4238 
       
  4239 		return this;
       
  4240 	},
       
  4241 
       
  4242 	_createPlaceholder: function(that) {
       
  4243 		that = that || this;
       
  4244 		var className,
       
  4245 			o = that.options;
       
  4246 
       
  4247 		if(!o.placeholder || o.placeholder.constructor === String) {
       
  4248 			className = o.placeholder;
       
  4249 			o.placeholder = {
       
  4250 				element: function() {
       
  4251 
       
  4252 					var nodeName = that.currentItem[0].nodeName.toLowerCase(),
       
  4253 						element = $( "<" + nodeName + ">", that.document[0] )
       
  4254 							.addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
       
  4255 							.removeClass("ui-sortable-helper");
       
  4256 
       
  4257 					if ( nodeName === "tr" ) {
       
  4258 						that.currentItem.children().each(function() {
       
  4259 							$( "<td>&#160;</td>", that.document[0] )
       
  4260 								.attr( "colspan", $( this ).attr( "colspan" ) || 1 )
       
  4261 								.appendTo( element );
       
  4262 						});
       
  4263 					} else if ( nodeName === "img" ) {
       
  4264 						element.attr( "src", that.currentItem.attr( "src" ) );
       
  4265 					}
       
  4266 
       
  4267 					if ( !className ) {
       
  4268 						element.css( "visibility", "hidden" );
       
  4269 					}
       
  4270 
       
  4271 					return element;
       
  4272 				},
       
  4273 				update: function(container, p) {
       
  4274 
       
  4275 					// 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
       
  4276 					// 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
       
  4277 					if(className && !o.forcePlaceholderSize) {
       
  4278 						return;
       
  4279 					}
       
  4280 
       
  4281 					//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
       
  4282 					if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
       
  4283 					if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
       
  4284 				}
       
  4285 			};
       
  4286 		}
       
  4287 
       
  4288 		//Create the placeholder
       
  4289 		that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
       
  4290 
       
  4291 		//Append it after the actual current item
       
  4292 		that.currentItem.after(that.placeholder);
       
  4293 
       
  4294 		//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
       
  4295 		o.placeholder.update(that, that.placeholder);
       
  4296 
       
  4297 	},
       
  4298 
       
  4299 	_contactContainers: function(event) {
       
  4300 		var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, base, cur, nearBottom, floating,
       
  4301 			innermostContainer = null,
       
  4302 			innermostIndex = null;
       
  4303 
       
  4304 		// get innermost container that intersects with item
       
  4305 		for (i = this.containers.length - 1; i >= 0; i--) {
       
  4306 
       
  4307 			// never consider a container that's located within the item itself
       
  4308 			if($.contains(this.currentItem[0], this.containers[i].element[0])) {
       
  4309 				continue;
       
  4310 			}
       
  4311 
       
  4312 			if(this._intersectsWith(this.containers[i].containerCache)) {
       
  4313 
       
  4314 				// if we've already found a container and it's more "inner" than this, then continue
       
  4315 				if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
       
  4316 					continue;
       
  4317 				}
       
  4318 
       
  4319 				innermostContainer = this.containers[i];
       
  4320 				innermostIndex = i;
       
  4321 
       
  4322 			} else {
       
  4323 				// container doesn't intersect. trigger "out" event if necessary
       
  4324 				if(this.containers[i].containerCache.over) {
       
  4325 					this.containers[i]._trigger("out", event, this._uiHash(this));
       
  4326 					this.containers[i].containerCache.over = 0;
       
  4327 				}
       
  4328 			}
       
  4329 
       
  4330 		}
       
  4331 
       
  4332 		// if no intersecting containers found, return
       
  4333 		if(!innermostContainer) {
       
  4334 			return;
       
  4335 		}
       
  4336 
       
  4337 		// move the item into the container if it's not there already
       
  4338 		if(this.containers.length === 1) {
       
  4339 			if (!this.containers[innermostIndex].containerCache.over) {
       
  4340 				this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
       
  4341 				this.containers[innermostIndex].containerCache.over = 1;
       
  4342 			}
       
  4343 		} else {
       
  4344 
       
  4345 			//When entering a new container, we will find the item with the least distance and append our item near it
       
  4346 			dist = 10000;
       
  4347 			itemWithLeastDistance = null;
       
  4348 			floating = innermostContainer.floating || isFloating(this.currentItem);
       
  4349 			posProperty = floating ? "left" : "top";
       
  4350 			sizeProperty = floating ? "width" : "height";
       
  4351 			base = this.positionAbs[posProperty] + this.offset.click[posProperty];
       
  4352 			for (j = this.items.length - 1; j >= 0; j--) {
       
  4353 				if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
       
  4354 					continue;
       
  4355 				}
       
  4356 				if(this.items[j].item[0] === this.currentItem[0]) {
       
  4357 					continue;
       
  4358 				}
       
  4359 				if (floating && !isOverAxis(this.positionAbs.top + this.offset.click.top, this.items[j].top, this.items[j].height)) {
       
  4360 					continue;
       
  4361 				}
       
  4362 				cur = this.items[j].item.offset()[posProperty];
       
  4363 				nearBottom = false;
       
  4364 				if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){
       
  4365 					nearBottom = true;
       
  4366 					cur += this.items[j][sizeProperty];
       
  4367 				}
       
  4368 
       
  4369 				if(Math.abs(cur - base) < dist) {
       
  4370 					dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
       
  4371 					this.direction = nearBottom ? "up": "down";
       
  4372 				}
       
  4373 			}
       
  4374 
       
  4375 			//Check if dropOnEmpty is enabled
       
  4376 			if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
       
  4377 				return;
       
  4378 			}
       
  4379 
       
  4380 			if(this.currentContainer === this.containers[innermostIndex]) {
       
  4381 				return;
       
  4382 			}
       
  4383 
       
  4384 			itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
       
  4385 			this._trigger("change", event, this._uiHash());
       
  4386 			this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
       
  4387 			this.currentContainer = this.containers[innermostIndex];
       
  4388 
       
  4389 			//Update the placeholder
       
  4390 			this.options.placeholder.update(this.currentContainer, this.placeholder);
       
  4391 
       
  4392 			this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
       
  4393 			this.containers[innermostIndex].containerCache.over = 1;
       
  4394 		}
       
  4395 
       
  4396 
       
  4397 	},
       
  4398 
       
  4399 	_createHelper: function(event) {
       
  4400 
       
  4401 		var o = this.options,
       
  4402 			helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
       
  4403 
       
  4404 		//Add the helper to the DOM if that didn't happen already
       
  4405 		if(!helper.parents("body").length) {
       
  4406 			$(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
       
  4407 		}
       
  4408 
       
  4409 		if(helper[0] === this.currentItem[0]) {
       
  4410 			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") };
       
  4411 		}
       
  4412 
       
  4413 		if(!helper[0].style.width || o.forceHelperSize) {
       
  4414 			helper.width(this.currentItem.width());
       
  4415 		}
       
  4416 		if(!helper[0].style.height || o.forceHelperSize) {
       
  4417 			helper.height(this.currentItem.height());
       
  4418 		}
       
  4419 
       
  4420 		return helper;
       
  4421 
       
  4422 	},
       
  4423 
       
  4424 	_adjustOffsetFromHelper: function(obj) {
       
  4425 		if (typeof obj === "string") {
       
  4426 			obj = obj.split(" ");
       
  4427 		}
       
  4428 		if ($.isArray(obj)) {
       
  4429 			obj = {left: +obj[0], top: +obj[1] || 0};
       
  4430 		}
       
  4431 		if ("left" in obj) {
       
  4432 			this.offset.click.left = obj.left + this.margins.left;
       
  4433 		}
       
  4434 		if ("right" in obj) {
       
  4435 			this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
       
  4436 		}
       
  4437 		if ("top" in obj) {
       
  4438 			this.offset.click.top = obj.top + this.margins.top;
       
  4439 		}
       
  4440 		if ("bottom" in obj) {
       
  4441 			this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
       
  4442 		}
       
  4443 	},
       
  4444 
       
  4445 	_getParentOffset: function() {
       
  4446 
       
  4447 
       
  4448 		//Get the offsetParent and cache its position
       
  4449 		this.offsetParent = this.helper.offsetParent();
       
  4450 		var po = this.offsetParent.offset();
       
  4451 
       
  4452 		// This is a special case where we need to modify a offset calculated on start, since the following happened:
       
  4453 		// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
       
  4454 		// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
       
  4455 		//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
       
  4456 		if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
       
  4457 			po.left += this.scrollParent.scrollLeft();
       
  4458 			po.top += this.scrollParent.scrollTop();
       
  4459 		}
       
  4460 
       
  4461 		// This needs to be actually done for all browsers, since pageX/pageY includes this information
       
  4462 		// with an ugly IE fix
       
  4463 		if( this.offsetParent[0] === document.body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
       
  4464 			po = { top: 0, left: 0 };
       
  4465 		}
       
  4466 
       
  4467 		return {
       
  4468 			top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
       
  4469 			left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
       
  4470 		};
       
  4471 
       
  4472 	},
       
  4473 
       
  4474 	_getRelativeOffset: function() {
       
  4475 
       
  4476 		if(this.cssPosition === "relative") {
       
  4477 			var p = this.currentItem.position();
       
  4478 			return {
       
  4479 				top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
       
  4480 				left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
       
  4481 			};
       
  4482 		} else {
       
  4483 			return { top: 0, left: 0 };
       
  4484 		}
       
  4485 
       
  4486 	},
       
  4487 
       
  4488 	_cacheMargins: function() {
       
  4489 		this.margins = {
       
  4490 			left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
       
  4491 			top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
       
  4492 		};
       
  4493 	},
       
  4494 
       
  4495 	_cacheHelperProportions: function() {
       
  4496 		this.helperProportions = {
       
  4497 			width: this.helper.outerWidth(),
       
  4498 			height: this.helper.outerHeight()
       
  4499 		};
       
  4500 	},
       
  4501 
       
  4502 	_setContainment: function() {
       
  4503 
       
  4504 		var ce, co, over,
       
  4505 			o = this.options;
       
  4506 		if(o.containment === "parent") {
       
  4507 			o.containment = this.helper[0].parentNode;
       
  4508 		}
       
  4509 		if(o.containment === "document" || o.containment === "window") {
       
  4510 			this.containment = [
       
  4511 				0 - this.offset.relative.left - this.offset.parent.left,
       
  4512 				0 - this.offset.relative.top - this.offset.parent.top,
       
  4513 				$(o.containment === "document" ? document : window).width() - this.helperProportions.width - this.margins.left,
       
  4514 				($(o.containment === "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
       
  4515 			];
       
  4516 		}
       
  4517 
       
  4518 		if(!(/^(document|window|parent)$/).test(o.containment)) {
       
  4519 			ce = $(o.containment)[0];
       
  4520 			co = $(o.containment).offset();
       
  4521 			over = ($(ce).css("overflow") !== "hidden");
       
  4522 
       
  4523 			this.containment = [
       
  4524 				co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
       
  4525 				co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
       
  4526 				co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
       
  4527 				co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
       
  4528 			];
       
  4529 		}
       
  4530 
       
  4531 	},
       
  4532 
       
  4533 	_convertPositionTo: function(d, pos) {
       
  4534 
       
  4535 		if(!pos) {
       
  4536 			pos = this.position;
       
  4537 		}
       
  4538 		var mod = d === "absolute" ? 1 : -1,
       
  4539 			scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
       
  4540 			scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
       
  4541 
       
  4542 		return {
       
  4543 			top: (
       
  4544 				pos.top	+																// The absolute mouse position
       
  4545 				this.offset.relative.top * mod +										// Only for relative positioned nodes: Relative offset from element to offset parent
       
  4546 				this.offset.parent.top * mod -											// The offsetParent's offset without borders (offset + border)
       
  4547 				( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
       
  4548 			),
       
  4549 			left: (
       
  4550 				pos.left +																// The absolute mouse position
       
  4551 				this.offset.relative.left * mod +										// Only for relative positioned nodes: Relative offset from element to offset parent
       
  4552 				this.offset.parent.left * mod	-										// The offsetParent's offset without borders (offset + border)
       
  4553 				( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
       
  4554 			)
       
  4555 		};
       
  4556 
       
  4557 	},
       
  4558 
       
  4559 	_generatePosition: function(event) {
       
  4560 
       
  4561 		var top, left,
       
  4562 			o = this.options,
       
  4563 			pageX = event.pageX,
       
  4564 			pageY = event.pageY,
       
  4565 			scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
       
  4566 
       
  4567 		// This is another very weird special case that only happens for relative elements:
       
  4568 		// 1. If the css position is relative
       
  4569 		// 2. and the scroll parent is the document or similar to the offset parent
       
  4570 		// we have to refresh the relative offset during the scroll so there are no jumps
       
  4571 		if(this.cssPosition === "relative" && !(this.scrollParent[0] !== document && this.scrollParent[0] !== this.offsetParent[0])) {
       
  4572 			this.offset.relative = this._getRelativeOffset();
       
  4573 		}
       
  4574 
       
  4575 		/*
       
  4576 		 * - Position constraining -
       
  4577 		 * Constrain the position to a mix of grid, containment.
       
  4578 		 */
       
  4579 
       
  4580 		if(this.originalPosition) { //If we are not dragging yet, we won't check for options
       
  4581 
       
  4582 			if(this.containment) {
       
  4583 				if(event.pageX - this.offset.click.left < this.containment[0]) {
       
  4584 					pageX = this.containment[0] + this.offset.click.left;
       
  4585 				}
       
  4586 				if(event.pageY - this.offset.click.top < this.containment[1]) {
       
  4587 					pageY = this.containment[1] + this.offset.click.top;
       
  4588 				}
       
  4589 				if(event.pageX - this.offset.click.left > this.containment[2]) {
       
  4590 					pageX = this.containment[2] + this.offset.click.left;
       
  4591 				}
       
  4592 				if(event.pageY - this.offset.click.top > this.containment[3]) {
       
  4593 					pageY = this.containment[3] + this.offset.click.top;
       
  4594 				}
       
  4595 			}
       
  4596 
       
  4597 			if(o.grid) {
       
  4598 				top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
       
  4599 				pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
       
  4600 
       
  4601 				left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
       
  4602 				pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
       
  4603 			}
       
  4604 
       
  4605 		}
       
  4606 
       
  4607 		return {
       
  4608 			top: (
       
  4609 				pageY -																// The absolute mouse position
       
  4610 				this.offset.click.top -													// Click offset (relative to the element)
       
  4611 				this.offset.relative.top	-											// Only for relative positioned nodes: Relative offset from element to offset parent
       
  4612 				this.offset.parent.top +												// The offsetParent's offset without borders (offset + border)
       
  4613 				( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
       
  4614 			),
       
  4615 			left: (
       
  4616 				pageX -																// The absolute mouse position
       
  4617 				this.offset.click.left -												// Click offset (relative to the element)
       
  4618 				this.offset.relative.left	-											// Only for relative positioned nodes: Relative offset from element to offset parent
       
  4619 				this.offset.parent.left +												// The offsetParent's offset without borders (offset + border)
       
  4620 				( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
       
  4621 			)
       
  4622 		};
       
  4623 
       
  4624 	},
       
  4625 
       
  4626 	_rearrange: function(event, i, a, hardRefresh) {
       
  4627 
       
  4628 		a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
       
  4629 
       
  4630 		//Various things done here to improve the performance:
       
  4631 		// 1. we create a setTimeout, that calls refreshPositions
       
  4632 		// 2. on the instance, we have a counter variable, that get's higher after every append
       
  4633 		// 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
       
  4634 		// 4. this lets only the last addition to the timeout stack through
       
  4635 		this.counter = this.counter ? ++this.counter : 1;
       
  4636 		var counter = this.counter;
       
  4637 
       
  4638 		this._delay(function() {
       
  4639 			if(counter === this.counter) {
       
  4640 				this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
       
  4641 			}
       
  4642 		});
       
  4643 
       
  4644 	},
       
  4645 
       
  4646 	_clear: function(event, noPropagation) {
       
  4647 
       
  4648 		this.reverting = false;
       
  4649 		// We delay all events that have to be triggered to after the point where the placeholder has been removed and
       
  4650 		// everything else normalized again
       
  4651 		var i,
       
  4652 			delayedTriggers = [];
       
  4653 
       
  4654 		// We first have to update the dom position of the actual currentItem
       
  4655 		// Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
       
  4656 		if(!this._noFinalSort && this.currentItem.parent().length) {
       
  4657 			this.placeholder.before(this.currentItem);
       
  4658 		}
       
  4659 		this._noFinalSort = null;
       
  4660 
       
  4661 		if(this.helper[0] === this.currentItem[0]) {
       
  4662 			for(i in this._storedCSS) {
       
  4663 				if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
       
  4664 					this._storedCSS[i] = "";
       
  4665 				}
       
  4666 			}
       
  4667 			this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
       
  4668 		} else {
       
  4669 			this.currentItem.show();
       
  4670 		}
       
  4671 
       
  4672 		if(this.fromOutside && !noPropagation) {
       
  4673 			delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
       
  4674 		}
       
  4675 		if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
       
  4676 			delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
       
  4677 		}
       
  4678 
       
  4679 		// Check if the items Container has Changed and trigger appropriate
       
  4680 		// events.
       
  4681 		if (this !== this.currentContainer) {
       
  4682 			if(!noPropagation) {
       
  4683 				delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
       
  4684 				delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); };  }).call(this, this.currentContainer));
       
  4685 				delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this));  }; }).call(this, this.currentContainer));
       
  4686 			}
       
  4687 		}
       
  4688 
       
  4689 
       
  4690 		//Post events to containers
       
  4691 		for (i = this.containers.length - 1; i >= 0; i--){
       
  4692 			if(!noPropagation) {
       
  4693 				delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); };  }).call(this, this.containers[i]));
       
  4694 			}
       
  4695 			if(this.containers[i].containerCache.over) {
       
  4696 				delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); };  }).call(this, this.containers[i]));
       
  4697 				this.containers[i].containerCache.over = 0;
       
  4698 			}
       
  4699 		}
       
  4700 
       
  4701 		//Do what was originally in plugins
       
  4702 		if ( this.storedCursor ) {
       
  4703 			this.document.find( "body" ).css( "cursor", this.storedCursor );
       
  4704 			this.storedStylesheet.remove();
       
  4705 		}
       
  4706 		if(this._storedOpacity) {
       
  4707 			this.helper.css("opacity", this._storedOpacity);
       
  4708 		}
       
  4709 		if(this._storedZIndex) {
       
  4710 			this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
       
  4711 		}
       
  4712 
       
  4713 		this.dragging = false;
       
  4714 		if(this.cancelHelperRemoval) {
       
  4715 			if(!noPropagation) {
       
  4716 				this._trigger("beforeStop", event, this._uiHash());
       
  4717 				for (i=0; i < delayedTriggers.length; i++) {
       
  4718 					delayedTriggers[i].call(this, event);
       
  4719 				} //Trigger all delayed events
       
  4720 				this._trigger("stop", event, this._uiHash());
       
  4721 			}
       
  4722 
       
  4723 			this.fromOutside = false;
       
  4724 			return false;
       
  4725 		}
       
  4726 
       
  4727 		if(!noPropagation) {
       
  4728 			this._trigger("beforeStop", event, this._uiHash());
       
  4729 		}
       
  4730 
       
  4731 		//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
       
  4732 		this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
       
  4733 
       
  4734 		if(this.helper[0] !== this.currentItem[0]) {
       
  4735 			this.helper.remove();
       
  4736 		}
       
  4737 		this.helper = null;
       
  4738 
       
  4739 		if(!noPropagation) {
       
  4740 			for (i=0; i < delayedTriggers.length; i++) {
       
  4741 				delayedTriggers[i].call(this, event);
       
  4742 			} //Trigger all delayed events
       
  4743 			this._trigger("stop", event, this._uiHash());
       
  4744 		}
       
  4745 
       
  4746 		this.fromOutside = false;
       
  4747 		return true;
       
  4748 
       
  4749 	},
       
  4750 
       
  4751 	_trigger: function() {
       
  4752 		if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
       
  4753 			this.cancel();
       
  4754 		}
       
  4755 	},
       
  4756 
       
  4757 	_uiHash: function(_inst) {
       
  4758 		var inst = _inst || this;
       
  4759 		return {
       
  4760 			helper: inst.helper,
       
  4761 			placeholder: inst.placeholder || $([]),
       
  4762 			position: inst.position,
       
  4763 			originalPosition: inst.originalPosition,
       
  4764 			offset: inst.positionAbs,
       
  4765 			item: inst.currentItem,
       
  4766 			sender: _inst ? _inst.element : null
       
  4767 		};
       
  4768 	}
       
  4769 
       
  4770 });
       
  4771 
       
  4772 })(jQuery);
       
  4773 
       
  4774 (function($, undefined) {
       
  4775 
       
  4776 var dataSpace = "ui-effects-";
       
  4777 
       
  4778 $.effects = {
       
  4779 	effect: {}
       
  4780 };
       
  4781 
  1044 
  4782 /*!
  1045 /*!
  4783  * jQuery Color Animations v2.1.2
  1046  * jQuery UI Position 1.11.4
  4784  * https://github.com/jquery/jquery-color
  1047  * http://jqueryui.com
  4785  *
  1048  *
  4786  * Copyright 2013 jQuery Foundation and other contributors
  1049  * Copyright jQuery Foundation and other contributors
  4787  * Released under the MIT license.
  1050  * Released under the MIT license.
  4788  * http://jquery.org/license
  1051  * http://jquery.org/license
  4789  *
  1052  *
  4790  * Date: Wed Jan 16 08:47:09 2013 -0600
  1053  * http://api.jqueryui.com/position/
  4791  */
  1054  */
  4792 (function( jQuery, undefined ) {
  1055 
  4793 
  1056 (function() {
  4794 	var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  1057 
  4795 
  1058 $.ui = $.ui || {};
  4796 	// plusequals test for += 100 -= 100
  1059 
  4797 	rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  1060 var cachedScrollbarWidth, supportsOffsetFractions,
  4798 	// a set of RE's that can match strings and generate color tuples.
  1061 	max = Math.max,
  4799 	stringParsers = [{
  1062 	abs = Math.abs,
  4800 			re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1063 	round = Math.round,
  4801 			parse: function( execResult ) {
  1064 	rhorizontal = /left|center|right/,
  4802 				return [
  1065 	rvertical = /top|center|bottom/,
  4803 					execResult[ 1 ],
  1066 	roffset = /[\+\-]\d+(\.[\d]+)?%?/,
  4804 					execResult[ 2 ],
  1067 	rposition = /^\w+/,
  4805 					execResult[ 3 ],
  1068 	rpercent = /%$/,
  4806 					execResult[ 4 ]
  1069 	_position = $.fn.position;
  4807 				];
  1070 
  4808 			}
  1071 function getOffsets( offsets, width, height ) {
  4809 		}, {
  1072 	return [
  4810 			re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1073 		parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
  4811 			parse: function( execResult ) {
  1074 		parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
  4812 				return [
  1075 	];
  4813 					execResult[ 1 ] * 2.55,
  1076 }
  4814 					execResult[ 2 ] * 2.55,
  1077 
  4815 					execResult[ 3 ] * 2.55,
  1078 function parseCss( element, property ) {
  4816 					execResult[ 4 ]
  1079 	return parseInt( $.css( element, property ), 10 ) || 0;
  4817 				];
  1080 }
  4818 			}
  1081 
  4819 		}, {
  1082 function getDimensions( elem ) {
  4820 			// this regex ignores A-F because it's compared against an already lowercased string
  1083 	var raw = elem[0];
  4821 			re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
  1084 	if ( raw.nodeType === 9 ) {
  4822 			parse: function( execResult ) {
  1085 		return {
  4823 				return [
  1086 			width: elem.width(),
  4824 					parseInt( execResult[ 1 ], 16 ),
  1087 			height: elem.height(),
  4825 					parseInt( execResult[ 2 ], 16 ),
  1088 			offset: { top: 0, left: 0 }
  4826 					parseInt( execResult[ 3 ], 16 )
  1089 		};
  4827 				];
  1090 	}
  4828 			}
  1091 	if ( $.isWindow( raw ) ) {
  4829 		}, {
  1092 		return {
  4830 			// this regex ignores A-F because it's compared against an already lowercased string
  1093 			width: elem.width(),
  4831 			re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
  1094 			height: elem.height(),
  4832 			parse: function( execResult ) {
  1095 			offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
  4833 				return [
  1096 		};
  4834 					parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  1097 	}
  4835 					parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  1098 	if ( raw.preventDefault ) {
  4836 					parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
  1099 		return {
  4837 				];
  1100 			width: 0,
  4838 			}
  1101 			height: 0,
  4839 		}, {
  1102 			offset: { top: raw.pageY, left: raw.pageX }
  4840 			re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1103 		};
  4841 			space: "hsla",
  1104 	}
  4842 			parse: function( execResult ) {
  1105 	return {
  4843 				return [
  1106 		width: elem.outerWidth(),
  4844 					execResult[ 1 ],
  1107 		height: elem.outerHeight(),
  4845 					execResult[ 2 ] / 100,
  1108 		offset: elem.offset()
  4846 					execResult[ 3 ] / 100,
       
  4847 					execResult[ 4 ]
       
  4848 				];
       
  4849 			}
       
  4850 		}],
       
  4851 
       
  4852 	// jQuery.Color( )
       
  4853 	color = jQuery.Color = function( color, green, blue, alpha ) {
       
  4854 		return new jQuery.Color.fn.parse( color, green, blue, alpha );
       
  4855 	},
       
  4856 	spaces = {
       
  4857 		rgba: {
       
  4858 			props: {
       
  4859 				red: {
       
  4860 					idx: 0,
       
  4861 					type: "byte"
       
  4862 				},
       
  4863 				green: {
       
  4864 					idx: 1,
       
  4865 					type: "byte"
       
  4866 				},
       
  4867 				blue: {
       
  4868 					idx: 2,
       
  4869 					type: "byte"
       
  4870 				}
       
  4871 			}
       
  4872 		},
       
  4873 
       
  4874 		hsla: {
       
  4875 			props: {
       
  4876 				hue: {
       
  4877 					idx: 0,
       
  4878 					type: "degrees"
       
  4879 				},
       
  4880 				saturation: {
       
  4881 					idx: 1,
       
  4882 					type: "percent"
       
  4883 				},
       
  4884 				lightness: {
       
  4885 					idx: 2,
       
  4886 					type: "percent"
       
  4887 				}
       
  4888 			}
       
  4889 		}
       
  4890 	},
       
  4891 	propTypes = {
       
  4892 		"byte": {
       
  4893 			floor: true,
       
  4894 			max: 255
       
  4895 		},
       
  4896 		"percent": {
       
  4897 			max: 1
       
  4898 		},
       
  4899 		"degrees": {
       
  4900 			mod: 360,
       
  4901 			floor: true
       
  4902 		}
       
  4903 	},
       
  4904 	support = color.support = {},
       
  4905 
       
  4906 	// element for support tests
       
  4907 	supportElem = jQuery( "<p>" )[ 0 ],
       
  4908 
       
  4909 	// colors = jQuery.Color.names
       
  4910 	colors,
       
  4911 
       
  4912 	// local aliases of functions called often
       
  4913 	each = jQuery.each;
       
  4914 
       
  4915 // determine rgba support immediately
       
  4916 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
       
  4917 support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
       
  4918 
       
  4919 // define cache name and alpha properties
       
  4920 // for rgba and hsla spaces
       
  4921 each( spaces, function( spaceName, space ) {
       
  4922 	space.cache = "_" + spaceName;
       
  4923 	space.props.alpha = {
       
  4924 		idx: 3,
       
  4925 		type: "percent",
       
  4926 		def: 1
       
  4927 	};
  1109 	};
  4928 });
       
  4929 
       
  4930 function clamp( value, prop, allowEmpty ) {
       
  4931 	var type = propTypes[ prop.type ] || {};
       
  4932 
       
  4933 	if ( value == null ) {
       
  4934 		return (allowEmpty || !prop.def) ? null : prop.def;
       
  4935 	}
       
  4936 
       
  4937 	// ~~ is an short way of doing floor for positive numbers
       
  4938 	value = type.floor ? ~~value : parseFloat( value );
       
  4939 
       
  4940 	// IE will pass in empty strings as value for alpha,
       
  4941 	// which will hit this case
       
  4942 	if ( isNaN( value ) ) {
       
  4943 		return prop.def;
       
  4944 	}
       
  4945 
       
  4946 	if ( type.mod ) {
       
  4947 		// we add mod before modding to make sure that negatives values
       
  4948 		// get converted properly: -10 -> 350
       
  4949 		return (value + type.mod) % type.mod;
       
  4950 	}
       
  4951 
       
  4952 	// for now all property types without mod have min and max
       
  4953 	return 0 > value ? 0 : type.max < value ? type.max : value;
       
  4954 }
  1110 }
  4955 
  1111 
  4956 function stringParse( string ) {
  1112 $.position = {
  4957 	var inst = color(),
  1113 	scrollbarWidth: function() {
  4958 		rgba = inst._rgba = [];
  1114 		if ( cachedScrollbarWidth !== undefined ) {
  4959 
  1115 			return cachedScrollbarWidth;
  4960 	string = string.toLowerCase();
  1116 		}
  4961 
  1117 		var w1, w2,
  4962 	each( stringParsers, function( i, parser ) {
  1118 			div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
  4963 		var parsed,
  1119 			innerDiv = div.children()[0];
  4964 			match = parser.re.exec( string ),
  1120 
  4965 			values = match && parser.parse( match ),
  1121 		$( "body" ).append( div );
  4966 			spaceName = parser.space || "rgba";
  1122 		w1 = innerDiv.offsetWidth;
  4967 
  1123 		div.css( "overflow", "scroll" );
  4968 		if ( values ) {
  1124 
  4969 			parsed = inst[ spaceName ]( values );
  1125 		w2 = innerDiv.offsetWidth;
  4970 
  1126 
  4971 			// if this was an rgba parse the assignment might happen twice
  1127 		if ( w1 === w2 ) {
  4972 			// oh well....
  1128 			w2 = div[0].clientWidth;
  4973 			inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  1129 		}
  4974 			rgba = inst._rgba = parsed._rgba;
  1130 
  4975 
  1131 		div.remove();
  4976 			// exit each( stringParsers ) here because we matched
  1132 
  4977 			return false;
  1133 		return (cachedScrollbarWidth = w1 - w2);
  4978 		}
  1134 	},
  4979 	});
  1135 	getScrollInfo: function( within ) {
  4980 
  1136 		var overflowX = within.isWindow || within.isDocument ? "" :
  4981 	// Found a stringParser that handled it
  1137 				within.element.css( "overflow-x" ),
  4982 	if ( rgba.length ) {
  1138 			overflowY = within.isWindow || within.isDocument ? "" :
  4983 
  1139 				within.element.css( "overflow-y" ),
  4984 		// if this came from a parsed string, force "transparent" when alpha is 0
  1140 			hasOverflowX = overflowX === "scroll" ||
  4985 		// chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  1141 				( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
  4986 		if ( rgba.join() === "0,0,0,0" ) {
  1142 			hasOverflowY = overflowY === "scroll" ||
  4987 			jQuery.extend( rgba, colors.transparent );
  1143 				( overflowY === "auto" && within.height < within.element[0].scrollHeight );
  4988 		}
  1144 		return {
  4989 		return inst;
  1145 			width: hasOverflowY ? $.position.scrollbarWidth() : 0,
  4990 	}
  1146 			height: hasOverflowX ? $.position.scrollbarWidth() : 0
  4991 
       
  4992 	// named colors
       
  4993 	return colors[ string ];
       
  4994 }
       
  4995 
       
  4996 color.fn = jQuery.extend( color.prototype, {
       
  4997 	parse: function( red, green, blue, alpha ) {
       
  4998 		if ( red === undefined ) {
       
  4999 			this._rgba = [ null, null, null, null ];
       
  5000 			return this;
       
  5001 		}
       
  5002 		if ( red.jquery || red.nodeType ) {
       
  5003 			red = jQuery( red ).css( green );
       
  5004 			green = undefined;
       
  5005 		}
       
  5006 
       
  5007 		var inst = this,
       
  5008 			type = jQuery.type( red ),
       
  5009 			rgba = this._rgba = [];
       
  5010 
       
  5011 		// more than 1 argument specified - assume ( red, green, blue, alpha )
       
  5012 		if ( green !== undefined ) {
       
  5013 			red = [ red, green, blue, alpha ];
       
  5014 			type = "array";
       
  5015 		}
       
  5016 
       
  5017 		if ( type === "string" ) {
       
  5018 			return this.parse( stringParse( red ) || colors._default );
       
  5019 		}
       
  5020 
       
  5021 		if ( type === "array" ) {
       
  5022 			each( spaces.rgba.props, function( key, prop ) {
       
  5023 				rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
       
  5024 			});
       
  5025 			return this;
       
  5026 		}
       
  5027 
       
  5028 		if ( type === "object" ) {
       
  5029 			if ( red instanceof color ) {
       
  5030 				each( spaces, function( spaceName, space ) {
       
  5031 					if ( red[ space.cache ] ) {
       
  5032 						inst[ space.cache ] = red[ space.cache ].slice();
       
  5033 					}
       
  5034 				});
       
  5035 			} else {
       
  5036 				each( spaces, function( spaceName, space ) {
       
  5037 					var cache = space.cache;
       
  5038 					each( space.props, function( key, prop ) {
       
  5039 
       
  5040 						// if the cache doesn't exist, and we know how to convert
       
  5041 						if ( !inst[ cache ] && space.to ) {
       
  5042 
       
  5043 							// if the value was null, we don't need to copy it
       
  5044 							// if the key was alpha, we don't need to copy it either
       
  5045 							if ( key === "alpha" || red[ key ] == null ) {
       
  5046 								return;
       
  5047 							}
       
  5048 							inst[ cache ] = space.to( inst._rgba );
       
  5049 						}
       
  5050 
       
  5051 						// this is the only case where we allow nulls for ALL properties.
       
  5052 						// call clamp with alwaysAllowEmpty
       
  5053 						inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
       
  5054 					});
       
  5055 
       
  5056 					// everything defined but alpha?
       
  5057 					if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
       
  5058 						// use the default of 1
       
  5059 						inst[ cache ][ 3 ] = 1;
       
  5060 						if ( space.from ) {
       
  5061 							inst._rgba = space.from( inst[ cache ] );
       
  5062 						}
       
  5063 					}
       
  5064 				});
       
  5065 			}
       
  5066 			return this;
       
  5067 		}
       
  5068 	},
       
  5069 	is: function( compare ) {
       
  5070 		var is = color( compare ),
       
  5071 			same = true,
       
  5072 			inst = this;
       
  5073 
       
  5074 		each( spaces, function( _, space ) {
       
  5075 			var localCache,
       
  5076 				isCache = is[ space.cache ];
       
  5077 			if (isCache) {
       
  5078 				localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
       
  5079 				each( space.props, function( _, prop ) {
       
  5080 					if ( isCache[ prop.idx ] != null ) {
       
  5081 						same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
       
  5082 						return same;
       
  5083 					}
       
  5084 				});
       
  5085 			}
       
  5086 			return same;
       
  5087 		});
       
  5088 		return same;
       
  5089 	},
       
  5090 	_space: function() {
       
  5091 		var used = [],
       
  5092 			inst = this;
       
  5093 		each( spaces, function( spaceName, space ) {
       
  5094 			if ( inst[ space.cache ] ) {
       
  5095 				used.push( spaceName );
       
  5096 			}
       
  5097 		});
       
  5098 		return used.pop();
       
  5099 	},
       
  5100 	transition: function( other, distance ) {
       
  5101 		var end = color( other ),
       
  5102 			spaceName = end._space(),
       
  5103 			space = spaces[ spaceName ],
       
  5104 			startColor = this.alpha() === 0 ? color( "transparent" ) : this,
       
  5105 			start = startColor[ space.cache ] || space.to( startColor._rgba ),
       
  5106 			result = start.slice();
       
  5107 
       
  5108 		end = end[ space.cache ];
       
  5109 		each( space.props, function( key, prop ) {
       
  5110 			var index = prop.idx,
       
  5111 				startValue = start[ index ],
       
  5112 				endValue = end[ index ],
       
  5113 				type = propTypes[ prop.type ] || {};
       
  5114 
       
  5115 			// if null, don't override start value
       
  5116 			if ( endValue === null ) {
       
  5117 				return;
       
  5118 			}
       
  5119 			// if null - use end
       
  5120 			if ( startValue === null ) {
       
  5121 				result[ index ] = endValue;
       
  5122 			} else {
       
  5123 				if ( type.mod ) {
       
  5124 					if ( endValue - startValue > type.mod / 2 ) {
       
  5125 						startValue += type.mod;
       
  5126 					} else if ( startValue - endValue > type.mod / 2 ) {
       
  5127 						startValue -= type.mod;
       
  5128 					}
       
  5129 				}
       
  5130 				result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
       
  5131 			}
       
  5132 		});
       
  5133 		return this[ spaceName ]( result );
       
  5134 	},
       
  5135 	blend: function( opaque ) {
       
  5136 		// if we are already opaque - return ourself
       
  5137 		if ( this._rgba[ 3 ] === 1 ) {
       
  5138 			return this;
       
  5139 		}
       
  5140 
       
  5141 		var rgb = this._rgba.slice(),
       
  5142 			a = rgb.pop(),
       
  5143 			blend = color( opaque )._rgba;
       
  5144 
       
  5145 		return color( jQuery.map( rgb, function( v, i ) {
       
  5146 			return ( 1 - a ) * blend[ i ] + a * v;
       
  5147 		}));
       
  5148 	},
       
  5149 	toRgbaString: function() {
       
  5150 		var prefix = "rgba(",
       
  5151 			rgba = jQuery.map( this._rgba, function( v, i ) {
       
  5152 				return v == null ? ( i > 2 ? 1 : 0 ) : v;
       
  5153 			});
       
  5154 
       
  5155 		if ( rgba[ 3 ] === 1 ) {
       
  5156 			rgba.pop();
       
  5157 			prefix = "rgb(";
       
  5158 		}
       
  5159 
       
  5160 		return prefix + rgba.join() + ")";
       
  5161 	},
       
  5162 	toHslaString: function() {
       
  5163 		var prefix = "hsla(",
       
  5164 			hsla = jQuery.map( this.hsla(), function( v, i ) {
       
  5165 				if ( v == null ) {
       
  5166 					v = i > 2 ? 1 : 0;
       
  5167 				}
       
  5168 
       
  5169 				// catch 1 and 2
       
  5170 				if ( i && i < 3 ) {
       
  5171 					v = Math.round( v * 100 ) + "%";
       
  5172 				}
       
  5173 				return v;
       
  5174 			});
       
  5175 
       
  5176 		if ( hsla[ 3 ] === 1 ) {
       
  5177 			hsla.pop();
       
  5178 			prefix = "hsl(";
       
  5179 		}
       
  5180 		return prefix + hsla.join() + ")";
       
  5181 	},
       
  5182 	toHexString: function( includeAlpha ) {
       
  5183 		var rgba = this._rgba.slice(),
       
  5184 			alpha = rgba.pop();
       
  5185 
       
  5186 		if ( includeAlpha ) {
       
  5187 			rgba.push( ~~( alpha * 255 ) );
       
  5188 		}
       
  5189 
       
  5190 		return "#" + jQuery.map( rgba, function( v ) {
       
  5191 
       
  5192 			// default to 0 when nulls exist
       
  5193 			v = ( v || 0 ).toString( 16 );
       
  5194 			return v.length === 1 ? "0" + v : v;
       
  5195 		}).join("");
       
  5196 	},
       
  5197 	toString: function() {
       
  5198 		return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
       
  5199 	}
       
  5200 });
       
  5201 color.fn.parse.prototype = color.fn;
       
  5202 
       
  5203 // hsla conversions adapted from:
       
  5204 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
       
  5205 
       
  5206 function hue2rgb( p, q, h ) {
       
  5207 	h = ( h + 1 ) % 1;
       
  5208 	if ( h * 6 < 1 ) {
       
  5209 		return p + (q - p) * h * 6;
       
  5210 	}
       
  5211 	if ( h * 2 < 1) {
       
  5212 		return q;
       
  5213 	}
       
  5214 	if ( h * 3 < 2 ) {
       
  5215 		return p + (q - p) * ((2/3) - h) * 6;
       
  5216 	}
       
  5217 	return p;
       
  5218 }
       
  5219 
       
  5220 spaces.hsla.to = function ( rgba ) {
       
  5221 	if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
       
  5222 		return [ null, null, null, rgba[ 3 ] ];
       
  5223 	}
       
  5224 	var r = rgba[ 0 ] / 255,
       
  5225 		g = rgba[ 1 ] / 255,
       
  5226 		b = rgba[ 2 ] / 255,
       
  5227 		a = rgba[ 3 ],
       
  5228 		max = Math.max( r, g, b ),
       
  5229 		min = Math.min( r, g, b ),
       
  5230 		diff = max - min,
       
  5231 		add = max + min,
       
  5232 		l = add * 0.5,
       
  5233 		h, s;
       
  5234 
       
  5235 	if ( min === max ) {
       
  5236 		h = 0;
       
  5237 	} else if ( r === max ) {
       
  5238 		h = ( 60 * ( g - b ) / diff ) + 360;
       
  5239 	} else if ( g === max ) {
       
  5240 		h = ( 60 * ( b - r ) / diff ) + 120;
       
  5241 	} else {
       
  5242 		h = ( 60 * ( r - g ) / diff ) + 240;
       
  5243 	}
       
  5244 
       
  5245 	// chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
       
  5246 	// otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
       
  5247 	if ( diff === 0 ) {
       
  5248 		s = 0;
       
  5249 	} else if ( l <= 0.5 ) {
       
  5250 		s = diff / add;
       
  5251 	} else {
       
  5252 		s = diff / ( 2 - add );
       
  5253 	}
       
  5254 	return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
       
  5255 };
       
  5256 
       
  5257 spaces.hsla.from = function ( hsla ) {
       
  5258 	if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
       
  5259 		return [ null, null, null, hsla[ 3 ] ];
       
  5260 	}
       
  5261 	var h = hsla[ 0 ] / 360,
       
  5262 		s = hsla[ 1 ],
       
  5263 		l = hsla[ 2 ],
       
  5264 		a = hsla[ 3 ],
       
  5265 		q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
       
  5266 		p = 2 * l - q;
       
  5267 
       
  5268 	return [
       
  5269 		Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
       
  5270 		Math.round( hue2rgb( p, q, h ) * 255 ),
       
  5271 		Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
       
  5272 		a
       
  5273 	];
       
  5274 };
       
  5275 
       
  5276 
       
  5277 each( spaces, function( spaceName, space ) {
       
  5278 	var props = space.props,
       
  5279 		cache = space.cache,
       
  5280 		to = space.to,
       
  5281 		from = space.from;
       
  5282 
       
  5283 	// makes rgba() and hsla()
       
  5284 	color.fn[ spaceName ] = function( value ) {
       
  5285 
       
  5286 		// generate a cache for this space if it doesn't exist
       
  5287 		if ( to && !this[ cache ] ) {
       
  5288 			this[ cache ] = to( this._rgba );
       
  5289 		}
       
  5290 		if ( value === undefined ) {
       
  5291 			return this[ cache ].slice();
       
  5292 		}
       
  5293 
       
  5294 		var ret,
       
  5295 			type = jQuery.type( value ),
       
  5296 			arr = ( type === "array" || type === "object" ) ? value : arguments,
       
  5297 			local = this[ cache ].slice();
       
  5298 
       
  5299 		each( props, function( key, prop ) {
       
  5300 			var val = arr[ type === "object" ? key : prop.idx ];
       
  5301 			if ( val == null ) {
       
  5302 				val = local[ prop.idx ];
       
  5303 			}
       
  5304 			local[ prop.idx ] = clamp( val, prop );
       
  5305 		});
       
  5306 
       
  5307 		if ( from ) {
       
  5308 			ret = color( from( local ) );
       
  5309 			ret[ cache ] = local;
       
  5310 			return ret;
       
  5311 		} else {
       
  5312 			return color( local );
       
  5313 		}
       
  5314 	};
       
  5315 
       
  5316 	// makes red() green() blue() alpha() hue() saturation() lightness()
       
  5317 	each( props, function( key, prop ) {
       
  5318 		// alpha is included in more than one space
       
  5319 		if ( color.fn[ key ] ) {
       
  5320 			return;
       
  5321 		}
       
  5322 		color.fn[ key ] = function( value ) {
       
  5323 			var vtype = jQuery.type( value ),
       
  5324 				fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
       
  5325 				local = this[ fn ](),
       
  5326 				cur = local[ prop.idx ],
       
  5327 				match;
       
  5328 
       
  5329 			if ( vtype === "undefined" ) {
       
  5330 				return cur;
       
  5331 			}
       
  5332 
       
  5333 			if ( vtype === "function" ) {
       
  5334 				value = value.call( this, cur );
       
  5335 				vtype = jQuery.type( value );
       
  5336 			}
       
  5337 			if ( value == null && prop.empty ) {
       
  5338 				return this;
       
  5339 			}
       
  5340 			if ( vtype === "string" ) {
       
  5341 				match = rplusequals.exec( value );
       
  5342 				if ( match ) {
       
  5343 					value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
       
  5344 				}
       
  5345 			}
       
  5346 			local[ prop.idx ] = value;
       
  5347 			return this[ fn ]( local );
       
  5348 		};
  1147 		};
  5349 	});
  1148 	},
  5350 });
  1149 	getWithinInfo: function( element ) {
  5351 
  1150 		var withinElement = $( element || window ),
  5352 // add cssHook and .fx.step function for each named hook.
  1151 			isWindow = $.isWindow( withinElement[0] ),
  5353 // accept a space separated string of properties
  1152 			isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
  5354 color.hook = function( hook ) {
  1153 		return {
  5355 	var hooks = hook.split( " " );
  1154 			element: withinElement,
  5356 	each( hooks, function( i, hook ) {
  1155 			isWindow: isWindow,
  5357 		jQuery.cssHooks[ hook ] = {
  1156 			isDocument: isDocument,
  5358 			set: function( elem, value ) {
  1157 			offset: withinElement.offset() || { left: 0, top: 0 },
  5359 				var parsed, curElem,
  1158 			scrollLeft: withinElement.scrollLeft(),
  5360 					backgroundColor = "";
  1159 			scrollTop: withinElement.scrollTop(),
  5361 
  1160 
  5362 				if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
  1161 			// support: jQuery 1.6.x
  5363 					value = color( parsed || value );
  1162 			// jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows
  5364 					if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  1163 			width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(),
  5365 						curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  1164 			height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight()
  5366 						while (
       
  5367 							(backgroundColor === "" || backgroundColor === "transparent") &&
       
  5368 							curElem && curElem.style
       
  5369 						) {
       
  5370 							try {
       
  5371 								backgroundColor = jQuery.css( curElem, "backgroundColor" );
       
  5372 								curElem = curElem.parentNode;
       
  5373 							} catch ( e ) {
       
  5374 							}
       
  5375 						}
       
  5376 
       
  5377 						value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
       
  5378 							backgroundColor :
       
  5379 							"_default" );
       
  5380 					}
       
  5381 
       
  5382 					value = value.toRgbaString();
       
  5383 				}
       
  5384 				try {
       
  5385 					elem.style[ hook ] = value;
       
  5386 				} catch( e ) {
       
  5387 					// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
       
  5388 				}
       
  5389 			}
       
  5390 		};
  1165 		};
  5391 		jQuery.fx.step[ hook ] = function( fx ) {
       
  5392 			if ( !fx.colorInit ) {
       
  5393 				fx.start = color( fx.elem, hook );
       
  5394 				fx.end = color( fx.end );
       
  5395 				fx.colorInit = true;
       
  5396 			}
       
  5397 			jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
       
  5398 		};
       
  5399 	});
       
  5400 
       
  5401 };
       
  5402 
       
  5403 color.hook( stepHooks );
       
  5404 
       
  5405 jQuery.cssHooks.borderColor = {
       
  5406 	expand: function( value ) {
       
  5407 		var expanded = {};
       
  5408 
       
  5409 		each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
       
  5410 			expanded[ "border" + part + "Color" ] = value;
       
  5411 		});
       
  5412 		return expanded;
       
  5413 	}
  1166 	}
  5414 };
  1167 };
  5415 
  1168 
  5416 // Basic color names only.
  1169 $.fn.position = function( options ) {
  5417 // Usage of any of the other color names requires adding yourself or including
  1170 	if ( !options || !options.of ) {
  5418 // jquery.color.svg-names.js.
  1171 		return _position.apply( this, arguments );
  5419 colors = jQuery.Color.names = {
       
  5420 	// 4.1. Basic color keywords
       
  5421 	aqua: "#00ffff",
       
  5422 	black: "#000000",
       
  5423 	blue: "#0000ff",
       
  5424 	fuchsia: "#ff00ff",
       
  5425 	gray: "#808080",
       
  5426 	green: "#008000",
       
  5427 	lime: "#00ff00",
       
  5428 	maroon: "#800000",
       
  5429 	navy: "#000080",
       
  5430 	olive: "#808000",
       
  5431 	purple: "#800080",
       
  5432 	red: "#ff0000",
       
  5433 	silver: "#c0c0c0",
       
  5434 	teal: "#008080",
       
  5435 	white: "#ffffff",
       
  5436 	yellow: "#ffff00",
       
  5437 
       
  5438 	// 4.2.3. "transparent" color keyword
       
  5439 	transparent: [ null, null, null, 0 ],
       
  5440 
       
  5441 	_default: "#ffffff"
       
  5442 };
       
  5443 
       
  5444 })( jQuery );
       
  5445 
       
  5446 
       
  5447 /******************************************************************************/
       
  5448 /****************************** CLASS ANIMATIONS ******************************/
       
  5449 /******************************************************************************/
       
  5450 (function() {
       
  5451 
       
  5452 var classAnimationActions = [ "add", "remove", "toggle" ],
       
  5453 	shorthandStyles = {
       
  5454 		border: 1,
       
  5455 		borderBottom: 1,
       
  5456 		borderColor: 1,
       
  5457 		borderLeft: 1,
       
  5458 		borderRight: 1,
       
  5459 		borderTop: 1,
       
  5460 		borderWidth: 1,
       
  5461 		margin: 1,
       
  5462 		padding: 1
       
  5463 	};
       
  5464 
       
  5465 $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
       
  5466 	$.fx.step[ prop ] = function( fx ) {
       
  5467 		if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
       
  5468 			jQuery.style( fx.elem, prop, fx.end );
       
  5469 			fx.setAttr = true;
       
  5470 		}
       
  5471 	};
       
  5472 });
       
  5473 
       
  5474 function getElementStyles( elem ) {
       
  5475 	var key, len,
       
  5476 		style = elem.ownerDocument.defaultView ?
       
  5477 			elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
       
  5478 			elem.currentStyle,
       
  5479 		styles = {};
       
  5480 
       
  5481 	if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
       
  5482 		len = style.length;
       
  5483 		while ( len-- ) {
       
  5484 			key = style[ len ];
       
  5485 			if ( typeof style[ key ] === "string" ) {
       
  5486 				styles[ $.camelCase( key ) ] = style[ key ];
       
  5487 			}
       
  5488 		}
       
  5489 	// support: Opera, IE <9
       
  5490 	} else {
       
  5491 		for ( key in style ) {
       
  5492 			if ( typeof style[ key ] === "string" ) {
       
  5493 				styles[ key ] = style[ key ];
       
  5494 			}
       
  5495 		}
       
  5496 	}
  1172 	}
  5497 
  1173 
  5498 	return styles;
  1174 	// make a copy, we don't want to modify arguments
  5499 }
  1175 	options = $.extend( {}, options );
  5500 
  1176 
  5501 
  1177 	var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
  5502 function styleDifference( oldStyle, newStyle ) {
  1178 		target = $( options.of ),
  5503 	var diff = {},
  1179 		within = $.position.getWithinInfo( options.within ),
  5504 		name, value;
  1180 		scrollInfo = $.position.getScrollInfo( within ),
  5505 
  1181 		collision = ( options.collision || "flip" ).split( " " ),
  5506 	for ( name in newStyle ) {
  1182 		offsets = {};
  5507 		value = newStyle[ name ];
  1183 
  5508 		if ( oldStyle[ name ] !== value ) {
  1184 	dimensions = getDimensions( target );
  5509 			if ( !shorthandStyles[ name ] ) {
  1185 	if ( target[0].preventDefault ) {
  5510 				if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
  1186 		// force left top to allow flipping
  5511 					diff[ name ] = value;
  1187 		options.at = "left top";
  5512 				}
       
  5513 			}
       
  5514 		}
       
  5515 	}
  1188 	}
  5516 
  1189 	targetWidth = dimensions.width;
  5517 	return diff;
  1190 	targetHeight = dimensions.height;
  5518 }
  1191 	targetOffset = dimensions.offset;
  5519 
  1192 	// clone to reuse original targetOffset later
  5520 // support: jQuery <1.8
  1193 	basePosition = $.extend( {}, targetOffset );
  5521 if ( !$.fn.addBack ) {
  1194 
  5522 	$.fn.addBack = function( selector ) {
  1195 	// force my and at to have valid horizontal and vertical positions
  5523 		return this.add( selector == null ?
  1196 	// if a value is missing or invalid, it will be converted to center
  5524 			this.prevObject : this.prevObject.filter( selector )
  1197 	$.each( [ "my", "at" ], function() {
  5525 		);
  1198 		var pos = ( options[ this ] || "" ).split( " " ),
  5526 	};
  1199 			horizontalOffset,
  5527 }
  1200 			verticalOffset;
  5528 
  1201 
  5529 $.effects.animateClass = function( value, duration, easing, callback ) {
  1202 		if ( pos.length === 1) {
  5530 	var o = $.speed( duration, easing, callback );
  1203 			pos = rhorizontal.test( pos[ 0 ] ) ?
  5531 
  1204 				pos.concat( [ "center" ] ) :
  5532 	return this.queue( function() {
  1205 				rvertical.test( pos[ 0 ] ) ?
  5533 		var animated = $( this ),
  1206 					[ "center" ].concat( pos ) :
  5534 			baseClass = animated.attr( "class" ) || "",
  1207 					[ "center", "center" ];
  5535 			applyClassChange,
  1208 		}
  5536 			allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
  1209 		pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
  5537 
  1210 		pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
  5538 		// map the animated objects to store the original styles.
  1211 
  5539 		allAnimations = allAnimations.map(function() {
  1212 		// calculate offsets
  5540 			var el = $( this );
  1213 		horizontalOffset = roffset.exec( pos[ 0 ] );
  5541 			return {
  1214 		verticalOffset = roffset.exec( pos[ 1 ] );
  5542 				el: el,
  1215 		offsets[ this ] = [
  5543 				start: getElementStyles( this )
  1216 			horizontalOffset ? horizontalOffset[ 0 ] : 0,
       
  1217 			verticalOffset ? verticalOffset[ 0 ] : 0
       
  1218 		];
       
  1219 
       
  1220 		// reduce to just the positions without the offsets
       
  1221 		options[ this ] = [
       
  1222 			rposition.exec( pos[ 0 ] )[ 0 ],
       
  1223 			rposition.exec( pos[ 1 ] )[ 0 ]
       
  1224 		];
       
  1225 	});
       
  1226 
       
  1227 	// normalize collision option
       
  1228 	if ( collision.length === 1 ) {
       
  1229 		collision[ 1 ] = collision[ 0 ];
       
  1230 	}
       
  1231 
       
  1232 	if ( options.at[ 0 ] === "right" ) {
       
  1233 		basePosition.left += targetWidth;
       
  1234 	} else if ( options.at[ 0 ] === "center" ) {
       
  1235 		basePosition.left += targetWidth / 2;
       
  1236 	}
       
  1237 
       
  1238 	if ( options.at[ 1 ] === "bottom" ) {
       
  1239 		basePosition.top += targetHeight;
       
  1240 	} else if ( options.at[ 1 ] === "center" ) {
       
  1241 		basePosition.top += targetHeight / 2;
       
  1242 	}
       
  1243 
       
  1244 	atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
       
  1245 	basePosition.left += atOffset[ 0 ];
       
  1246 	basePosition.top += atOffset[ 1 ];
       
  1247 
       
  1248 	return this.each(function() {
       
  1249 		var collisionPosition, using,
       
  1250 			elem = $( this ),
       
  1251 			elemWidth = elem.outerWidth(),
       
  1252 			elemHeight = elem.outerHeight(),
       
  1253 			marginLeft = parseCss( this, "marginLeft" ),
       
  1254 			marginTop = parseCss( this, "marginTop" ),
       
  1255 			collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
       
  1256 			collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
       
  1257 			position = $.extend( {}, basePosition ),
       
  1258 			myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
       
  1259 
       
  1260 		if ( options.my[ 0 ] === "right" ) {
       
  1261 			position.left -= elemWidth;
       
  1262 		} else if ( options.my[ 0 ] === "center" ) {
       
  1263 			position.left -= elemWidth / 2;
       
  1264 		}
       
  1265 
       
  1266 		if ( options.my[ 1 ] === "bottom" ) {
       
  1267 			position.top -= elemHeight;
       
  1268 		} else if ( options.my[ 1 ] === "center" ) {
       
  1269 			position.top -= elemHeight / 2;
       
  1270 		}
       
  1271 
       
  1272 		position.left += myOffset[ 0 ];
       
  1273 		position.top += myOffset[ 1 ];
       
  1274 
       
  1275 		// if the browser doesn't support fractions, then round for consistent results
       
  1276 		if ( !supportsOffsetFractions ) {
       
  1277 			position.left = round( position.left );
       
  1278 			position.top = round( position.top );
       
  1279 		}
       
  1280 
       
  1281 		collisionPosition = {
       
  1282 			marginLeft: marginLeft,
       
  1283 			marginTop: marginTop
       
  1284 		};
       
  1285 
       
  1286 		$.each( [ "left", "top" ], function( i, dir ) {
       
  1287 			if ( $.ui.position[ collision[ i ] ] ) {
       
  1288 				$.ui.position[ collision[ i ] ][ dir ]( position, {
       
  1289 					targetWidth: targetWidth,
       
  1290 					targetHeight: targetHeight,
       
  1291 					elemWidth: elemWidth,
       
  1292 					elemHeight: elemHeight,
       
  1293 					collisionPosition: collisionPosition,
       
  1294 					collisionWidth: collisionWidth,
       
  1295 					collisionHeight: collisionHeight,
       
  1296 					offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
       
  1297 					my: options.my,
       
  1298 					at: options.at,
       
  1299 					within: within,
       
  1300 					elem: elem
       
  1301 				});
       
  1302 			}
       
  1303 		});
       
  1304 
       
  1305 		if ( options.using ) {
       
  1306 			// adds feedback as second argument to using callback, if present
       
  1307 			using = function( props ) {
       
  1308 				var left = targetOffset.left - position.left,
       
  1309 					right = left + targetWidth - elemWidth,
       
  1310 					top = targetOffset.top - position.top,
       
  1311 					bottom = top + targetHeight - elemHeight,
       
  1312 					feedback = {
       
  1313 						target: {
       
  1314 							element: target,
       
  1315 							left: targetOffset.left,
       
  1316 							top: targetOffset.top,
       
  1317 							width: targetWidth,
       
  1318 							height: targetHeight
       
  1319 						},
       
  1320 						element: {
       
  1321 							element: elem,
       
  1322 							left: position.left,
       
  1323 							top: position.top,
       
  1324 							width: elemWidth,
       
  1325 							height: elemHeight
       
  1326 						},
       
  1327 						horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
       
  1328 						vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
       
  1329 					};
       
  1330 				if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
       
  1331 					feedback.horizontal = "center";
       
  1332 				}
       
  1333 				if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
       
  1334 					feedback.vertical = "middle";
       
  1335 				}
       
  1336 				if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
       
  1337 					feedback.important = "horizontal";
       
  1338 				} else {
       
  1339 					feedback.important = "vertical";
       
  1340 				}
       
  1341 				options.using.call( this, props, feedback );
  5544 			};
  1342 			};
  5545 		});
  1343 		}
  5546 
  1344 
  5547 		// apply class change
  1345 		elem.offset( $.extend( position, { using: using } ) );
  5548 		applyClassChange = function() {
       
  5549 			$.each( classAnimationActions, function(i, action) {
       
  5550 				if ( value[ action ] ) {
       
  5551 					animated[ action + "Class" ]( value[ action ] );
       
  5552 				}
       
  5553 			});
       
  5554 		};
       
  5555 		applyClassChange();
       
  5556 
       
  5557 		// map all animated objects again - calculate new styles and diff
       
  5558 		allAnimations = allAnimations.map(function() {
       
  5559 			this.end = getElementStyles( this.el[ 0 ] );
       
  5560 			this.diff = styleDifference( this.start, this.end );
       
  5561 			return this;
       
  5562 		});
       
  5563 
       
  5564 		// apply original class
       
  5565 		animated.attr( "class", baseClass );
       
  5566 
       
  5567 		// map all animated objects again - this time collecting a promise
       
  5568 		allAnimations = allAnimations.map(function() {
       
  5569 			var styleInfo = this,
       
  5570 				dfd = $.Deferred(),
       
  5571 				opts = $.extend({}, o, {
       
  5572 					queue: false,
       
  5573 					complete: function() {
       
  5574 						dfd.resolve( styleInfo );
       
  5575 					}
       
  5576 				});
       
  5577 
       
  5578 			this.el.animate( this.diff, opts );
       
  5579 			return dfd.promise();
       
  5580 		});
       
  5581 
       
  5582 		// once all animations have completed:
       
  5583 		$.when.apply( $, allAnimations.get() ).done(function() {
       
  5584 
       
  5585 			// set the final class
       
  5586 			applyClassChange();
       
  5587 
       
  5588 			// for each animated element,
       
  5589 			// clear all css properties that were animated
       
  5590 			$.each( arguments, function() {
       
  5591 				var el = this.el;
       
  5592 				$.each( this.diff, function(key) {
       
  5593 					el.css( key, "" );
       
  5594 				});
       
  5595 			});
       
  5596 
       
  5597 			// this is guarnteed to be there if you use jQuery.speed()
       
  5598 			// it also handles dequeuing the next anim...
       
  5599 			o.complete.call( animated[ 0 ] );
       
  5600 		});
       
  5601 	});
  1346 	});
  5602 };
  1347 };
  5603 
  1348 
  5604 $.fn.extend({
  1349 $.ui.position = {
  5605 	addClass: (function( orig ) {
  1350 	fit: {
  5606 		return function( classNames, speed, easing, callback ) {
  1351 		left: function( position, data ) {
  5607 			return speed ?
  1352 			var within = data.within,
  5608 				$.effects.animateClass.call( this,
  1353 				withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
  5609 					{ add: classNames }, speed, easing, callback ) :
  1354 				outerWidth = within.width,
  5610 				orig.apply( this, arguments );
  1355 				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  5611 		};
  1356 				overLeft = withinOffset - collisionPosLeft,
  5612 	})( $.fn.addClass ),
  1357 				overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
  5613 
  1358 				newOverRight;
  5614 	removeClass: (function( orig ) {
  1359 
  5615 		return function( classNames, speed, easing, callback ) {
  1360 			// element is wider than within
  5616 			return arguments.length > 1 ?
  1361 			if ( data.collisionWidth > outerWidth ) {
  5617 				$.effects.animateClass.call( this,
  1362 				// element is initially over the left side of within
  5618 					{ remove: classNames }, speed, easing, callback ) :
  1363 				if ( overLeft > 0 && overRight <= 0 ) {
  5619 				orig.apply( this, arguments );
  1364 					newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
  5620 		};
  1365 					position.left += overLeft - newOverRight;
  5621 	})( $.fn.removeClass ),
  1366 				// element is initially over right side of within
  5622 
  1367 				} else if ( overRight > 0 && overLeft <= 0 ) {
  5623 	toggleClass: (function( orig ) {
  1368 					position.left = withinOffset;
  5624 		return function( classNames, force, speed, easing, callback ) {
  1369 				// element is initially over both left and right sides of within
  5625 			if ( typeof force === "boolean" || force === undefined ) {
       
  5626 				if ( !speed ) {
       
  5627 					// without speed parameter
       
  5628 					return orig.apply( this, arguments );
       
  5629 				} else {
  1370 				} else {
  5630 					return $.effects.animateClass.call( this,
  1371 					if ( overLeft > overRight ) {
  5631 						(force ? { add: classNames } : { remove: classNames }),
  1372 						position.left = withinOffset + outerWidth - data.collisionWidth;
  5632 						speed, easing, callback );
  1373 					} else {
  5633 				}
  1374 						position.left = withinOffset;
       
  1375 					}
       
  1376 				}
       
  1377 			// too far left -> align with left edge
       
  1378 			} else if ( overLeft > 0 ) {
       
  1379 				position.left += overLeft;
       
  1380 			// too far right -> align with right edge
       
  1381 			} else if ( overRight > 0 ) {
       
  1382 				position.left -= overRight;
       
  1383 			// adjust based on position and margin
  5634 			} else {
  1384 			} else {
  5635 				// without force parameter
  1385 				position.left = max( position.left - collisionPosLeft, position.left );
  5636 				return $.effects.animateClass.call( this,
  1386 			}
  5637 					{ toggle: classNames }, force, speed, easing );
  1387 		},
  5638 			}
  1388 		top: function( position, data ) {
  5639 		};
  1389 			var within = data.within,
  5640 	})( $.fn.toggleClass ),
  1390 				withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
  5641 
  1391 				outerHeight = data.within.height,
  5642 	switchClass: function( remove, add, speed, easing, callback) {
  1392 				collisionPosTop = position.top - data.collisionPosition.marginTop,
  5643 		return $.effects.animateClass.call( this, {
  1393 				overTop = withinOffset - collisionPosTop,
  5644 			add: add,
  1394 				overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
  5645 			remove: remove
  1395 				newOverBottom;
  5646 		}, speed, easing, callback );
  1396 
       
  1397 			// element is taller than within
       
  1398 			if ( data.collisionHeight > outerHeight ) {
       
  1399 				// element is initially over the top of within
       
  1400 				if ( overTop > 0 && overBottom <= 0 ) {
       
  1401 					newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
       
  1402 					position.top += overTop - newOverBottom;
       
  1403 				// element is initially over bottom of within
       
  1404 				} else if ( overBottom > 0 && overTop <= 0 ) {
       
  1405 					position.top = withinOffset;
       
  1406 				// element is initially over both top and bottom of within
       
  1407 				} else {
       
  1408 					if ( overTop > overBottom ) {
       
  1409 						position.top = withinOffset + outerHeight - data.collisionHeight;
       
  1410 					} else {
       
  1411 						position.top = withinOffset;
       
  1412 					}
       
  1413 				}
       
  1414 			// too far up -> align with top
       
  1415 			} else if ( overTop > 0 ) {
       
  1416 				position.top += overTop;
       
  1417 			// too far down -> align with bottom edge
       
  1418 			} else if ( overBottom > 0 ) {
       
  1419 				position.top -= overBottom;
       
  1420 			// adjust based on position and margin
       
  1421 			} else {
       
  1422 				position.top = max( position.top - collisionPosTop, position.top );
       
  1423 			}
       
  1424 		}
       
  1425 	},
       
  1426 	flip: {
       
  1427 		left: function( position, data ) {
       
  1428 			var within = data.within,
       
  1429 				withinOffset = within.offset.left + within.scrollLeft,
       
  1430 				outerWidth = within.width,
       
  1431 				offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
       
  1432 				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
       
  1433 				overLeft = collisionPosLeft - offsetLeft,
       
  1434 				overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
       
  1435 				myOffset = data.my[ 0 ] === "left" ?
       
  1436 					-data.elemWidth :
       
  1437 					data.my[ 0 ] === "right" ?
       
  1438 						data.elemWidth :
       
  1439 						0,
       
  1440 				atOffset = data.at[ 0 ] === "left" ?
       
  1441 					data.targetWidth :
       
  1442 					data.at[ 0 ] === "right" ?
       
  1443 						-data.targetWidth :
       
  1444 						0,
       
  1445 				offset = -2 * data.offset[ 0 ],
       
  1446 				newOverRight,
       
  1447 				newOverLeft;
       
  1448 
       
  1449 			if ( overLeft < 0 ) {
       
  1450 				newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
       
  1451 				if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
       
  1452 					position.left += myOffset + atOffset + offset;
       
  1453 				}
       
  1454 			} else if ( overRight > 0 ) {
       
  1455 				newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
       
  1456 				if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
       
  1457 					position.left += myOffset + atOffset + offset;
       
  1458 				}
       
  1459 			}
       
  1460 		},
       
  1461 		top: function( position, data ) {
       
  1462 			var within = data.within,
       
  1463 				withinOffset = within.offset.top + within.scrollTop,
       
  1464 				outerHeight = within.height,
       
  1465 				offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
       
  1466 				collisionPosTop = position.top - data.collisionPosition.marginTop,
       
  1467 				overTop = collisionPosTop - offsetTop,
       
  1468 				overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
       
  1469 				top = data.my[ 1 ] === "top",
       
  1470 				myOffset = top ?
       
  1471 					-data.elemHeight :
       
  1472 					data.my[ 1 ] === "bottom" ?
       
  1473 						data.elemHeight :
       
  1474 						0,
       
  1475 				atOffset = data.at[ 1 ] === "top" ?
       
  1476 					data.targetHeight :
       
  1477 					data.at[ 1 ] === "bottom" ?
       
  1478 						-data.targetHeight :
       
  1479 						0,
       
  1480 				offset = -2 * data.offset[ 1 ],
       
  1481 				newOverTop,
       
  1482 				newOverBottom;
       
  1483 			if ( overTop < 0 ) {
       
  1484 				newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
       
  1485 				if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
       
  1486 					position.top += myOffset + atOffset + offset;
       
  1487 				}
       
  1488 			} else if ( overBottom > 0 ) {
       
  1489 				newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
       
  1490 				if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
       
  1491 					position.top += myOffset + atOffset + offset;
       
  1492 				}
       
  1493 			}
       
  1494 		}
       
  1495 	},
       
  1496 	flipfit: {
       
  1497 		left: function() {
       
  1498 			$.ui.position.flip.left.apply( this, arguments );
       
  1499 			$.ui.position.fit.left.apply( this, arguments );
       
  1500 		},
       
  1501 		top: function() {
       
  1502 			$.ui.position.flip.top.apply( this, arguments );
       
  1503 			$.ui.position.fit.top.apply( this, arguments );
       
  1504 		}
  5647 	}
  1505 	}
  5648 });
  1506 };
  5649 
  1507 
       
  1508 // fraction support test
       
  1509 (function() {
       
  1510 	var testElement, testElementParent, testElementStyle, offsetLeft, i,
       
  1511 		body = document.getElementsByTagName( "body" )[ 0 ],
       
  1512 		div = document.createElement( "div" );
       
  1513 
       
  1514 	//Create a "fake body" for testing based on method used in jQuery.support
       
  1515 	testElement = document.createElement( body ? "div" : "body" );
       
  1516 	testElementStyle = {
       
  1517 		visibility: "hidden",
       
  1518 		width: 0,
       
  1519 		height: 0,
       
  1520 		border: 0,
       
  1521 		margin: 0,
       
  1522 		background: "none"
       
  1523 	};
       
  1524 	if ( body ) {
       
  1525 		$.extend( testElementStyle, {
       
  1526 			position: "absolute",
       
  1527 			left: "-1000px",
       
  1528 			top: "-1000px"
       
  1529 		});
       
  1530 	}
       
  1531 	for ( i in testElementStyle ) {
       
  1532 		testElement.style[ i ] = testElementStyle[ i ];
       
  1533 	}
       
  1534 	testElement.appendChild( div );
       
  1535 	testElementParent = body || document.documentElement;
       
  1536 	testElementParent.insertBefore( testElement, testElementParent.firstChild );
       
  1537 
       
  1538 	div.style.cssText = "position: absolute; left: 10.7432222px;";
       
  1539 
       
  1540 	offsetLeft = $( div ).offset().left;
       
  1541 	supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11;
       
  1542 
       
  1543 	testElement.innerHTML = "";
       
  1544 	testElementParent.removeChild( testElement );
  5650 })();
  1545 })();
  5651 
  1546 
  5652 /******************************************************************************/
       
  5653 /*********************************** EFFECTS **********************************/
       
  5654 /******************************************************************************/
       
  5655 
       
  5656 (function() {
       
  5657 
       
  5658 $.extend( $.effects, {
       
  5659 	version: "1.10.3",
       
  5660 
       
  5661 	// Saves a set of properties in a data storage
       
  5662 	save: function( element, set ) {
       
  5663 		for( var i=0; i < set.length; i++ ) {
       
  5664 			if ( set[ i ] !== null ) {
       
  5665 				element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
       
  5666 			}
       
  5667 		}
       
  5668 	},
       
  5669 
       
  5670 	// Restores a set of previously saved properties from a data storage
       
  5671 	restore: function( element, set ) {
       
  5672 		var val, i;
       
  5673 		for( i=0; i < set.length; i++ ) {
       
  5674 			if ( set[ i ] !== null ) {
       
  5675 				val = element.data( dataSpace + set[ i ] );
       
  5676 				// support: jQuery 1.6.2
       
  5677 				// http://bugs.jquery.com/ticket/9917
       
  5678 				// jQuery 1.6.2 incorrectly returns undefined for any falsy value.
       
  5679 				// We can't differentiate between "" and 0 here, so we just assume
       
  5680 				// empty string since it's likely to be a more common value...
       
  5681 				if ( val === undefined ) {
       
  5682 					val = "";
       
  5683 				}
       
  5684 				element.css( set[ i ], val );
       
  5685 			}
       
  5686 		}
       
  5687 	},
       
  5688 
       
  5689 	setMode: function( el, mode ) {
       
  5690 		if (mode === "toggle") {
       
  5691 			mode = el.is( ":hidden" ) ? "show" : "hide";
       
  5692 		}
       
  5693 		return mode;
       
  5694 	},
       
  5695 
       
  5696 	// Translates a [top,left] array into a baseline value
       
  5697 	// this should be a little more flexible in the future to handle a string & hash
       
  5698 	getBaseline: function( origin, original ) {
       
  5699 		var y, x;
       
  5700 		switch ( origin[ 0 ] ) {
       
  5701 			case "top": y = 0; break;
       
  5702 			case "middle": y = 0.5; break;
       
  5703 			case "bottom": y = 1; break;
       
  5704 			default: y = origin[ 0 ] / original.height;
       
  5705 		}
       
  5706 		switch ( origin[ 1 ] ) {
       
  5707 			case "left": x = 0; break;
       
  5708 			case "center": x = 0.5; break;
       
  5709 			case "right": x = 1; break;
       
  5710 			default: x = origin[ 1 ] / original.width;
       
  5711 		}
       
  5712 		return {
       
  5713 			x: x,
       
  5714 			y: y
       
  5715 		};
       
  5716 	},
       
  5717 
       
  5718 	// Wraps the element around a wrapper that copies position properties
       
  5719 	createWrapper: function( element ) {
       
  5720 
       
  5721 		// if the element is already wrapped, return it
       
  5722 		if ( element.parent().is( ".ui-effects-wrapper" )) {
       
  5723 			return element.parent();
       
  5724 		}
       
  5725 
       
  5726 		// wrap the element
       
  5727 		var props = {
       
  5728 				width: element.outerWidth(true),
       
  5729 				height: element.outerHeight(true),
       
  5730 				"float": element.css( "float" )
       
  5731 			},
       
  5732 			wrapper = $( "<div></div>" )
       
  5733 				.addClass( "ui-effects-wrapper" )
       
  5734 				.css({
       
  5735 					fontSize: "100%",
       
  5736 					background: "transparent",
       
  5737 					border: "none",
       
  5738 					margin: 0,
       
  5739 					padding: 0
       
  5740 				}),
       
  5741 			// Store the size in case width/height are defined in % - Fixes #5245
       
  5742 			size = {
       
  5743 				width: element.width(),
       
  5744 				height: element.height()
       
  5745 			},
       
  5746 			active = document.activeElement;
       
  5747 
       
  5748 		// support: Firefox
       
  5749 		// Firefox incorrectly exposes anonymous content
       
  5750 		// https://bugzilla.mozilla.org/show_bug.cgi?id=561664
       
  5751 		try {
       
  5752 			active.id;
       
  5753 		} catch( e ) {
       
  5754 			active = document.body;
       
  5755 		}
       
  5756 
       
  5757 		element.wrap( wrapper );
       
  5758 
       
  5759 		// Fixes #7595 - Elements lose focus when wrapped.
       
  5760 		if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
       
  5761 			$( active ).focus();
       
  5762 		}
       
  5763 
       
  5764 		wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
       
  5765 
       
  5766 		// transfer positioning properties to the wrapper
       
  5767 		if ( element.css( "position" ) === "static" ) {
       
  5768 			wrapper.css({ position: "relative" });
       
  5769 			element.css({ position: "relative" });
       
  5770 		} else {
       
  5771 			$.extend( props, {
       
  5772 				position: element.css( "position" ),
       
  5773 				zIndex: element.css( "z-index" )
       
  5774 			});
       
  5775 			$.each([ "top", "left", "bottom", "right" ], function(i, pos) {
       
  5776 				props[ pos ] = element.css( pos );
       
  5777 				if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
       
  5778 					props[ pos ] = "auto";
       
  5779 				}
       
  5780 			});
       
  5781 			element.css({
       
  5782 				position: "relative",
       
  5783 				top: 0,
       
  5784 				left: 0,
       
  5785 				right: "auto",
       
  5786 				bottom: "auto"
       
  5787 			});
       
  5788 		}
       
  5789 		element.css(size);
       
  5790 
       
  5791 		return wrapper.css( props ).show();
       
  5792 	},
       
  5793 
       
  5794 	removeWrapper: function( element ) {
       
  5795 		var active = document.activeElement;
       
  5796 
       
  5797 		if ( element.parent().is( ".ui-effects-wrapper" ) ) {
       
  5798 			element.parent().replaceWith( element );
       
  5799 
       
  5800 			// Fixes #7595 - Elements lose focus when wrapped.
       
  5801 			if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
       
  5802 				$( active ).focus();
       
  5803 			}
       
  5804 		}
       
  5805 
       
  5806 
       
  5807 		return element;
       
  5808 	},
       
  5809 
       
  5810 	setTransition: function( element, list, factor, value ) {
       
  5811 		value = value || {};
       
  5812 		$.each( list, function( i, x ) {
       
  5813 			var unit = element.cssUnit( x );
       
  5814 			if ( unit[ 0 ] > 0 ) {
       
  5815 				value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
       
  5816 			}
       
  5817 		});
       
  5818 		return value;
       
  5819 	}
       
  5820 });
       
  5821 
       
  5822 // return an effect options object for the given parameters:
       
  5823 function _normalizeArguments( effect, options, speed, callback ) {
       
  5824 
       
  5825 	// allow passing all options as the first parameter
       
  5826 	if ( $.isPlainObject( effect ) ) {
       
  5827 		options = effect;
       
  5828 		effect = effect.effect;
       
  5829 	}
       
  5830 
       
  5831 	// convert to an object
       
  5832 	effect = { effect: effect };
       
  5833 
       
  5834 	// catch (effect, null, ...)
       
  5835 	if ( options == null ) {
       
  5836 		options = {};
       
  5837 	}
       
  5838 
       
  5839 	// catch (effect, callback)
       
  5840 	if ( $.isFunction( options ) ) {
       
  5841 		callback = options;
       
  5842 		speed = null;
       
  5843 		options = {};
       
  5844 	}
       
  5845 
       
  5846 	// catch (effect, speed, ?)
       
  5847 	if ( typeof options === "number" || $.fx.speeds[ options ] ) {
       
  5848 		callback = speed;
       
  5849 		speed = options;
       
  5850 		options = {};
       
  5851 	}
       
  5852 
       
  5853 	// catch (effect, options, callback)
       
  5854 	if ( $.isFunction( speed ) ) {
       
  5855 		callback = speed;
       
  5856 		speed = null;
       
  5857 	}
       
  5858 
       
  5859 	// add options to effect
       
  5860 	if ( options ) {
       
  5861 		$.extend( effect, options );
       
  5862 	}
       
  5863 
       
  5864 	speed = speed || options.duration;
       
  5865 	effect.duration = $.fx.off ? 0 :
       
  5866 		typeof speed === "number" ? speed :
       
  5867 		speed in $.fx.speeds ? $.fx.speeds[ speed ] :
       
  5868 		$.fx.speeds._default;
       
  5869 
       
  5870 	effect.complete = callback || options.complete;
       
  5871 
       
  5872 	return effect;
       
  5873 }
       
  5874 
       
  5875 function standardAnimationOption( option ) {
       
  5876 	// Valid standard speeds (nothing, number, named speed)
       
  5877 	if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
       
  5878 		return true;
       
  5879 	}
       
  5880 
       
  5881 	// Invalid strings - treat as "normal" speed
       
  5882 	if ( typeof option === "string" && !$.effects.effect[ option ] ) {
       
  5883 		return true;
       
  5884 	}
       
  5885 
       
  5886 	// Complete callback
       
  5887 	if ( $.isFunction( option ) ) {
       
  5888 		return true;
       
  5889 	}
       
  5890 
       
  5891 	// Options hash (but not naming an effect)
       
  5892 	if ( typeof option === "object" && !option.effect ) {
       
  5893 		return true;
       
  5894 	}
       
  5895 
       
  5896 	// Didn't match any standard API
       
  5897 	return false;
       
  5898 }
       
  5899 
       
  5900 $.fn.extend({
       
  5901 	effect: function( /* effect, options, speed, callback */ ) {
       
  5902 		var args = _normalizeArguments.apply( this, arguments ),
       
  5903 			mode = args.mode,
       
  5904 			queue = args.queue,
       
  5905 			effectMethod = $.effects.effect[ args.effect ];
       
  5906 
       
  5907 		if ( $.fx.off || !effectMethod ) {
       
  5908 			// delegate to the original method (e.g., .show()) if possible
       
  5909 			if ( mode ) {
       
  5910 				return this[ mode ]( args.duration, args.complete );
       
  5911 			} else {
       
  5912 				return this.each( function() {
       
  5913 					if ( args.complete ) {
       
  5914 						args.complete.call( this );
       
  5915 					}
       
  5916 				});
       
  5917 			}
       
  5918 		}
       
  5919 
       
  5920 		function run( next ) {
       
  5921 			var elem = $( this ),
       
  5922 				complete = args.complete,
       
  5923 				mode = args.mode;
       
  5924 
       
  5925 			function done() {
       
  5926 				if ( $.isFunction( complete ) ) {
       
  5927 					complete.call( elem[0] );
       
  5928 				}
       
  5929 				if ( $.isFunction( next ) ) {
       
  5930 					next();
       
  5931 				}
       
  5932 			}
       
  5933 
       
  5934 			// If the element already has the correct final state, delegate to
       
  5935 			// the core methods so the internal tracking of "olddisplay" works.
       
  5936 			if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
       
  5937 				elem[ mode ]();
       
  5938 				done();
       
  5939 			} else {
       
  5940 				effectMethod.call( elem[0], args, done );
       
  5941 			}
       
  5942 		}
       
  5943 
       
  5944 		return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
       
  5945 	},
       
  5946 
       
  5947 	show: (function( orig ) {
       
  5948 		return function( option ) {
       
  5949 			if ( standardAnimationOption( option ) ) {
       
  5950 				return orig.apply( this, arguments );
       
  5951 			} else {
       
  5952 				var args = _normalizeArguments.apply( this, arguments );
       
  5953 				args.mode = "show";
       
  5954 				return this.effect.call( this, args );
       
  5955 			}
       
  5956 		};
       
  5957 	})( $.fn.show ),
       
  5958 
       
  5959 	hide: (function( orig ) {
       
  5960 		return function( option ) {
       
  5961 			if ( standardAnimationOption( option ) ) {
       
  5962 				return orig.apply( this, arguments );
       
  5963 			} else {
       
  5964 				var args = _normalizeArguments.apply( this, arguments );
       
  5965 				args.mode = "hide";
       
  5966 				return this.effect.call( this, args );
       
  5967 			}
       
  5968 		};
       
  5969 	})( $.fn.hide ),
       
  5970 
       
  5971 	toggle: (function( orig ) {
       
  5972 		return function( option ) {
       
  5973 			if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
       
  5974 				return orig.apply( this, arguments );
       
  5975 			} else {
       
  5976 				var args = _normalizeArguments.apply( this, arguments );
       
  5977 				args.mode = "toggle";
       
  5978 				return this.effect.call( this, args );
       
  5979 			}
       
  5980 		};
       
  5981 	})( $.fn.toggle ),
       
  5982 
       
  5983 	// helper functions
       
  5984 	cssUnit: function(key) {
       
  5985 		var style = this.css( key ),
       
  5986 			val = [];
       
  5987 
       
  5988 		$.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
       
  5989 			if ( style.indexOf( unit ) > 0 ) {
       
  5990 				val = [ parseFloat( style ), unit ];
       
  5991 			}
       
  5992 		});
       
  5993 		return val;
       
  5994 	}
       
  5995 });
       
  5996 
       
  5997 })();
  1547 })();
  5998 
  1548 
  5999 /******************************************************************************/
  1549 var position = $.ui.position;
  6000 /*********************************** EASING ***********************************/
  1550 
  6001 /******************************************************************************/
  1551 
  6002 
  1552 /*!
  6003 (function() {
  1553  * jQuery UI Accordion 1.11.4
  6004 
  1554  * http://jqueryui.com
  6005 // based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
  1555  *
  6006 
  1556  * Copyright jQuery Foundation and other contributors
  6007 var baseEasings = {};
  1557  * Released under the MIT license.
  6008 
  1558  * http://jquery.org/license
  6009 $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
  1559  *
  6010 	baseEasings[ name ] = function( p ) {
  1560  * http://api.jqueryui.com/accordion/
  6011 		return Math.pow( p, i + 2 );
  1561  */
  6012 	};
  1562 
  6013 });
  1563 
  6014 
  1564 var accordion = $.widget( "ui.accordion", {
  6015 $.extend( baseEasings, {
  1565 	version: "1.11.4",
  6016 	Sine: function ( p ) {
       
  6017 		return 1 - Math.cos( p * Math.PI / 2 );
       
  6018 	},
       
  6019 	Circ: function ( p ) {
       
  6020 		return 1 - Math.sqrt( 1 - p * p );
       
  6021 	},
       
  6022 	Elastic: function( p ) {
       
  6023 		return p === 0 || p === 1 ? p :
       
  6024 			-Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
       
  6025 	},
       
  6026 	Back: function( p ) {
       
  6027 		return p * p * ( 3 * p - 2 );
       
  6028 	},
       
  6029 	Bounce: function ( p ) {
       
  6030 		var pow2,
       
  6031 			bounce = 4;
       
  6032 
       
  6033 		while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
       
  6034 		return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
       
  6035 	}
       
  6036 });
       
  6037 
       
  6038 $.each( baseEasings, function( name, easeIn ) {
       
  6039 	$.easing[ "easeIn" + name ] = easeIn;
       
  6040 	$.easing[ "easeOut" + name ] = function( p ) {
       
  6041 		return 1 - easeIn( 1 - p );
       
  6042 	};
       
  6043 	$.easing[ "easeInOut" + name ] = function( p ) {
       
  6044 		return p < 0.5 ?
       
  6045 			easeIn( p * 2 ) / 2 :
       
  6046 			1 - easeIn( p * -2 + 2 ) / 2;
       
  6047 	};
       
  6048 });
       
  6049 
       
  6050 })();
       
  6051 
       
  6052 })(jQuery);
       
  6053 
       
  6054 (function( $, undefined ) {
       
  6055 
       
  6056 var uid = 0,
       
  6057 	hideProps = {},
       
  6058 	showProps = {};
       
  6059 
       
  6060 hideProps.height = hideProps.paddingTop = hideProps.paddingBottom =
       
  6061 	hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide";
       
  6062 showProps.height = showProps.paddingTop = showProps.paddingBottom =
       
  6063 	showProps.borderTopWidth = showProps.borderBottomWidth = "show";
       
  6064 
       
  6065 $.widget( "ui.accordion", {
       
  6066 	version: "1.10.3",
       
  6067 	options: {
  1566 	options: {
  6068 		active: 0,
  1567 		active: 0,
  6069 		animate: {},
  1568 		animate: {},
  6070 		collapsible: false,
  1569 		collapsible: false,
  6071 		event: "click",
  1570 		event: "click",
  6079 		// callbacks
  1578 		// callbacks
  6080 		activate: null,
  1579 		activate: null,
  6081 		beforeActivate: null
  1580 		beforeActivate: null
  6082 	},
  1581 	},
  6083 
  1582 
       
  1583 	hideProps: {
       
  1584 		borderTopWidth: "hide",
       
  1585 		borderBottomWidth: "hide",
       
  1586 		paddingTop: "hide",
       
  1587 		paddingBottom: "hide",
       
  1588 		height: "hide"
       
  1589 	},
       
  1590 
       
  1591 	showProps: {
       
  1592 		borderTopWidth: "show",
       
  1593 		borderBottomWidth: "show",
       
  1594 		paddingTop: "show",
       
  1595 		paddingBottom: "show",
       
  1596 		height: "show"
       
  1597 	},
       
  1598 
  6084 	_create: function() {
  1599 	_create: function() {
  6085 		var options = this.options;
  1600 		var options = this.options;
  6086 		this.prevShow = this.prevHide = $();
  1601 		this.prevShow = this.prevHide = $();
  6087 		this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
  1602 		this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
  6088 			// ARIA
  1603 			// ARIA
  6102 	},
  1617 	},
  6103 
  1618 
  6104 	_getCreateEventData: function() {
  1619 	_getCreateEventData: function() {
  6105 		return {
  1620 		return {
  6106 			header: this.active,
  1621 			header: this.active,
  6107 			panel: !this.active.length ? $() : this.active.next(),
  1622 			panel: !this.active.length ? $() : this.active.next()
  6108 			content: !this.active.length ? $() : this.active.next()
       
  6109 		};
  1623 		};
  6110 	},
  1624 	},
  6111 
  1625 
  6112 	_createIcons: function() {
  1626 	_createIcons: function() {
  6113 		var icons = this.options.icons;
  1627 		var icons = this.options.icons;
  6137 			.removeClass( "ui-accordion ui-widget ui-helper-reset" )
  1651 			.removeClass( "ui-accordion ui-widget ui-helper-reset" )
  6138 			.removeAttr( "role" );
  1652 			.removeAttr( "role" );
  6139 
  1653 
  6140 		// clean up headers
  1654 		// clean up headers
  6141 		this.headers
  1655 		this.headers
  6142 			.removeClass( "ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
  1656 			.removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " +
       
  1657 				"ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
  6143 			.removeAttr( "role" )
  1658 			.removeAttr( "role" )
       
  1659 			.removeAttr( "aria-expanded" )
  6144 			.removeAttr( "aria-selected" )
  1660 			.removeAttr( "aria-selected" )
  6145 			.removeAttr( "aria-controls" )
  1661 			.removeAttr( "aria-controls" )
  6146 			.removeAttr( "tabIndex" )
  1662 			.removeAttr( "tabIndex" )
  6147 			.each(function() {
  1663 			.removeUniqueId();
  6148 				if ( /^ui-accordion/.test( this.id ) ) {
  1664 
  6149 					this.removeAttribute( "id" );
       
  6150 				}
       
  6151 			});
       
  6152 		this._destroyIcons();
  1665 		this._destroyIcons();
  6153 
  1666 
  6154 		// clean up content panels
  1667 		// clean up content panels
  6155 		contents = this.headers.next()
  1668 		contents = this.headers.next()
       
  1669 			.removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " +
       
  1670 				"ui-accordion-content ui-accordion-content-active ui-state-disabled" )
  6156 			.css( "display", "" )
  1671 			.css( "display", "" )
  6157 			.removeAttr( "role" )
  1672 			.removeAttr( "role" )
  6158 			.removeAttr( "aria-expanded" )
       
  6159 			.removeAttr( "aria-hidden" )
  1673 			.removeAttr( "aria-hidden" )
  6160 			.removeAttr( "aria-labelledby" )
  1674 			.removeAttr( "aria-labelledby" )
  6161 			.removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" )
  1675 			.removeUniqueId();
  6162 			.each(function() {
  1676 
  6163 				if ( /^ui-accordion/.test( this.id ) ) {
       
  6164 					this.removeAttribute( "id" );
       
  6165 				}
       
  6166 			});
       
  6167 		if ( this.options.heightStyle !== "content" ) {
  1677 		if ( this.options.heightStyle !== "content" ) {
  6168 			contents.css( "height", "" );
  1678 			contents.css( "height", "" );
  6169 		}
  1679 		}
  6170 	},
  1680 	},
  6171 
  1681 
  6198 		}
  1708 		}
  6199 
  1709 
  6200 		// #5332 - opacity doesn't cascade to positioned elements in IE
  1710 		// #5332 - opacity doesn't cascade to positioned elements in IE
  6201 		// so we need to add the disabled class to the headers and panels
  1711 		// so we need to add the disabled class to the headers and panels
  6202 		if ( key === "disabled" ) {
  1712 		if ( key === "disabled" ) {
       
  1713 			this.element
       
  1714 				.toggleClass( "ui-state-disabled", !!value )
       
  1715 				.attr( "aria-disabled", value );
  6203 			this.headers.add( this.headers.next() )
  1716 			this.headers.add( this.headers.next() )
  6204 				.toggleClass( "ui-state-disabled", !!value );
  1717 				.toggleClass( "ui-state-disabled", !!value );
  6205 		}
  1718 		}
  6206 	},
  1719 	},
  6207 
  1720 
  6208 	_keydown: function( event ) {
  1721 	_keydown: function( event ) {
  6209 		/*jshint maxcomplexity:15*/
       
  6210 		if ( event.altKey || event.ctrlKey ) {
  1722 		if ( event.altKey || event.ctrlKey ) {
  6211 			return;
  1723 			return;
  6212 		}
  1724 		}
  6213 
  1725 
  6214 		var keyCode = $.ui.keyCode,
  1726 		var keyCode = $.ui.keyCode,
  6243 			toFocus.focus();
  1755 			toFocus.focus();
  6244 			event.preventDefault();
  1756 			event.preventDefault();
  6245 		}
  1757 		}
  6246 	},
  1758 	},
  6247 
  1759 
  6248 	_panelKeyDown : function( event ) {
  1760 	_panelKeyDown: function( event ) {
  6249 		if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
  1761 		if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
  6250 			$( event.currentTarget ).prev().focus();
  1762 			$( event.currentTarget ).prev().focus();
  6251 		}
  1763 		}
  6252 	},
  1764 	},
  6253 
  1765 
  6282 
  1794 
  6283 		this._refresh();
  1795 		this._refresh();
  6284 	},
  1796 	},
  6285 
  1797 
  6286 	_processPanels: function() {
  1798 	_processPanels: function() {
       
  1799 		var prevHeaders = this.headers,
       
  1800 			prevPanels = this.panels;
       
  1801 
  6287 		this.headers = this.element.find( this.options.header )
  1802 		this.headers = this.element.find( this.options.header )
  6288 			.addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" );
  1803 			.addClass( "ui-accordion-header ui-state-default ui-corner-all" );
  6289 
  1804 
  6290 		this.headers.next()
  1805 		this.panels = this.headers.next()
  6291 			.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
  1806 			.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
  6292 			.filter(":not(.ui-accordion-content-active)")
  1807 			.filter( ":not(.ui-accordion-content-active)" )
  6293 			.hide();
  1808 			.hide();
       
  1809 
       
  1810 		// Avoid memory leaks (#10056)
       
  1811 		if ( prevPanels ) {
       
  1812 			this._off( prevHeaders.not( this.headers ) );
       
  1813 			this._off( prevPanels.not( this.panels ) );
       
  1814 		}
  6294 	},
  1815 	},
  6295 
  1816 
  6296 	_refresh: function() {
  1817 	_refresh: function() {
  6297 		var maxHeight,
  1818 		var maxHeight,
  6298 			options = this.options,
  1819 			options = this.options,
  6299 			heightStyle = options.heightStyle,
  1820 			heightStyle = options.heightStyle,
  6300 			parent = this.element.parent(),
  1821 			parent = this.element.parent();
  6301 			accordionId = this.accordionId = "ui-accordion-" +
       
  6302 				(this.element.attr( "id" ) || ++uid);
       
  6303 
  1822 
  6304 		this.active = this._findActive( options.active )
  1823 		this.active = this._findActive( options.active )
  6305 			.addClass( "ui-accordion-header-active ui-state-active ui-corner-top" )
  1824 			.addClass( "ui-accordion-header-active ui-state-active ui-corner-top" )
  6306 			.removeClass( "ui-corner-all" );
  1825 			.removeClass( "ui-corner-all" );
  6307 		this.active.next()
  1826 		this.active.next()
  6308 			.addClass( "ui-accordion-content-active" )
  1827 			.addClass( "ui-accordion-content-active" )
  6309 			.show();
  1828 			.show();
  6310 
  1829 
  6311 		this.headers
  1830 		this.headers
  6312 			.attr( "role", "tab" )
  1831 			.attr( "role", "tab" )
  6313 			.each(function( i ) {
  1832 			.each(function() {
  6314 				var header = $( this ),
  1833 				var header = $( this ),
  6315 					headerId = header.attr( "id" ),
  1834 					headerId = header.uniqueId().attr( "id" ),
  6316 					panel = header.next(),
  1835 					panel = header.next(),
  6317 					panelId = panel.attr( "id" );
  1836 					panelId = panel.uniqueId().attr( "id" );
  6318 				if ( !headerId ) {
       
  6319 					headerId = accordionId + "-header-" + i;
       
  6320 					header.attr( "id", headerId );
       
  6321 				}
       
  6322 				if ( !panelId ) {
       
  6323 					panelId = accordionId + "-panel-" + i;
       
  6324 					panel.attr( "id", panelId );
       
  6325 				}
       
  6326 				header.attr( "aria-controls", panelId );
  1837 				header.attr( "aria-controls", panelId );
  6327 				panel.attr( "aria-labelledby", headerId );
  1838 				panel.attr( "aria-labelledby", headerId );
  6328 			})
  1839 			})
  6329 			.next()
  1840 			.next()
  6330 				.attr( "role", "tabpanel" );
  1841 				.attr( "role", "tabpanel" );
  6331 
  1842 
  6332 		this.headers
  1843 		this.headers
  6333 			.not( this.active )
  1844 			.not( this.active )
  6334 			.attr({
  1845 			.attr({
  6335 				"aria-selected": "false",
  1846 				"aria-selected": "false",
       
  1847 				"aria-expanded": "false",
  6336 				tabIndex: -1
  1848 				tabIndex: -1
  6337 			})
  1849 			})
  6338 			.next()
  1850 			.next()
  6339 				.attr({
  1851 				.attr({
  6340 					"aria-expanded": "false",
       
  6341 					"aria-hidden": "true"
  1852 					"aria-hidden": "true"
  6342 				})
  1853 				})
  6343 				.hide();
  1854 				.hide();
  6344 
  1855 
  6345 		// make sure at least one header is in the tab order
  1856 		// make sure at least one header is in the tab order
  6346 		if ( !this.active.length ) {
  1857 		if ( !this.active.length ) {
  6347 			this.headers.eq( 0 ).attr( "tabIndex", 0 );
  1858 			this.headers.eq( 0 ).attr( "tabIndex", 0 );
  6348 		} else {
  1859 		} else {
  6349 			this.active.attr({
  1860 			this.active.attr({
  6350 				"aria-selected": "true",
  1861 				"aria-selected": "true",
       
  1862 				"aria-expanded": "true",
  6351 				tabIndex: 0
  1863 				tabIndex: 0
  6352 			})
  1864 			})
  6353 			.next()
  1865 			.next()
  6354 				.attr({
  1866 				.attr({
  6355 					"aria-expanded": "true",
       
  6356 					"aria-hidden": "false"
  1867 					"aria-hidden": "false"
  6357 				});
  1868 				});
  6358 		}
  1869 		}
  6359 
  1870 
  6360 		this._createIcons();
  1871 		this._createIcons();
  6418 	_setupEvents: function( event ) {
  1929 	_setupEvents: function( event ) {
  6419 		var events = {
  1930 		var events = {
  6420 			keydown: "_keydown"
  1931 			keydown: "_keydown"
  6421 		};
  1932 		};
  6422 		if ( event ) {
  1933 		if ( event ) {
  6423 			$.each( event.split(" "), function( index, eventName ) {
  1934 			$.each( event.split( " " ), function( index, eventName ) {
  6424 				events[ eventName ] = "_eventHandler";
  1935 				events[ eventName ] = "_eventHandler";
  6425 			});
  1936 			});
  6426 		}
  1937 		}
  6427 
  1938 
  6428 		this._off( this.headers.add( this.headers.next() ) );
  1939 		this._off( this.headers.add( this.headers.next() ) );
  6505 			toShow.show();
  2016 			toShow.show();
  6506 			this._toggleComplete( data );
  2017 			this._toggleComplete( data );
  6507 		}
  2018 		}
  6508 
  2019 
  6509 		toHide.attr({
  2020 		toHide.attr({
  6510 			"aria-expanded": "false",
       
  6511 			"aria-hidden": "true"
  2021 			"aria-hidden": "true"
  6512 		});
  2022 		});
  6513 		toHide.prev().attr( "aria-selected", "false" );
  2023 		toHide.prev().attr({
       
  2024 			"aria-selected": "false",
       
  2025 			"aria-expanded": "false"
       
  2026 		});
  6514 		// if we're switching panels, remove the old header from the tab order
  2027 		// if we're switching panels, remove the old header from the tab order
  6515 		// if we're opening from collapsed state, remove the previous header from the tab order
  2028 		// if we're opening from collapsed state, remove the previous header from the tab order
  6516 		// if we're collapsing, then keep the collapsing header in the tab order
  2029 		// if we're collapsing, then keep the collapsing header in the tab order
  6517 		if ( toShow.length && toHide.length ) {
  2030 		if ( toShow.length && toHide.length ) {
  6518 			toHide.prev().attr( "tabIndex", -1 );
  2031 			toHide.prev().attr({
       
  2032 				"tabIndex": -1,
       
  2033 				"aria-expanded": "false"
       
  2034 			});
  6519 		} else if ( toShow.length ) {
  2035 		} else if ( toShow.length ) {
  6520 			this.headers.filter(function() {
  2036 			this.headers.filter(function() {
  6521 				return $( this ).attr( "tabIndex" ) === 0;
  2037 				return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
  6522 			})
  2038 			})
  6523 			.attr( "tabIndex", -1 );
  2039 			.attr( "tabIndex", -1 );
  6524 		}
  2040 		}
  6525 
  2041 
  6526 		toShow
  2042 		toShow
  6527 			.attr({
  2043 			.attr( "aria-hidden", "false" )
  6528 				"aria-expanded": "true",
       
  6529 				"aria-hidden": "false"
       
  6530 			})
       
  6531 			.prev()
  2044 			.prev()
  6532 				.attr({
  2045 				.attr({
  6533 					"aria-selected": "true",
  2046 					"aria-selected": "true",
       
  2047 					"aria-expanded": "true",
  6534 					tabIndex: 0
  2048 					tabIndex: 0
  6535 				});
  2049 				});
  6536 	},
  2050 	},
  6537 
  2051 
  6538 	_animate: function( toShow, toHide, data ) {
  2052 	_animate: function( toShow, toHide, data ) {
  6539 		var total, easing, duration,
  2053 		var total, easing, duration,
  6540 			that = this,
  2054 			that = this,
  6541 			adjust = 0,
  2055 			adjust = 0,
       
  2056 			boxSizing = toShow.css( "box-sizing" ),
  6542 			down = toShow.length &&
  2057 			down = toShow.length &&
  6543 				( !toHide.length || ( toShow.index() < toHide.index() ) ),
  2058 				( !toHide.length || ( toShow.index() < toHide.index() ) ),
  6544 			animate = this.options.animate || {},
  2059 			animate = this.options.animate || {},
  6545 			options = down && animate.down || animate,
  2060 			options = down && animate.down || animate,
  6546 			complete = function() {
  2061 			complete = function() {
  6556 		// fall back from options to animation in case of partial down settings
  2071 		// fall back from options to animation in case of partial down settings
  6557 		easing = easing || options.easing || animate.easing;
  2072 		easing = easing || options.easing || animate.easing;
  6558 		duration = duration || options.duration || animate.duration;
  2073 		duration = duration || options.duration || animate.duration;
  6559 
  2074 
  6560 		if ( !toHide.length ) {
  2075 		if ( !toHide.length ) {
  6561 			return toShow.animate( showProps, duration, easing, complete );
  2076 			return toShow.animate( this.showProps, duration, easing, complete );
  6562 		}
  2077 		}
  6563 		if ( !toShow.length ) {
  2078 		if ( !toShow.length ) {
  6564 			return toHide.animate( hideProps, duration, easing, complete );
  2079 			return toHide.animate( this.hideProps, duration, easing, complete );
  6565 		}
  2080 		}
  6566 
  2081 
  6567 		total = toShow.show().outerHeight();
  2082 		total = toShow.show().outerHeight();
  6568 		toHide.animate( hideProps, {
  2083 		toHide.animate( this.hideProps, {
  6569 			duration: duration,
  2084 			duration: duration,
  6570 			easing: easing,
  2085 			easing: easing,
  6571 			step: function( now, fx ) {
  2086 			step: function( now, fx ) {
  6572 				fx.now = Math.round( now );
  2087 				fx.now = Math.round( now );
  6573 			}
  2088 			}
  6574 		});
  2089 		});
  6575 		toShow
  2090 		toShow
  6576 			.hide()
  2091 			.hide()
  6577 			.animate( showProps, {
  2092 			.animate( this.showProps, {
  6578 				duration: duration,
  2093 				duration: duration,
  6579 				easing: easing,
  2094 				easing: easing,
  6580 				complete: complete,
  2095 				complete: complete,
  6581 				step: function( now, fx ) {
  2096 				step: function( now, fx ) {
  6582 					fx.now = Math.round( now );
  2097 					fx.now = Math.round( now );
  6583 					if ( fx.prop !== "height" ) {
  2098 					if ( fx.prop !== "height" ) {
  6584 						adjust += fx.now;
  2099 						if ( boxSizing === "content-box" ) {
       
  2100 							adjust += fx.now;
       
  2101 						}
  6585 					} else if ( that.options.heightStyle !== "content" ) {
  2102 					} else if ( that.options.heightStyle !== "content" ) {
  6586 						fx.now = Math.round( total - toHide.outerHeight() - adjust );
  2103 						fx.now = Math.round( total - toHide.outerHeight() - adjust );
  6587 						adjust = 0;
  2104 						adjust = 0;
  6588 					}
  2105 					}
  6589 				}
  2106 				}
  6599 				.removeClass( "ui-corner-top" )
  2116 				.removeClass( "ui-corner-top" )
  6600 				.addClass( "ui-corner-all" );
  2117 				.addClass( "ui-corner-all" );
  6601 
  2118 
  6602 		// Work around for rendering bug in IE (#5421)
  2119 		// Work around for rendering bug in IE (#5421)
  6603 		if ( toHide.length ) {
  2120 		if ( toHide.length ) {
  6604 			toHide.parent()[0].className = toHide.parent()[0].className;
  2121 			toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
  6605 		}
  2122 		}
  6606 
       
  6607 		this._trigger( "activate", null, data );
  2123 		this._trigger( "activate", null, data );
  6608 	}
  2124 	}
  6609 });
  2125 });
  6610 
  2126 
  6611 })( jQuery );
  2127 
  6612 
  2128 /*!
  6613 (function( $, undefined ) {
  2129  * jQuery UI Menu 1.11.4
  6614 
  2130  * http://jqueryui.com
  6615 // used to prevent race conditions with remote data sources
  2131  *
  6616 var requestIndex = 0;
  2132  * Copyright jQuery Foundation and other contributors
       
  2133  * Released under the MIT license.
       
  2134  * http://jquery.org/license
       
  2135  *
       
  2136  * http://api.jqueryui.com/menu/
       
  2137  */
       
  2138 
       
  2139 
       
  2140 var menu = $.widget( "ui.menu", {
       
  2141 	version: "1.11.4",
       
  2142 	defaultElement: "<ul>",
       
  2143 	delay: 300,
       
  2144 	options: {
       
  2145 		icons: {
       
  2146 			submenu: "ui-icon-carat-1-e"
       
  2147 		},
       
  2148 		items: "> *",
       
  2149 		menus: "ul",
       
  2150 		position: {
       
  2151 			my: "left-1 top",
       
  2152 			at: "right top"
       
  2153 		},
       
  2154 		role: "menu",
       
  2155 
       
  2156 		// callbacks
       
  2157 		blur: null,
       
  2158 		focus: null,
       
  2159 		select: null
       
  2160 	},
       
  2161 
       
  2162 	_create: function() {
       
  2163 		this.activeMenu = this.element;
       
  2164 
       
  2165 		// Flag used to prevent firing of the click handler
       
  2166 		// as the event bubbles up through nested menus
       
  2167 		this.mouseHandled = false;
       
  2168 		this.element
       
  2169 			.uniqueId()
       
  2170 			.addClass( "ui-menu ui-widget ui-widget-content" )
       
  2171 			.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
       
  2172 			.attr({
       
  2173 				role: this.options.role,
       
  2174 				tabIndex: 0
       
  2175 			});
       
  2176 
       
  2177 		if ( this.options.disabled ) {
       
  2178 			this.element
       
  2179 				.addClass( "ui-state-disabled" )
       
  2180 				.attr( "aria-disabled", "true" );
       
  2181 		}
       
  2182 
       
  2183 		this._on({
       
  2184 			// Prevent focus from sticking to links inside menu after clicking
       
  2185 			// them (focus should always stay on UL during navigation).
       
  2186 			"mousedown .ui-menu-item": function( event ) {
       
  2187 				event.preventDefault();
       
  2188 			},
       
  2189 			"click .ui-menu-item": function( event ) {
       
  2190 				var target = $( event.target );
       
  2191 				if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
       
  2192 					this.select( event );
       
  2193 
       
  2194 					// Only set the mouseHandled flag if the event will bubble, see #9469.
       
  2195 					if ( !event.isPropagationStopped() ) {
       
  2196 						this.mouseHandled = true;
       
  2197 					}
       
  2198 
       
  2199 					// Open submenu on click
       
  2200 					if ( target.has( ".ui-menu" ).length ) {
       
  2201 						this.expand( event );
       
  2202 					} else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) {
       
  2203 
       
  2204 						// Redirect focus to the menu
       
  2205 						this.element.trigger( "focus", [ true ] );
       
  2206 
       
  2207 						// If the active item is on the top level, let it stay active.
       
  2208 						// Otherwise, blur the active item since it is no longer visible.
       
  2209 						if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
       
  2210 							clearTimeout( this.timer );
       
  2211 						}
       
  2212 					}
       
  2213 				}
       
  2214 			},
       
  2215 			"mouseenter .ui-menu-item": function( event ) {
       
  2216 				// Ignore mouse events while typeahead is active, see #10458.
       
  2217 				// Prevents focusing the wrong item when typeahead causes a scroll while the mouse
       
  2218 				// is over an item in the menu
       
  2219 				if ( this.previousFilter ) {
       
  2220 					return;
       
  2221 				}
       
  2222 				var target = $( event.currentTarget );
       
  2223 				// Remove ui-state-active class from siblings of the newly focused menu item
       
  2224 				// to avoid a jump caused by adjacent elements both having a class with a border
       
  2225 				target.siblings( ".ui-state-active" ).removeClass( "ui-state-active" );
       
  2226 				this.focus( event, target );
       
  2227 			},
       
  2228 			mouseleave: "collapseAll",
       
  2229 			"mouseleave .ui-menu": "collapseAll",
       
  2230 			focus: function( event, keepActiveItem ) {
       
  2231 				// If there's already an active item, keep it active
       
  2232 				// If not, activate the first item
       
  2233 				var item = this.active || this.element.find( this.options.items ).eq( 0 );
       
  2234 
       
  2235 				if ( !keepActiveItem ) {
       
  2236 					this.focus( event, item );
       
  2237 				}
       
  2238 			},
       
  2239 			blur: function( event ) {
       
  2240 				this._delay(function() {
       
  2241 					if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
       
  2242 						this.collapseAll( event );
       
  2243 					}
       
  2244 				});
       
  2245 			},
       
  2246 			keydown: "_keydown"
       
  2247 		});
       
  2248 
       
  2249 		this.refresh();
       
  2250 
       
  2251 		// Clicks outside of a menu collapse any open menus
       
  2252 		this._on( this.document, {
       
  2253 			click: function( event ) {
       
  2254 				if ( this._closeOnDocumentClick( event ) ) {
       
  2255 					this.collapseAll( event );
       
  2256 				}
       
  2257 
       
  2258 				// Reset the mouseHandled flag
       
  2259 				this.mouseHandled = false;
       
  2260 			}
       
  2261 		});
       
  2262 	},
       
  2263 
       
  2264 	_destroy: function() {
       
  2265 		// Destroy (sub)menus
       
  2266 		this.element
       
  2267 			.removeAttr( "aria-activedescendant" )
       
  2268 			.find( ".ui-menu" ).addBack()
       
  2269 				.removeClass( "ui-menu ui-widget ui-widget-content ui-menu-icons ui-front" )
       
  2270 				.removeAttr( "role" )
       
  2271 				.removeAttr( "tabIndex" )
       
  2272 				.removeAttr( "aria-labelledby" )
       
  2273 				.removeAttr( "aria-expanded" )
       
  2274 				.removeAttr( "aria-hidden" )
       
  2275 				.removeAttr( "aria-disabled" )
       
  2276 				.removeUniqueId()
       
  2277 				.show();
       
  2278 
       
  2279 		// Destroy menu items
       
  2280 		this.element.find( ".ui-menu-item" )
       
  2281 			.removeClass( "ui-menu-item" )
       
  2282 			.removeAttr( "role" )
       
  2283 			.removeAttr( "aria-disabled" )
       
  2284 			.removeUniqueId()
       
  2285 			.removeClass( "ui-state-hover" )
       
  2286 			.removeAttr( "tabIndex" )
       
  2287 			.removeAttr( "role" )
       
  2288 			.removeAttr( "aria-haspopup" )
       
  2289 			.children().each( function() {
       
  2290 				var elem = $( this );
       
  2291 				if ( elem.data( "ui-menu-submenu-carat" ) ) {
       
  2292 					elem.remove();
       
  2293 				}
       
  2294 			});
       
  2295 
       
  2296 		// Destroy menu dividers
       
  2297 		this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
       
  2298 	},
       
  2299 
       
  2300 	_keydown: function( event ) {
       
  2301 		var match, prev, character, skip,
       
  2302 			preventDefault = true;
       
  2303 
       
  2304 		switch ( event.keyCode ) {
       
  2305 		case $.ui.keyCode.PAGE_UP:
       
  2306 			this.previousPage( event );
       
  2307 			break;
       
  2308 		case $.ui.keyCode.PAGE_DOWN:
       
  2309 			this.nextPage( event );
       
  2310 			break;
       
  2311 		case $.ui.keyCode.HOME:
       
  2312 			this._move( "first", "first", event );
       
  2313 			break;
       
  2314 		case $.ui.keyCode.END:
       
  2315 			this._move( "last", "last", event );
       
  2316 			break;
       
  2317 		case $.ui.keyCode.UP:
       
  2318 			this.previous( event );
       
  2319 			break;
       
  2320 		case $.ui.keyCode.DOWN:
       
  2321 			this.next( event );
       
  2322 			break;
       
  2323 		case $.ui.keyCode.LEFT:
       
  2324 			this.collapse( event );
       
  2325 			break;
       
  2326 		case $.ui.keyCode.RIGHT:
       
  2327 			if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
       
  2328 				this.expand( event );
       
  2329 			}
       
  2330 			break;
       
  2331 		case $.ui.keyCode.ENTER:
       
  2332 		case $.ui.keyCode.SPACE:
       
  2333 			this._activate( event );
       
  2334 			break;
       
  2335 		case $.ui.keyCode.ESCAPE:
       
  2336 			this.collapse( event );
       
  2337 			break;
       
  2338 		default:
       
  2339 			preventDefault = false;
       
  2340 			prev = this.previousFilter || "";
       
  2341 			character = String.fromCharCode( event.keyCode );
       
  2342 			skip = false;
       
  2343 
       
  2344 			clearTimeout( this.filterTimer );
       
  2345 
       
  2346 			if ( character === prev ) {
       
  2347 				skip = true;
       
  2348 			} else {
       
  2349 				character = prev + character;
       
  2350 			}
       
  2351 
       
  2352 			match = this._filterMenuItems( character );
       
  2353 			match = skip && match.index( this.active.next() ) !== -1 ?
       
  2354 				this.active.nextAll( ".ui-menu-item" ) :
       
  2355 				match;
       
  2356 
       
  2357 			// If no matches on the current filter, reset to the last character pressed
       
  2358 			// to move down the menu to the first item that starts with that character
       
  2359 			if ( !match.length ) {
       
  2360 				character = String.fromCharCode( event.keyCode );
       
  2361 				match = this._filterMenuItems( character );
       
  2362 			}
       
  2363 
       
  2364 			if ( match.length ) {
       
  2365 				this.focus( event, match );
       
  2366 				this.previousFilter = character;
       
  2367 				this.filterTimer = this._delay(function() {
       
  2368 					delete this.previousFilter;
       
  2369 				}, 1000 );
       
  2370 			} else {
       
  2371 				delete this.previousFilter;
       
  2372 			}
       
  2373 		}
       
  2374 
       
  2375 		if ( preventDefault ) {
       
  2376 			event.preventDefault();
       
  2377 		}
       
  2378 	},
       
  2379 
       
  2380 	_activate: function( event ) {
       
  2381 		if ( !this.active.is( ".ui-state-disabled" ) ) {
       
  2382 			if ( this.active.is( "[aria-haspopup='true']" ) ) {
       
  2383 				this.expand( event );
       
  2384 			} else {
       
  2385 				this.select( event );
       
  2386 			}
       
  2387 		}
       
  2388 	},
       
  2389 
       
  2390 	refresh: function() {
       
  2391 		var menus, items,
       
  2392 			that = this,
       
  2393 			icon = this.options.icons.submenu,
       
  2394 			submenus = this.element.find( this.options.menus );
       
  2395 
       
  2396 		this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );
       
  2397 
       
  2398 		// Initialize nested menus
       
  2399 		submenus.filter( ":not(.ui-menu)" )
       
  2400 			.addClass( "ui-menu ui-widget ui-widget-content ui-front" )
       
  2401 			.hide()
       
  2402 			.attr({
       
  2403 				role: this.options.role,
       
  2404 				"aria-hidden": "true",
       
  2405 				"aria-expanded": "false"
       
  2406 			})
       
  2407 			.each(function() {
       
  2408 				var menu = $( this ),
       
  2409 					item = menu.parent(),
       
  2410 					submenuCarat = $( "<span>" )
       
  2411 						.addClass( "ui-menu-icon ui-icon " + icon )
       
  2412 						.data( "ui-menu-submenu-carat", true );
       
  2413 
       
  2414 				item
       
  2415 					.attr( "aria-haspopup", "true" )
       
  2416 					.prepend( submenuCarat );
       
  2417 				menu.attr( "aria-labelledby", item.attr( "id" ) );
       
  2418 			});
       
  2419 
       
  2420 		menus = submenus.add( this.element );
       
  2421 		items = menus.find( this.options.items );
       
  2422 
       
  2423 		// Initialize menu-items containing spaces and/or dashes only as dividers
       
  2424 		items.not( ".ui-menu-item" ).each(function() {
       
  2425 			var item = $( this );
       
  2426 			if ( that._isDivider( item ) ) {
       
  2427 				item.addClass( "ui-widget-content ui-menu-divider" );
       
  2428 			}
       
  2429 		});
       
  2430 
       
  2431 		// Don't refresh list items that are already adapted
       
  2432 		items.not( ".ui-menu-item, .ui-menu-divider" )
       
  2433 			.addClass( "ui-menu-item" )
       
  2434 			.uniqueId()
       
  2435 			.attr({
       
  2436 				tabIndex: -1,
       
  2437 				role: this._itemRole()
       
  2438 			});
       
  2439 
       
  2440 		// Add aria-disabled attribute to any disabled menu item
       
  2441 		items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
       
  2442 
       
  2443 		// If the active item has been removed, blur the menu
       
  2444 		if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
       
  2445 			this.blur();
       
  2446 		}
       
  2447 	},
       
  2448 
       
  2449 	_itemRole: function() {
       
  2450 		return {
       
  2451 			menu: "menuitem",
       
  2452 			listbox: "option"
       
  2453 		}[ this.options.role ];
       
  2454 	},
       
  2455 
       
  2456 	_setOption: function( key, value ) {
       
  2457 		if ( key === "icons" ) {
       
  2458 			this.element.find( ".ui-menu-icon" )
       
  2459 				.removeClass( this.options.icons.submenu )
       
  2460 				.addClass( value.submenu );
       
  2461 		}
       
  2462 		if ( key === "disabled" ) {
       
  2463 			this.element
       
  2464 				.toggleClass( "ui-state-disabled", !!value )
       
  2465 				.attr( "aria-disabled", value );
       
  2466 		}
       
  2467 		this._super( key, value );
       
  2468 	},
       
  2469 
       
  2470 	focus: function( event, item ) {
       
  2471 		var nested, focused;
       
  2472 		this.blur( event, event && event.type === "focus" );
       
  2473 
       
  2474 		this._scrollIntoView( item );
       
  2475 
       
  2476 		this.active = item.first();
       
  2477 		focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" );
       
  2478 		// Only update aria-activedescendant if there's a role
       
  2479 		// otherwise we assume focus is managed elsewhere
       
  2480 		if ( this.options.role ) {
       
  2481 			this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
       
  2482 		}
       
  2483 
       
  2484 		// Highlight active parent menu item, if any
       
  2485 		this.active
       
  2486 			.parent()
       
  2487 			.closest( ".ui-menu-item" )
       
  2488 			.addClass( "ui-state-active" );
       
  2489 
       
  2490 		if ( event && event.type === "keydown" ) {
       
  2491 			this._close();
       
  2492 		} else {
       
  2493 			this.timer = this._delay(function() {
       
  2494 				this._close();
       
  2495 			}, this.delay );
       
  2496 		}
       
  2497 
       
  2498 		nested = item.children( ".ui-menu" );
       
  2499 		if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
       
  2500 			this._startOpening(nested);
       
  2501 		}
       
  2502 		this.activeMenu = item.parent();
       
  2503 
       
  2504 		this._trigger( "focus", event, { item: item } );
       
  2505 	},
       
  2506 
       
  2507 	_scrollIntoView: function( item ) {
       
  2508 		var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
       
  2509 		if ( this._hasScroll() ) {
       
  2510 			borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
       
  2511 			paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
       
  2512 			offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
       
  2513 			scroll = this.activeMenu.scrollTop();
       
  2514 			elementHeight = this.activeMenu.height();
       
  2515 			itemHeight = item.outerHeight();
       
  2516 
       
  2517 			if ( offset < 0 ) {
       
  2518 				this.activeMenu.scrollTop( scroll + offset );
       
  2519 			} else if ( offset + itemHeight > elementHeight ) {
       
  2520 				this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
       
  2521 			}
       
  2522 		}
       
  2523 	},
       
  2524 
       
  2525 	blur: function( event, fromFocus ) {
       
  2526 		if ( !fromFocus ) {
       
  2527 			clearTimeout( this.timer );
       
  2528 		}
       
  2529 
       
  2530 		if ( !this.active ) {
       
  2531 			return;
       
  2532 		}
       
  2533 
       
  2534 		this.active.removeClass( "ui-state-focus" );
       
  2535 		this.active = null;
       
  2536 
       
  2537 		this._trigger( "blur", event, { item: this.active } );
       
  2538 	},
       
  2539 
       
  2540 	_startOpening: function( submenu ) {
       
  2541 		clearTimeout( this.timer );
       
  2542 
       
  2543 		// Don't open if already open fixes a Firefox bug that caused a .5 pixel
       
  2544 		// shift in the submenu position when mousing over the carat icon
       
  2545 		if ( submenu.attr( "aria-hidden" ) !== "true" ) {
       
  2546 			return;
       
  2547 		}
       
  2548 
       
  2549 		this.timer = this._delay(function() {
       
  2550 			this._close();
       
  2551 			this._open( submenu );
       
  2552 		}, this.delay );
       
  2553 	},
       
  2554 
       
  2555 	_open: function( submenu ) {
       
  2556 		var position = $.extend({
       
  2557 			of: this.active
       
  2558 		}, this.options.position );
       
  2559 
       
  2560 		clearTimeout( this.timer );
       
  2561 		this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
       
  2562 			.hide()
       
  2563 			.attr( "aria-hidden", "true" );
       
  2564 
       
  2565 		submenu
       
  2566 			.show()
       
  2567 			.removeAttr( "aria-hidden" )
       
  2568 			.attr( "aria-expanded", "true" )
       
  2569 			.position( position );
       
  2570 	},
       
  2571 
       
  2572 	collapseAll: function( event, all ) {
       
  2573 		clearTimeout( this.timer );
       
  2574 		this.timer = this._delay(function() {
       
  2575 			// If we were passed an event, look for the submenu that contains the event
       
  2576 			var currentMenu = all ? this.element :
       
  2577 				$( event && event.target ).closest( this.element.find( ".ui-menu" ) );
       
  2578 
       
  2579 			// If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
       
  2580 			if ( !currentMenu.length ) {
       
  2581 				currentMenu = this.element;
       
  2582 			}
       
  2583 
       
  2584 			this._close( currentMenu );
       
  2585 
       
  2586 			this.blur( event );
       
  2587 			this.activeMenu = currentMenu;
       
  2588 		}, this.delay );
       
  2589 	},
       
  2590 
       
  2591 	// With no arguments, closes the currently active menu - if nothing is active
       
  2592 	// it closes all menus.  If passed an argument, it will search for menus BELOW
       
  2593 	_close: function( startMenu ) {
       
  2594 		if ( !startMenu ) {
       
  2595 			startMenu = this.active ? this.active.parent() : this.element;
       
  2596 		}
       
  2597 
       
  2598 		startMenu
       
  2599 			.find( ".ui-menu" )
       
  2600 				.hide()
       
  2601 				.attr( "aria-hidden", "true" )
       
  2602 				.attr( "aria-expanded", "false" )
       
  2603 			.end()
       
  2604 			.find( ".ui-state-active" ).not( ".ui-state-focus" )
       
  2605 				.removeClass( "ui-state-active" );
       
  2606 	},
       
  2607 
       
  2608 	_closeOnDocumentClick: function( event ) {
       
  2609 		return !$( event.target ).closest( ".ui-menu" ).length;
       
  2610 	},
       
  2611 
       
  2612 	_isDivider: function( item ) {
       
  2613 
       
  2614 		// Match hyphen, em dash, en dash
       
  2615 		return !/[^\-\u2014\u2013\s]/.test( item.text() );
       
  2616 	},
       
  2617 
       
  2618 	collapse: function( event ) {
       
  2619 		var newItem = this.active &&
       
  2620 			this.active.parent().closest( ".ui-menu-item", this.element );
       
  2621 		if ( newItem && newItem.length ) {
       
  2622 			this._close();
       
  2623 			this.focus( event, newItem );
       
  2624 		}
       
  2625 	},
       
  2626 
       
  2627 	expand: function( event ) {
       
  2628 		var newItem = this.active &&
       
  2629 			this.active
       
  2630 				.children( ".ui-menu " )
       
  2631 				.find( this.options.items )
       
  2632 				.first();
       
  2633 
       
  2634 		if ( newItem && newItem.length ) {
       
  2635 			this._open( newItem.parent() );
       
  2636 
       
  2637 			// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
       
  2638 			this._delay(function() {
       
  2639 				this.focus( event, newItem );
       
  2640 			});
       
  2641 		}
       
  2642 	},
       
  2643 
       
  2644 	next: function( event ) {
       
  2645 		this._move( "next", "first", event );
       
  2646 	},
       
  2647 
       
  2648 	previous: function( event ) {
       
  2649 		this._move( "prev", "last", event );
       
  2650 	},
       
  2651 
       
  2652 	isFirstItem: function() {
       
  2653 		return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
       
  2654 	},
       
  2655 
       
  2656 	isLastItem: function() {
       
  2657 		return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
       
  2658 	},
       
  2659 
       
  2660 	_move: function( direction, filter, event ) {
       
  2661 		var next;
       
  2662 		if ( this.active ) {
       
  2663 			if ( direction === "first" || direction === "last" ) {
       
  2664 				next = this.active
       
  2665 					[ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
       
  2666 					.eq( -1 );
       
  2667 			} else {
       
  2668 				next = this.active
       
  2669 					[ direction + "All" ]( ".ui-menu-item" )
       
  2670 					.eq( 0 );
       
  2671 			}
       
  2672 		}
       
  2673 		if ( !next || !next.length || !this.active ) {
       
  2674 			next = this.activeMenu.find( this.options.items )[ filter ]();
       
  2675 		}
       
  2676 
       
  2677 		this.focus( event, next );
       
  2678 	},
       
  2679 
       
  2680 	nextPage: function( event ) {
       
  2681 		var item, base, height;
       
  2682 
       
  2683 		if ( !this.active ) {
       
  2684 			this.next( event );
       
  2685 			return;
       
  2686 		}
       
  2687 		if ( this.isLastItem() ) {
       
  2688 			return;
       
  2689 		}
       
  2690 		if ( this._hasScroll() ) {
       
  2691 			base = this.active.offset().top;
       
  2692 			height = this.element.height();
       
  2693 			this.active.nextAll( ".ui-menu-item" ).each(function() {
       
  2694 				item = $( this );
       
  2695 				return item.offset().top - base - height < 0;
       
  2696 			});
       
  2697 
       
  2698 			this.focus( event, item );
       
  2699 		} else {
       
  2700 			this.focus( event, this.activeMenu.find( this.options.items )
       
  2701 				[ !this.active ? "first" : "last" ]() );
       
  2702 		}
       
  2703 	},
       
  2704 
       
  2705 	previousPage: function( event ) {
       
  2706 		var item, base, height;
       
  2707 		if ( !this.active ) {
       
  2708 			this.next( event );
       
  2709 			return;
       
  2710 		}
       
  2711 		if ( this.isFirstItem() ) {
       
  2712 			return;
       
  2713 		}
       
  2714 		if ( this._hasScroll() ) {
       
  2715 			base = this.active.offset().top;
       
  2716 			height = this.element.height();
       
  2717 			this.active.prevAll( ".ui-menu-item" ).each(function() {
       
  2718 				item = $( this );
       
  2719 				return item.offset().top - base + height > 0;
       
  2720 			});
       
  2721 
       
  2722 			this.focus( event, item );
       
  2723 		} else {
       
  2724 			this.focus( event, this.activeMenu.find( this.options.items ).first() );
       
  2725 		}
       
  2726 	},
       
  2727 
       
  2728 	_hasScroll: function() {
       
  2729 		return this.element.outerHeight() < this.element.prop( "scrollHeight" );
       
  2730 	},
       
  2731 
       
  2732 	select: function( event ) {
       
  2733 		// TODO: It should never be possible to not have an active item at this
       
  2734 		// point, but the tests don't trigger mouseenter before click.
       
  2735 		this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
       
  2736 		var ui = { item: this.active };
       
  2737 		if ( !this.active.has( ".ui-menu" ).length ) {
       
  2738 			this.collapseAll( event, true );
       
  2739 		}
       
  2740 		this._trigger( "select", event, ui );
       
  2741 	},
       
  2742 
       
  2743 	_filterMenuItems: function(character) {
       
  2744 		var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
       
  2745 			regex = new RegExp( "^" + escapedCharacter, "i" );
       
  2746 
       
  2747 		return this.activeMenu
       
  2748 			.find( this.options.items )
       
  2749 
       
  2750 			// Only match on items, not dividers or other content (#10571)
       
  2751 			.filter( ".ui-menu-item" )
       
  2752 			.filter(function() {
       
  2753 				return regex.test( $.trim( $( this ).text() ) );
       
  2754 			});
       
  2755 	}
       
  2756 });
       
  2757 
       
  2758 
       
  2759 /*!
       
  2760  * jQuery UI Autocomplete 1.11.4
       
  2761  * http://jqueryui.com
       
  2762  *
       
  2763  * Copyright jQuery Foundation and other contributors
       
  2764  * Released under the MIT license.
       
  2765  * http://jquery.org/license
       
  2766  *
       
  2767  * http://api.jqueryui.com/autocomplete/
       
  2768  */
       
  2769 
  6617 
  2770 
  6618 $.widget( "ui.autocomplete", {
  2771 $.widget( "ui.autocomplete", {
  6619 	version: "1.10.3",
  2772 	version: "1.11.4",
  6620 	defaultElement: "<input>",
  2773 	defaultElement: "<input>",
  6621 	options: {
  2774 	options: {
  6622 		appendTo: null,
  2775 		appendTo: null,
  6623 		autoFocus: false,
  2776 		autoFocus: false,
  6624 		delay: 300,
  2777 		delay: 300,
  6638 		response: null,
  2791 		response: null,
  6639 		search: null,
  2792 		search: null,
  6640 		select: null
  2793 		select: null
  6641 	},
  2794 	},
  6642 
  2795 
       
  2796 	requestIndex: 0,
  6643 	pending: 0,
  2797 	pending: 0,
  6644 
  2798 
  6645 	_create: function() {
  2799 	_create: function() {
  6646 		// Some browsers only repeat keydown events, not keypress events,
  2800 		// Some browsers only repeat keydown events, not keypress events,
  6647 		// so we use the suppressKeyPress flag to determine if we've already
  2801 		// so we use the suppressKeyPress flag to determine if we've already
  6649 		// Unfortunately the code for & in keypress is the same as the up arrow,
  2803 		// Unfortunately the code for & in keypress is the same as the up arrow,
  6650 		// so we use the suppressKeyPressRepeat flag to avoid handling keypress
  2804 		// so we use the suppressKeyPressRepeat flag to avoid handling keypress
  6651 		// events when we know the keydown event was used to modify the
  2805 		// events when we know the keydown event was used to modify the
  6652 		// search term. #7799
  2806 		// search term. #7799
  6653 		var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
  2807 		var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
  6654 			nodeName = this.element[0].nodeName.toLowerCase(),
  2808 			nodeName = this.element[ 0 ].nodeName.toLowerCase(),
  6655 			isTextarea = nodeName === "textarea",
  2809 			isTextarea = nodeName === "textarea",
  6656 			isInput = nodeName === "input";
  2810 			isInput = nodeName === "input";
  6657 
  2811 
  6658 		this.isMultiLine =
  2812 		this.isMultiLine =
  6659 			// Textareas are always multi-line
  2813 			// Textareas are always multi-line
  6671 			.addClass( "ui-autocomplete-input" )
  2825 			.addClass( "ui-autocomplete-input" )
  6672 			.attr( "autocomplete", "off" );
  2826 			.attr( "autocomplete", "off" );
  6673 
  2827 
  6674 		this._on( this.element, {
  2828 		this._on( this.element, {
  6675 			keydown: function( event ) {
  2829 			keydown: function( event ) {
  6676 				/*jshint maxcomplexity:15*/
       
  6677 				if ( this.element.prop( "readOnly" ) ) {
  2830 				if ( this.element.prop( "readOnly" ) ) {
  6678 					suppressKeyPress = true;
  2831 					suppressKeyPress = true;
  6679 					suppressInput = true;
  2832 					suppressInput = true;
  6680 					suppressKeyPressRepeat = true;
  2833 					suppressKeyPressRepeat = true;
  6681 					return;
  2834 					return;
  6683 
  2836 
  6684 				suppressKeyPress = false;
  2837 				suppressKeyPress = false;
  6685 				suppressInput = false;
  2838 				suppressInput = false;
  6686 				suppressKeyPressRepeat = false;
  2839 				suppressKeyPressRepeat = false;
  6687 				var keyCode = $.ui.keyCode;
  2840 				var keyCode = $.ui.keyCode;
  6688 				switch( event.keyCode ) {
  2841 				switch ( event.keyCode ) {
  6689 				case keyCode.PAGE_UP:
  2842 				case keyCode.PAGE_UP:
  6690 					suppressKeyPress = true;
  2843 					suppressKeyPress = true;
  6691 					this._move( "previousPage", event );
  2844 					this._move( "previousPage", event );
  6692 					break;
  2845 					break;
  6693 				case keyCode.PAGE_DOWN:
  2846 				case keyCode.PAGE_DOWN:
  6701 				case keyCode.DOWN:
  2854 				case keyCode.DOWN:
  6702 					suppressKeyPress = true;
  2855 					suppressKeyPress = true;
  6703 					this._keyEvent( "next", event );
  2856 					this._keyEvent( "next", event );
  6704 					break;
  2857 					break;
  6705 				case keyCode.ENTER:
  2858 				case keyCode.ENTER:
  6706 				case keyCode.NUMPAD_ENTER:
       
  6707 					// when menu is open and has focus
  2859 					// when menu is open and has focus
  6708 					if ( this.menu.active ) {
  2860 					if ( this.menu.active ) {
  6709 						// #6055 - Opera still allows the keypress to occur
  2861 						// #6055 - Opera still allows the keypress to occur
  6710 						// which causes forms to submit
  2862 						// which causes forms to submit
  6711 						suppressKeyPress = true;
  2863 						suppressKeyPress = true;
  6718 						this.menu.select( event );
  2870 						this.menu.select( event );
  6719 					}
  2871 					}
  6720 					break;
  2872 					break;
  6721 				case keyCode.ESCAPE:
  2873 				case keyCode.ESCAPE:
  6722 					if ( this.menu.element.is( ":visible" ) ) {
  2874 					if ( this.menu.element.is( ":visible" ) ) {
  6723 						this._value( this.term );
  2875 						if ( !this.isMultiLine ) {
       
  2876 							this._value( this.term );
       
  2877 						}
  6724 						this.close( event );
  2878 						this.close( event );
  6725 						// Different browsers have different default behavior for escape
  2879 						// Different browsers have different default behavior for escape
  6726 						// Single press can mean undo or clear
  2880 						// Single press can mean undo or clear
  6727 						// Double press in IE means clear the whole form
  2881 						// Double press in IE means clear the whole form
  6728 						event.preventDefault();
  2882 						event.preventDefault();
  6747 					return;
  2901 					return;
  6748 				}
  2902 				}
  6749 
  2903 
  6750 				// replicate some key handlers to allow them to repeat in Firefox and Opera
  2904 				// replicate some key handlers to allow them to repeat in Firefox and Opera
  6751 				var keyCode = $.ui.keyCode;
  2905 				var keyCode = $.ui.keyCode;
  6752 				switch( event.keyCode ) {
  2906 				switch ( event.keyCode ) {
  6753 				case keyCode.PAGE_UP:
  2907 				case keyCode.PAGE_UP:
  6754 					this._move( "previousPage", event );
  2908 					this._move( "previousPage", event );
  6755 					break;
  2909 					break;
  6756 				case keyCode.PAGE_DOWN:
  2910 				case keyCode.PAGE_DOWN:
  6757 					this._move( "nextPage", event );
  2911 					this._move( "nextPage", event );
  6795 			.menu({
  2949 			.menu({
  6796 				// disable ARIA support, the live region takes care of that
  2950 				// disable ARIA support, the live region takes care of that
  6797 				role: null
  2951 				role: null
  6798 			})
  2952 			})
  6799 			.hide()
  2953 			.hide()
  6800 			.data( "ui-menu" );
  2954 			.menu( "instance" );
  6801 
  2955 
  6802 		this._on( this.menu.element, {
  2956 		this._on( this.menu.element, {
  6803 			mousedown: function( event ) {
  2957 			mousedown: function( event ) {
  6804 				// prevent moving focus out of the text field
  2958 				// prevent moving focus out of the text field
  6805 				event.preventDefault();
  2959 				event.preventDefault();
  6828 						});
  2982 						});
  6829 					});
  2983 					});
  6830 				}
  2984 				}
  6831 			},
  2985 			},
  6832 			menufocus: function( event, ui ) {
  2986 			menufocus: function( event, ui ) {
       
  2987 				var label, item;
  6833 				// support: Firefox
  2988 				// support: Firefox
  6834 				// Prevent accidental activation of menu items in Firefox (#7024 #9118)
  2989 				// Prevent accidental activation of menu items in Firefox (#7024 #9118)
  6835 				if ( this.isNewMenu ) {
  2990 				if ( this.isNewMenu ) {
  6836 					this.isNewMenu = false;
  2991 					this.isNewMenu = false;
  6837 					if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
  2992 					if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
  6843 
  2998 
  6844 						return;
  2999 						return;
  6845 					}
  3000 					}
  6846 				}
  3001 				}
  6847 
  3002 
  6848 				var item = ui.item.data( "ui-autocomplete-item" );
  3003 				item = ui.item.data( "ui-autocomplete-item" );
  6849 				if ( false !== this._trigger( "focus", event, { item: item } ) ) {
  3004 				if ( false !== this._trigger( "focus", event, { item: item } ) ) {
  6850 					// use value to match what will end up in the input, if it was a key event
  3005 					// use value to match what will end up in the input, if it was a key event
  6851 					if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
  3006 					if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
  6852 						this._value( item.value );
  3007 						this._value( item.value );
  6853 					}
  3008 					}
  6854 				} else {
  3009 				}
  6855 					// Normally the input is populated with the item's value as the
  3010 
  6856 					// menu is navigated, causing screen readers to notice a change and
  3011 				// Announce the value in the liveRegion
  6857 					// announce the item. Since the focus event was canceled, this doesn't
  3012 				label = ui.item.attr( "aria-label" ) || item.value;
  6858 					// happen, so we update the live region so that screen readers can
  3013 				if ( label && $.trim( label ).length ) {
  6859 					// still notice the change and announce it.
  3014 					this.liveRegion.children().hide();
  6860 					this.liveRegion.text( item.value );
  3015 					$( "<div>" ).text( label ).appendTo( this.liveRegion );
  6861 				}
  3016 				}
  6862 			},
  3017 			},
  6863 			menuselect: function( event, ui ) {
  3018 			menuselect: function( event, ui ) {
  6864 				var item = ui.item.data( "ui-autocomplete-item" ),
  3019 				var item = ui.item.data( "ui-autocomplete-item" ),
  6865 					previous = this.previous;
  3020 					previous = this.previous;
  6866 
  3021 
  6867 				// only trigger when focus was lost (click on menu)
  3022 				// only trigger when focus was lost (click on menu)
  6868 				if ( this.element[0] !== this.document[0].activeElement ) {
  3023 				if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) {
  6869 					this.element.focus();
  3024 					this.element.focus();
  6870 					this.previous = previous;
  3025 					this.previous = previous;
  6871 					// #6109 - IE triggers two focus events and the second
  3026 					// #6109 - IE triggers two focus events and the second
  6872 					// is asynchronous, so we need to reset the previous
  3027 					// is asynchronous, so we need to reset the previous
  6873 					// term synchronously and asynchronously :-(
  3028 					// term synchronously and asynchronously :-(
  6889 			}
  3044 			}
  6890 		});
  3045 		});
  6891 
  3046 
  6892 		this.liveRegion = $( "<span>", {
  3047 		this.liveRegion = $( "<span>", {
  6893 				role: "status",
  3048 				role: "status",
  6894 				"aria-live": "polite"
  3049 				"aria-live": "assertive",
       
  3050 				"aria-relevant": "additions"
  6895 			})
  3051 			})
  6896 			.addClass( "ui-helper-hidden-accessible" )
  3052 			.addClass( "ui-helper-hidden-accessible" )
  6897 			.insertBefore( this.element );
  3053 			.appendTo( this.document[ 0 ].body );
  6898 
  3054 
  6899 		// turning off autocomplete prevents the browser from remembering the
  3055 		// turning off autocomplete prevents the browser from remembering the
  6900 		// value when navigating through history, so we re-enable autocomplete
  3056 		// value when navigating through history, so we re-enable autocomplete
  6901 		// if the page is unloaded before the widget is destroyed. #7790
  3057 		// if the page is unloaded before the widget is destroyed. #7790
  6902 		this._on( this.window, {
  3058 		this._on( this.window, {
  6935 			element = element.jquery || element.nodeType ?
  3091 			element = element.jquery || element.nodeType ?
  6936 				$( element ) :
  3092 				$( element ) :
  6937 				this.document.find( element ).eq( 0 );
  3093 				this.document.find( element ).eq( 0 );
  6938 		}
  3094 		}
  6939 
  3095 
  6940 		if ( !element ) {
  3096 		if ( !element || !element[ 0 ] ) {
  6941 			element = this.element.closest( ".ui-front" );
  3097 			element = this.element.closest( ".ui-front" );
  6942 		}
  3098 		}
  6943 
  3099 
  6944 		if ( !element.length ) {
  3100 		if ( !element.length ) {
  6945 			element = this.document[0].body;
  3101 			element = this.document[ 0 ].body;
  6946 		}
  3102 		}
  6947 
  3103 
  6948 		return element;
  3104 		return element;
  6949 	},
  3105 	},
  6950 
  3106 
  6951 	_initSource: function() {
  3107 	_initSource: function() {
  6952 		var array, url,
  3108 		var array, url,
  6953 			that = this;
  3109 			that = this;
  6954 		if ( $.isArray(this.options.source) ) {
  3110 		if ( $.isArray( this.options.source ) ) {
  6955 			array = this.options.source;
  3111 			array = this.options.source;
  6956 			this.source = function( request, response ) {
  3112 			this.source = function( request, response ) {
  6957 				response( $.ui.autocomplete.filter( array, request.term ) );
  3113 				response( $.ui.autocomplete.filter( array, request.term ) );
  6958 			};
  3114 			};
  6959 		} else if ( typeof this.options.source === "string" ) {
  3115 		} else if ( typeof this.options.source === "string" ) {
  6968 					dataType: "json",
  3124 					dataType: "json",
  6969 					success: function( data ) {
  3125 					success: function( data ) {
  6970 						response( data );
  3126 						response( data );
  6971 					},
  3127 					},
  6972 					error: function() {
  3128 					error: function() {
  6973 						response( [] );
  3129 						response([]);
  6974 					}
  3130 					}
  6975 				});
  3131 				});
  6976 			};
  3132 			};
  6977 		} else {
  3133 		} else {
  6978 			this.source = this.options.source;
  3134 			this.source = this.options.source;
  6980 	},
  3136 	},
  6981 
  3137 
  6982 	_searchTimeout: function( event ) {
  3138 	_searchTimeout: function( event ) {
  6983 		clearTimeout( this.searching );
  3139 		clearTimeout( this.searching );
  6984 		this.searching = this._delay(function() {
  3140 		this.searching = this._delay(function() {
  6985 			// only search if the value has changed
  3141 
  6986 			if ( this.term !== this._value() ) {
  3142 			// Search if the value has changed, or if the user retypes the same value (see #7434)
       
  3143 			var equalValues = this.term === this._value(),
       
  3144 				menuVisible = this.menu.element.is( ":visible" ),
       
  3145 				modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
       
  3146 
       
  3147 			if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
  6987 				this.selectedItem = null;
  3148 				this.selectedItem = null;
  6988 				this.search( null, event );
  3149 				this.search( null, event );
  6989 			}
  3150 			}
  6990 		}, this.options.delay );
  3151 		}, this.options.delay );
  6991 	},
  3152 	},
  7014 
  3175 
  7015 		this.source( { term: value }, this._response() );
  3176 		this.source( { term: value }, this._response() );
  7016 	},
  3177 	},
  7017 
  3178 
  7018 	_response: function() {
  3179 	_response: function() {
  7019 		var that = this,
  3180 		var index = ++this.requestIndex;
  7020 			index = ++requestIndex;
  3181 
  7021 
  3182 		return $.proxy(function( content ) {
  7022 		return function( content ) {
  3183 			if ( index === this.requestIndex ) {
  7023 			if ( index === requestIndex ) {
  3184 				this.__response( content );
  7024 				that.__response( content );
  3185 			}
  7025 			}
  3186 
  7026 
  3187 			this.pending--;
  7027 			that.pending--;
  3188 			if ( !this.pending ) {
  7028 			if ( !that.pending ) {
  3189 				this.element.removeClass( "ui-autocomplete-loading" );
  7029 				that.element.removeClass( "ui-autocomplete-loading" );
  3190 			}
  7030 			}
  3191 		}, this );
  7031 		};
       
  7032 	},
  3192 	},
  7033 
  3193 
  7034 	__response: function( content ) {
  3194 	__response: function( content ) {
  7035 		if ( content ) {
  3195 		if ( content ) {
  7036 			content = this._normalize( content );
  3196 			content = this._normalize( content );
  7065 		}
  3225 		}
  7066 	},
  3226 	},
  7067 
  3227 
  7068 	_normalize: function( items ) {
  3228 	_normalize: function( items ) {
  7069 		// assume all items have the right format when the first item is complete
  3229 		// assume all items have the right format when the first item is complete
  7070 		if ( items.length && items[0].label && items[0].value ) {
  3230 		if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
  7071 			return items;
  3231 			return items;
  7072 		}
  3232 		}
  7073 		return $.map( items, function( item ) {
  3233 		return $.map( items, function( item ) {
  7074 			if ( typeof item === "string" ) {
  3234 			if ( typeof item === "string" ) {
  7075 				return {
  3235 				return {
  7076 					label: item,
  3236 					label: item,
  7077 					value: item
  3237 					value: item
  7078 				};
  3238 				};
  7079 			}
  3239 			}
  7080 			return $.extend({
  3240 			return $.extend( {}, item, {
  7081 				label: item.label || item.value,
  3241 				label: item.label || item.value,
  7082 				value: item.value || item.label
  3242 				value: item.value || item.label
  7083 			}, item );
  3243 			});
  7084 		});
  3244 		});
  7085 	},
  3245 	},
  7086 
  3246 
  7087 	_suggest: function( items ) {
  3247 	_suggest: function( items ) {
  7088 		var ul = this.menu.element.empty();
  3248 		var ul = this.menu.element.empty();
  7093 		// size and position menu
  3253 		// size and position menu
  7094 		ul.show();
  3254 		ul.show();
  7095 		this._resizeMenu();
  3255 		this._resizeMenu();
  7096 		ul.position( $.extend({
  3256 		ul.position( $.extend({
  7097 			of: this.element
  3257 			of: this.element
  7098 		}, this.options.position ));
  3258 		}, this.options.position ) );
  7099 
  3259 
  7100 		if ( this.options.autoFocus ) {
  3260 		if ( this.options.autoFocus ) {
  7101 			this.menu.next();
  3261 			this.menu.next();
  7102 		}
  3262 		}
  7103 	},
  3263 	},
  7122 	_renderItemData: function( ul, item ) {
  3282 	_renderItemData: function( ul, item ) {
  7123 		return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
  3283 		return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
  7124 	},
  3284 	},
  7125 
  3285 
  7126 	_renderItem: function( ul, item ) {
  3286 	_renderItem: function( ul, item ) {
  7127 		return $( "<li>" )
  3287 		return $( "<li>" ).text( item.label ).appendTo( ul );
  7128 			.append( $( "<a>" ).text( item.label ) )
       
  7129 			.appendTo( ul );
       
  7130 	},
  3288 	},
  7131 
  3289 
  7132 	_move: function( direction, event ) {
  3290 	_move: function( direction, event ) {
  7133 		if ( !this.menu.element.is( ":visible" ) ) {
  3291 		if ( !this.menu.element.is( ":visible" ) ) {
  7134 			this.search( null, event );
  3292 			this.search( null, event );
  7135 			return;
  3293 			return;
  7136 		}
  3294 		}
  7137 		if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
  3295 		if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
  7138 				this.menu.isLastItem() && /^next/.test( direction ) ) {
  3296 				this.menu.isLastItem() && /^next/.test( direction ) ) {
  7139 			this._value( this.term );
  3297 
       
  3298 			if ( !this.isMultiLine ) {
       
  3299 				this._value( this.term );
       
  3300 			}
       
  3301 
  7140 			this.menu.blur();
  3302 			this.menu.blur();
  7141 			return;
  3303 			return;
  7142 		}
  3304 		}
  7143 		this.menu[ direction ]( event );
  3305 		this.menu[ direction ]( event );
  7144 	},
  3306 	},
  7161 	}
  3323 	}
  7162 });
  3324 });
  7163 
  3325 
  7164 $.extend( $.ui.autocomplete, {
  3326 $.extend( $.ui.autocomplete, {
  7165 	escapeRegex: function( value ) {
  3327 	escapeRegex: function( value ) {
  7166 		return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
  3328 		return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
  7167 	},
  3329 	},
  7168 	filter: function(array, term) {
  3330 	filter: function( array, term ) {
  7169 		var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
  3331 		var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
  7170 		return $.grep( array, function(value) {
  3332 		return $.grep( array, function( value ) {
  7171 			return matcher.test( value.label || value.value || value );
  3333 			return matcher.test( value.label || value.value || value );
  7172 		});
  3334 		});
  7173 	}
  3335 	}
  7174 });
  3336 });
  7175 
       
  7176 
  3337 
  7177 // live region extension, adding a `messages` option
  3338 // live region extension, adding a `messages` option
  7178 // NOTE: This is an experimental API. We are still investigating
  3339 // NOTE: This is an experimental API. We are still investigating
  7179 // a full solution for string manipulation and internationalization.
  3340 // a full solution for string manipulation and internationalization.
  7180 $.widget( "ui.autocomplete", $.ui.autocomplete, {
  3341 $.widget( "ui.autocomplete", $.ui.autocomplete, {
  7197 		if ( content && content.length ) {
  3358 		if ( content && content.length ) {
  7198 			message = this.options.messages.results( content.length );
  3359 			message = this.options.messages.results( content.length );
  7199 		} else {
  3360 		} else {
  7200 			message = this.options.messages.noResults;
  3361 			message = this.options.messages.noResults;
  7201 		}
  3362 		}
  7202 		this.liveRegion.text( message );
  3363 		this.liveRegion.children().hide();
       
  3364 		$( "<div>" ).text( message ).appendTo( this.liveRegion );
  7203 	}
  3365 	}
  7204 });
  3366 });
  7205 
  3367 
  7206 }( jQuery ));
  3368 var autocomplete = $.ui.autocomplete;
  7207 
  3369 
  7208 (function( $, undefined ) {
  3370 
  7209 
  3371 /*!
  7210 var lastActive, startXPos, startYPos, clickDragged,
  3372  * jQuery UI Button 1.11.4
       
  3373  * http://jqueryui.com
       
  3374  *
       
  3375  * Copyright jQuery Foundation and other contributors
       
  3376  * Released under the MIT license.
       
  3377  * http://jquery.org/license
       
  3378  *
       
  3379  * http://api.jqueryui.com/button/
       
  3380  */
       
  3381 
       
  3382 
       
  3383 var lastActive,
  7211 	baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
  3384 	baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
  7212 	stateClasses = "ui-state-hover ui-state-active ",
       
  7213 	typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
  3385 	typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
  7214 	formResetHandler = function() {
  3386 	formResetHandler = function() {
  7215 		var form = $( this );
  3387 		var form = $( this );
  7216 		setTimeout(function() {
  3388 		setTimeout(function() {
  7217 			form.find( ":ui-button" ).button( "refresh" );
  3389 			form.find( ":ui-button" ).button( "refresh" );
  7222 			form = radio.form,
  3394 			form = radio.form,
  7223 			radios = $( [] );
  3395 			radios = $( [] );
  7224 		if ( name ) {
  3396 		if ( name ) {
  7225 			name = name.replace( /'/g, "\\'" );
  3397 			name = name.replace( /'/g, "\\'" );
  7226 			if ( form ) {
  3398 			if ( form ) {
  7227 				radios = $( form ).find( "[name='" + name + "']" );
  3399 				radios = $( form ).find( "[name='" + name + "'][type=radio]" );
  7228 			} else {
  3400 			} else {
  7229 				radios = $( "[name='" + name + "']", radio.ownerDocument )
  3401 				radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument )
  7230 					.filter(function() {
  3402 					.filter(function() {
  7231 						return !this.form;
  3403 						return !this.form;
  7232 					});
  3404 					});
  7233 			}
  3405 			}
  7234 		}
  3406 		}
  7235 		return radios;
  3407 		return radios;
  7236 	};
  3408 	};
  7237 
  3409 
  7238 $.widget( "ui.button", {
  3410 $.widget( "ui.button", {
  7239 	version: "1.10.3",
  3411 	version: "1.11.4",
  7240 	defaultElement: "<button>",
  3412 	defaultElement: "<button>",
  7241 	options: {
  3413 	options: {
  7242 		disabled: null,
  3414 		disabled: null,
  7243 		text: true,
  3415 		text: true,
  7244 		label: null,
  3416 		label: null,
  7262 		this.hasTitle = !!this.buttonElement.attr( "title" );
  3434 		this.hasTitle = !!this.buttonElement.attr( "title" );
  7263 
  3435 
  7264 		var that = this,
  3436 		var that = this,
  7265 			options = this.options,
  3437 			options = this.options,
  7266 			toggleButton = this.type === "checkbox" || this.type === "radio",
  3438 			toggleButton = this.type === "checkbox" || this.type === "radio",
  7267 			activeClass = !toggleButton ? "ui-state-active" : "",
  3439 			activeClass = !toggleButton ? "ui-state-active" : "";
  7268 			focusClass = "ui-state-focus";
       
  7269 
  3440 
  7270 		if ( options.label === null ) {
  3441 		if ( options.label === null ) {
  7271 			options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
  3442 			options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
  7272 		}
  3443 		}
  7273 
  3444 
  7295 					event.preventDefault();
  3466 					event.preventDefault();
  7296 					event.stopImmediatePropagation();
  3467 					event.stopImmediatePropagation();
  7297 				}
  3468 				}
  7298 			});
  3469 			});
  7299 
  3470 
  7300 		this.element
  3471 		// Can't use _focusable() because the element that receives focus
  7301 			.bind( "focus" + this.eventNamespace, function() {
  3472 		// and the element that gets the ui-state-focus class are different
  7302 				// no need to check disabled, focus won't be triggered anyway
  3473 		this._on({
  7303 				that.buttonElement.addClass( focusClass );
  3474 			focus: function() {
  7304 			})
  3475 				this.buttonElement.addClass( "ui-state-focus" );
  7305 			.bind( "blur" + this.eventNamespace, function() {
  3476 			},
  7306 				that.buttonElement.removeClass( focusClass );
  3477 			blur: function() {
  7307 			});
  3478 				this.buttonElement.removeClass( "ui-state-focus" );
       
  3479 			}
       
  3480 		});
  7308 
  3481 
  7309 		if ( toggleButton ) {
  3482 		if ( toggleButton ) {
  7310 			this.element.bind( "change" + this.eventNamespace, function() {
  3483 			this.element.bind( "change" + this.eventNamespace, function() {
  7311 				if ( clickDragged ) {
       
  7312 					return;
       
  7313 				}
       
  7314 				that.refresh();
  3484 				that.refresh();
  7315 			});
  3485 			});
  7316 			// if mouse moves between mousedown and mouseup (drag) set clickDragged flag
       
  7317 			// prevents issue where button state changes but checkbox/radio checked state
       
  7318 			// does not in Firefox (see ticket #6970)
       
  7319 			this.buttonElement
       
  7320 				.bind( "mousedown" + this.eventNamespace, function( event ) {
       
  7321 					if ( options.disabled ) {
       
  7322 						return;
       
  7323 					}
       
  7324 					clickDragged = false;
       
  7325 					startXPos = event.pageX;
       
  7326 					startYPos = event.pageY;
       
  7327 				})
       
  7328 				.bind( "mouseup" + this.eventNamespace, function( event ) {
       
  7329 					if ( options.disabled ) {
       
  7330 						return;
       
  7331 					}
       
  7332 					if ( startXPos !== event.pageX || startYPos !== event.pageY ) {
       
  7333 						clickDragged = true;
       
  7334 					}
       
  7335 			});
       
  7336 		}
  3486 		}
  7337 
  3487 
  7338 		if ( this.type === "checkbox" ) {
  3488 		if ( this.type === "checkbox" ) {
  7339 			this.buttonElement.bind( "click" + this.eventNamespace, function() {
  3489 			this.buttonElement.bind( "click" + this.eventNamespace, function() {
  7340 				if ( options.disabled || clickDragged ) {
  3490 				if ( options.disabled ) {
  7341 					return false;
  3491 					return false;
  7342 				}
  3492 				}
  7343 			});
  3493 			});
  7344 		} else if ( this.type === "radio" ) {
  3494 		} else if ( this.type === "radio" ) {
  7345 			this.buttonElement.bind( "click" + this.eventNamespace, function() {
  3495 			this.buttonElement.bind( "click" + this.eventNamespace, function() {
  7346 				if ( options.disabled || clickDragged ) {
  3496 				if ( options.disabled ) {
  7347 					return false;
  3497 					return false;
  7348 				}
  3498 				}
  7349 				$( this ).addClass( "ui-state-active" );
  3499 				$( this ).addClass( "ui-state-active" );
  7350 				that.buttonElement.attr( "aria-pressed", "true" );
  3500 				that.buttonElement.attr( "aria-pressed", "true" );
  7351 
  3501 
  7398 					}
  3548 					}
  7399 				});
  3549 				});
  7400 			}
  3550 			}
  7401 		}
  3551 		}
  7402 
  3552 
  7403 		// TODO: pull out $.Widget's handling for the disabled option into
       
  7404 		// $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
       
  7405 		// be overridden by individual plugins
       
  7406 		this._setOption( "disabled", options.disabled );
  3553 		this._setOption( "disabled", options.disabled );
  7407 		this._resetButton();
  3554 		this._resetButton();
  7408 	},
  3555 	},
  7409 
  3556 
  7410 	_determineButtonType: function() {
  3557 	_determineButtonType: function() {
  7451 
  3598 
  7452 	_destroy: function() {
  3599 	_destroy: function() {
  7453 		this.element
  3600 		this.element
  7454 			.removeClass( "ui-helper-hidden-accessible" );
  3601 			.removeClass( "ui-helper-hidden-accessible" );
  7455 		this.buttonElement
  3602 		this.buttonElement
  7456 			.removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
  3603 			.removeClass( baseClasses + " ui-state-active " + typeClasses )
  7457 			.removeAttr( "role" )
  3604 			.removeAttr( "role" )
  7458 			.removeAttr( "aria-pressed" )
  3605 			.removeAttr( "aria-pressed" )
  7459 			.html( this.buttonElement.find(".ui-button-text").html() );
  3606 			.html( this.buttonElement.find(".ui-button-text").html() );
  7460 
  3607 
  7461 		if ( !this.hasTitle ) {
  3608 		if ( !this.hasTitle ) {
  7464 	},
  3611 	},
  7465 
  3612 
  7466 	_setOption: function( key, value ) {
  3613 	_setOption: function( key, value ) {
  7467 		this._super( key, value );
  3614 		this._super( key, value );
  7468 		if ( key === "disabled" ) {
  3615 		if ( key === "disabled" ) {
       
  3616 			this.widget().toggleClass( "ui-state-disabled", !!value );
       
  3617 			this.element.prop( "disabled", !!value );
  7469 			if ( value ) {
  3618 			if ( value ) {
  7470 				this.element.prop( "disabled", true );
  3619 				if ( this.type === "checkbox" || this.type === "radio" ) {
  7471 			} else {
  3620 					this.buttonElement.removeClass( "ui-state-focus" );
  7472 				this.element.prop( "disabled", false );
  3621 				} else {
       
  3622 					this.buttonElement.removeClass( "ui-state-focus ui-state-active" );
       
  3623 				}
  7473 			}
  3624 			}
  7474 			return;
  3625 			return;
  7475 		}
  3626 		}
  7476 		this._resetButton();
  3627 		this._resetButton();
  7477 	},
  3628 	},
  7551 		buttonElement.addClass( buttonClasses.join( " " ) );
  3702 		buttonElement.addClass( buttonClasses.join( " " ) );
  7552 	}
  3703 	}
  7553 });
  3704 });
  7554 
  3705 
  7555 $.widget( "ui.buttonset", {
  3706 $.widget( "ui.buttonset", {
  7556 	version: "1.10.3",
  3707 	version: "1.11.4",
  7557 	options: {
  3708 	options: {
  7558 		items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
  3709 		items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
  7559 	},
  3710 	},
  7560 
  3711 
  7561 	_create: function() {
  3712 	_create: function() {
  7573 
  3724 
  7574 		this._super( key, value );
  3725 		this._super( key, value );
  7575 	},
  3726 	},
  7576 
  3727 
  7577 	refresh: function() {
  3728 	refresh: function() {
  7578 		var rtl = this.element.css( "direction" ) === "rtl";
  3729 		var rtl = this.element.css( "direction" ) === "rtl",
  7579 
  3730 			allButtons = this.element.find( this.options.items ),
  7580 		this.buttons = this.element.find( this.options.items )
  3731 			existingButtons = allButtons.filter( ":ui-button" );
  7581 			.filter( ":ui-button" )
  3732 
  7582 				.button( "refresh" )
  3733 		// Initialize new buttons
  7583 			.end()
  3734 		allButtons.not( ":ui-button" ).button();
  7584 			.not( ":ui-button" )
  3735 
  7585 				.button()
  3736 		// Refresh existing buttons
  7586 			.end()
  3737 		existingButtons.button( "refresh" );
       
  3738 
       
  3739 		this.buttons = allButtons
  7587 			.map(function() {
  3740 			.map(function() {
  7588 				return $( this ).button( "widget" )[ 0 ];
  3741 				return $( this ).button( "widget" )[ 0 ];
  7589 			})
  3742 			})
  7590 				.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
  3743 				.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
  7591 				.filter( ":first" )
  3744 				.filter( ":first" )
  7607 			.end()
  3760 			.end()
  7608 			.button( "destroy" );
  3761 			.button( "destroy" );
  7609 	}
  3762 	}
  7610 });
  3763 });
  7611 
  3764 
  7612 }( jQuery ) );
  3765 var button = $.ui.button;
  7613 
  3766 
  7614 (function( $, undefined ) {
  3767 
  7615 
  3768 /*!
  7616 $.extend($.ui, { datepicker: { version: "1.10.3" } });
  3769  * jQuery UI Datepicker 1.11.4
  7617 
  3770  * http://jqueryui.com
  7618 var PROP_NAME = "datepicker",
  3771  *
  7619 	instActive;
  3772  * Copyright jQuery Foundation and other contributors
  7620 
  3773  * Released under the MIT license.
       
  3774  * http://jquery.org/license
       
  3775  *
       
  3776  * http://api.jqueryui.com/datepicker/
       
  3777  */
       
  3778 
       
  3779 
       
  3780 $.extend($.ui, { datepicker: { version: "1.11.4" } });
       
  3781 
       
  3782 var datepicker_instActive;
       
  3783 
       
  3784 function datepicker_getZindex( elem ) {
       
  3785 	var position, value;
       
  3786 	while ( elem.length && elem[ 0 ] !== document ) {
       
  3787 		// Ignore z-index if position is set to a value where z-index is ignored by the browser
       
  3788 		// This makes behavior of this function consistent across browsers
       
  3789 		// WebKit always returns auto if the element is positioned
       
  3790 		position = elem.css( "position" );
       
  3791 		if ( position === "absolute" || position === "relative" || position === "fixed" ) {
       
  3792 			// IE returns 0 when zIndex is not specified
       
  3793 			// other browsers return a string
       
  3794 			// we ignore the case of nested elements with an explicit value of 0
       
  3795 			// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
       
  3796 			value = parseInt( elem.css( "zIndex" ), 10 );
       
  3797 			if ( !isNaN( value ) && value !== 0 ) {
       
  3798 				return value;
       
  3799 			}
       
  3800 		}
       
  3801 		elem = elem.parent();
       
  3802 	}
       
  3803 
       
  3804 	return 0;
       
  3805 }
  7621 /* Date picker manager.
  3806 /* Date picker manager.
  7622    Use the singleton instance of this class, $.datepicker, to interact with the date picker.
  3807    Use the singleton instance of this class, $.datepicker, to interact with the date picker.
  7623    Settings for (groups of) date pickers are maintained in an instance object,
  3808    Settings for (groups of) date pickers are maintained in an instance object,
  7624    allowing multiple different settings on the same page. */
  3809    allowing multiple different settings on the same page. */
  7625 
  3810 
  7706 		showButtonPanel: false, // True to show button panel, false to not show it
  3891 		showButtonPanel: false, // True to show button panel, false to not show it
  7707 		autoSize: false, // True to size the input for the date format, false to leave as is
  3892 		autoSize: false, // True to size the input for the date format, false to leave as is
  7708 		disabled: false // The initial disabled state
  3893 		disabled: false // The initial disabled state
  7709 	};
  3894 	};
  7710 	$.extend(this._defaults, this.regional[""]);
  3895 	$.extend(this._defaults, this.regional[""]);
  7711 	this.dpDiv = bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));
  3896 	this.regional.en = $.extend( true, {}, this.regional[ "" ]);
       
  3897 	this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
       
  3898 	this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));
  7712 }
  3899 }
  7713 
  3900 
  7714 $.extend(Datepicker.prototype, {
  3901 $.extend(Datepicker.prototype, {
  7715 	/* Class name added to elements to indicate already configured with a date picker. */
  3902 	/* Class name added to elements to indicate already configured with a date picker. */
  7716 	markerClassName: "hasDatepicker",
  3903 	markerClassName: "hasDatepicker",
  7726 	/* Override the default settings for all instances of the date picker.
  3913 	/* Override the default settings for all instances of the date picker.
  7727 	 * @param  settings  object - the new settings to use as defaults (anonymous object)
  3914 	 * @param  settings  object - the new settings to use as defaults (anonymous object)
  7728 	 * @return the manager object
  3915 	 * @return the manager object
  7729 	 */
  3916 	 */
  7730 	setDefaults: function(settings) {
  3917 	setDefaults: function(settings) {
  7731 		extendRemove(this._defaults, settings || {});
  3918 		datepicker_extendRemove(this._defaults, settings || {});
  7732 		return this;
  3919 		return this;
  7733 	},
  3920 	},
  7734 
  3921 
  7735 	/* Attach the date picker to a jQuery selection.
  3922 	/* Attach the date picker to a jQuery selection.
  7736 	 * @param  target	element - the target input field or division or span
  3923 	 * @param  target	element - the target input field or division or span
  7759 		return {id: id, input: target, // associated target
  3946 		return {id: id, input: target, // associated target
  7760 			selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
  3947 			selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
  7761 			drawMonth: 0, drawYear: 0, // month being drawn
  3948 			drawMonth: 0, drawYear: 0, // month being drawn
  7762 			inline: inline, // is datepicker inline or not
  3949 			inline: inline, // is datepicker inline or not
  7763 			dpDiv: (!inline ? this.dpDiv : // presentation div
  3950 			dpDiv: (!inline ? this.dpDiv : // presentation div
  7764 			bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))};
  3951 			datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))};
  7765 	},
  3952 	},
  7766 
  3953 
  7767 	/* Attach the date picker to an input field. */
  3954 	/* Attach the date picker to an input field. */
  7768 	_connectDatepicker: function(target, inst) {
  3955 	_connectDatepicker: function(target, inst) {
  7769 		var input = $(target);
  3956 		var input = $(target);
  7774 		}
  3961 		}
  7775 		this._attachments(input, inst);
  3962 		this._attachments(input, inst);
  7776 		input.addClass(this.markerClassName).keydown(this._doKeyDown).
  3963 		input.addClass(this.markerClassName).keydown(this._doKeyDown).
  7777 			keypress(this._doKeyPress).keyup(this._doKeyUp);
  3964 			keypress(this._doKeyPress).keyup(this._doKeyUp);
  7778 		this._autoSize(inst);
  3965 		this._autoSize(inst);
  7779 		$.data(target, PROP_NAME, inst);
  3966 		$.data(target, "datepicker", inst);
  7780 		//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
  3967 		//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
  7781 		if( inst.settings.disabled ) {
  3968 		if( inst.settings.disabled ) {
  7782 			this._disableDatepicker( target );
  3969 			this._disableDatepicker( target );
  7783 		}
  3970 		}
  7784 	},
  3971 	},
  7864 		var divSpan = $(target);
  4051 		var divSpan = $(target);
  7865 		if (divSpan.hasClass(this.markerClassName)) {
  4052 		if (divSpan.hasClass(this.markerClassName)) {
  7866 			return;
  4053 			return;
  7867 		}
  4054 		}
  7868 		divSpan.addClass(this.markerClassName).append(inst.dpDiv);
  4055 		divSpan.addClass(this.markerClassName).append(inst.dpDiv);
  7869 		$.data(target, PROP_NAME, inst);
  4056 		$.data(target, "datepicker", inst);
  7870 		this._setDate(inst, this._getDefaultDate(inst), true);
  4057 		this._setDate(inst, this._getDefaultDate(inst), true);
  7871 		this._updateDatepicker(inst);
  4058 		this._updateDatepicker(inst);
  7872 		this._updateAlternate(inst);
  4059 		this._updateAlternate(inst);
  7873 		//If disabled option is true, disable the datepicker before showing it (see ticket #5665)
  4060 		//If disabled option is true, disable the datepicker before showing it (see ticket #5665)
  7874 		if( inst.settings.disabled ) {
  4061 		if( inst.settings.disabled ) {
  7900 				"' style='position: absolute; top: -100px; width: 0px;'/>");
  4087 				"' style='position: absolute; top: -100px; width: 0px;'/>");
  7901 			this._dialogInput.keydown(this._doKeyDown);
  4088 			this._dialogInput.keydown(this._doKeyDown);
  7902 			$("body").append(this._dialogInput);
  4089 			$("body").append(this._dialogInput);
  7903 			inst = this._dialogInst = this._newInst(this._dialogInput, false);
  4090 			inst = this._dialogInst = this._newInst(this._dialogInput, false);
  7904 			inst.settings = {};
  4091 			inst.settings = {};
  7905 			$.data(this._dialogInput[0], PROP_NAME, inst);
  4092 			$.data(this._dialogInput[0], "datepicker", inst);
  7906 		}
  4093 		}
  7907 		extendRemove(inst.settings, settings || {});
  4094 		datepicker_extendRemove(inst.settings, settings || {});
  7908 		date = (date && date.constructor === Date ? this._formatDate(inst, date) : date);
  4095 		date = (date && date.constructor === Date ? this._formatDate(inst, date) : date);
  7909 		this._dialogInput.val(date);
  4096 		this._dialogInput.val(date);
  7910 
  4097 
  7911 		this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
  4098 		this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
  7912 		if (!this._pos) {
  4099 		if (!this._pos) {
  7925 		this.dpDiv.addClass(this._dialogClass);
  4112 		this.dpDiv.addClass(this._dialogClass);
  7926 		this._showDatepicker(this._dialogInput[0]);
  4113 		this._showDatepicker(this._dialogInput[0]);
  7927 		if ($.blockUI) {
  4114 		if ($.blockUI) {
  7928 			$.blockUI(this.dpDiv);
  4115 			$.blockUI(this.dpDiv);
  7929 		}
  4116 		}
  7930 		$.data(this._dialogInput[0], PROP_NAME, inst);
  4117 		$.data(this._dialogInput[0], "datepicker", inst);
  7931 		return this;
  4118 		return this;
  7932 	},
  4119 	},
  7933 
  4120 
  7934 	/* Detach a datepicker from its control.
  4121 	/* Detach a datepicker from its control.
  7935 	 * @param  target	element - the target input field or division or span
  4122 	 * @param  target	element - the target input field or division or span
  7936 	 */
  4123 	 */
  7937 	_destroyDatepicker: function(target) {
  4124 	_destroyDatepicker: function(target) {
  7938 		var nodeName,
  4125 		var nodeName,
  7939 			$target = $(target),
  4126 			$target = $(target),
  7940 			inst = $.data(target, PROP_NAME);
  4127 			inst = $.data(target, "datepicker");
  7941 
  4128 
  7942 		if (!$target.hasClass(this.markerClassName)) {
  4129 		if (!$target.hasClass(this.markerClassName)) {
  7943 			return;
  4130 			return;
  7944 		}
  4131 		}
  7945 
  4132 
  7946 		nodeName = target.nodeName.toLowerCase();
  4133 		nodeName = target.nodeName.toLowerCase();
  7947 		$.removeData(target, PROP_NAME);
  4134 		$.removeData(target, "datepicker");
  7948 		if (nodeName === "input") {
  4135 		if (nodeName === "input") {
  7949 			inst.append.remove();
  4136 			inst.append.remove();
  7950 			inst.trigger.remove();
  4137 			inst.trigger.remove();
  7951 			$target.removeClass(this.markerClassName).
  4138 			$target.removeClass(this.markerClassName).
  7952 				unbind("focus", this._showDatepicker).
  4139 				unbind("focus", this._showDatepicker).
  7954 				unbind("keypress", this._doKeyPress).
  4141 				unbind("keypress", this._doKeyPress).
  7955 				unbind("keyup", this._doKeyUp);
  4142 				unbind("keyup", this._doKeyUp);
  7956 		} else if (nodeName === "div" || nodeName === "span") {
  4143 		} else if (nodeName === "div" || nodeName === "span") {
  7957 			$target.removeClass(this.markerClassName).empty();
  4144 			$target.removeClass(this.markerClassName).empty();
  7958 		}
  4145 		}
       
  4146 
       
  4147 		if ( datepicker_instActive === inst ) {
       
  4148 			datepicker_instActive = null;
       
  4149 		}
  7959 	},
  4150 	},
  7960 
  4151 
  7961 	/* Enable the date picker to a jQuery selection.
  4152 	/* Enable the date picker to a jQuery selection.
  7962 	 * @param  target	element - the target input field or division or span
  4153 	 * @param  target	element - the target input field or division or span
  7963 	 */
  4154 	 */
  7964 	_enableDatepicker: function(target) {
  4155 	_enableDatepicker: function(target) {
  7965 		var nodeName, inline,
  4156 		var nodeName, inline,
  7966 			$target = $(target),
  4157 			$target = $(target),
  7967 			inst = $.data(target, PROP_NAME);
  4158 			inst = $.data(target, "datepicker");
  7968 
  4159 
  7969 		if (!$target.hasClass(this.markerClassName)) {
  4160 		if (!$target.hasClass(this.markerClassName)) {
  7970 			return;
  4161 			return;
  7971 		}
  4162 		}
  7972 
  4163 
  7990 	 * @param  target	element - the target input field or division or span
  4181 	 * @param  target	element - the target input field or division or span
  7991 	 */
  4182 	 */
  7992 	_disableDatepicker: function(target) {
  4183 	_disableDatepicker: function(target) {
  7993 		var nodeName, inline,
  4184 		var nodeName, inline,
  7994 			$target = $(target),
  4185 			$target = $(target),
  7995 			inst = $.data(target, PROP_NAME);
  4186 			inst = $.data(target, "datepicker");
  7996 
  4187 
  7997 		if (!$target.hasClass(this.markerClassName)) {
  4188 		if (!$target.hasClass(this.markerClassName)) {
  7998 			return;
  4189 			return;
  7999 		}
  4190 		}
  8000 
  4191 
  8036 	 * @return  object - the associated instance data
  4227 	 * @return  object - the associated instance data
  8037 	 * @throws  error if a jQuery problem getting data
  4228 	 * @throws  error if a jQuery problem getting data
  8038 	 */
  4229 	 */
  8039 	_getInst: function(target) {
  4230 	_getInst: function(target) {
  8040 		try {
  4231 		try {
  8041 			return $.data(target, PROP_NAME);
  4232 			return $.data(target, "datepicker");
  8042 		}
  4233 		}
  8043 		catch (err) {
  4234 		catch (err) {
  8044 			throw "Missing instance data for this datepicker";
  4235 			throw "Missing instance data for this datepicker";
  8045 		}
  4236 		}
  8046 	},
  4237 	},
  8076 			}
  4267 			}
  8077 
  4268 
  8078 			date = this._getDateDatepicker(target, true);
  4269 			date = this._getDateDatepicker(target, true);
  8079 			minDate = this._getMinMaxDate(inst, "min");
  4270 			minDate = this._getMinMaxDate(inst, "min");
  8080 			maxDate = this._getMinMaxDate(inst, "max");
  4271 			maxDate = this._getMinMaxDate(inst, "max");
  8081 			extendRemove(inst.settings, settings);
  4272 			datepicker_extendRemove(inst.settings, settings);
  8082 			// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
  4273 			// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
  8083 			if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
  4274 			if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
  8084 				inst.settings.minDate = this._formatDate(inst, minDate);
  4275 				inst.settings.minDate = this._formatDate(inst, minDate);
  8085 			}
  4276 			}
  8086 			if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) {
  4277 			if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) {
  8304 		beforeShow = $.datepicker._get(inst, "beforeShow");
  4495 		beforeShow = $.datepicker._get(inst, "beforeShow");
  8305 		beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
  4496 		beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
  8306 		if(beforeShowSettings === false){
  4497 		if(beforeShowSettings === false){
  8307 			return;
  4498 			return;
  8308 		}
  4499 		}
  8309 		extendRemove(inst.settings, beforeShowSettings);
  4500 		datepicker_extendRemove(inst.settings, beforeShowSettings);
  8310 
  4501 
  8311 		inst.lastVal = null;
  4502 		inst.lastVal = null;
  8312 		$.datepicker._lastInput = input;
  4503 		$.datepicker._lastInput = input;
  8313 		$.datepicker._setDateFromField(inst);
  4504 		$.datepicker._setDateFromField(inst);
  8314 
  4505 
  8341 			left: offset.left + "px", top: offset.top + "px"});
  4532 			left: offset.left + "px", top: offset.top + "px"});
  8342 
  4533 
  8343 		if (!inst.inline) {
  4534 		if (!inst.inline) {
  8344 			showAnim = $.datepicker._get(inst, "showAnim");
  4535 			showAnim = $.datepicker._get(inst, "showAnim");
  8345 			duration = $.datepicker._get(inst, "duration");
  4536 			duration = $.datepicker._get(inst, "duration");
  8346 			inst.dpDiv.zIndex($(input).zIndex()+1);
  4537 			inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
  8347 			$.datepicker._datepickerShowing = true;
  4538 			$.datepicker._datepickerShowing = true;
  8348 
  4539 
  8349 			if ( $.effects && $.effects.effect[ showAnim ] ) {
  4540 			if ( $.effects && $.effects.effect[ showAnim ] ) {
  8350 				inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
  4541 				inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
  8351 			} else {
  4542 			} else {
  8361 	},
  4552 	},
  8362 
  4553 
  8363 	/* Generate the date picker content. */
  4554 	/* Generate the date picker content. */
  8364 	_updateDatepicker: function(inst) {
  4555 	_updateDatepicker: function(inst) {
  8365 		this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
  4556 		this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
  8366 		instActive = inst; // for delegate hover events
  4557 		datepicker_instActive = inst; // for delegate hover events
  8367 		inst.dpDiv.empty().append(this._generateHTML(inst));
  4558 		inst.dpDiv.empty().append(this._generateHTML(inst));
  8368 		this._attachHandlers(inst);
  4559 		this._attachHandlers(inst);
  8369 		inst.dpDiv.find("." + this._dayOverClass + " a").mouseover();
       
  8370 
  4560 
  8371 		var origyearshtml,
  4561 		var origyearshtml,
  8372 			numMonths = this._getNumberOfMonths(inst),
  4562 			numMonths = this._getNumberOfMonths(inst),
  8373 			cols = numMonths[1],
  4563 			cols = numMonths[1],
  8374 			width = 17;
  4564 			width = 17,
       
  4565 			activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
       
  4566 
       
  4567 		if ( activeCell.length > 0 ) {
       
  4568 			datepicker_handleMouseover.apply( activeCell.get( 0 ) );
       
  4569 		}
  8375 
  4570 
  8376 		inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
  4571 		inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
  8377 		if (cols > 1) {
  4572 		if (cols > 1) {
  8378 			inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em");
  4573 			inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em");
  8379 		}
  4574 		}
  8447 	 */
  4642 	 */
  8448 	_hideDatepicker: function(input) {
  4643 	_hideDatepicker: function(input) {
  8449 		var showAnim, duration, postProcess, onClose,
  4644 		var showAnim, duration, postProcess, onClose,
  8450 			inst = this._curInst;
  4645 			inst = this._curInst;
  8451 
  4646 
  8452 		if (!inst || (input && inst !== $.data(input, PROP_NAME))) {
  4647 		if (!inst || (input && inst !== $.data(input, "datepicker"))) {
  8453 			return;
  4648 			return;
  8454 		}
  4649 		}
  8455 
  4650 
  8456 		if (this._datepickerShowing) {
  4651 		if (this._datepickerShowing) {
  8457 			showAnim = this._get(inst, "showAnim");
  4652 			showAnim = this._get(inst, "showAnim");
  8703 			// Extract a number from the string value
  4898 			// Extract a number from the string value
  8704 			getNumber = function(match) {
  4899 			getNumber = function(match) {
  8705 				var isDoubled = lookAhead(match),
  4900 				var isDoubled = lookAhead(match),
  8706 					size = (match === "@" ? 14 : (match === "!" ? 20 :
  4901 					size = (match === "@" ? 14 : (match === "!" ? 20 :
  8707 					(match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
  4902 					(match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
  8708 					digits = new RegExp("^\\d{1," + size + "}"),
  4903 					minSize = (match === "y" ? size : 1),
       
  4904 					digits = new RegExp("^\\d{" + minSize + "," + size + "}"),
  8709 					num = value.substring(iValue).match(digits);
  4905 					num = value.substring(iValue).match(digits);
  8710 				if (!num) {
  4906 				if (!num) {
  8711 					throw "Missing number at position " + iValue;
  4907 					throw "Missing number at position " + iValue;
  8712 				}
  4908 				}
  8713 				iValue += num[0].length;
  4909 				iValue += num[0].length;
  9297 					"</div><table class='ui-datepicker-calendar'><thead>" +
  5493 					"</div><table class='ui-datepicker-calendar'><thead>" +
  9298 					"<tr>";
  5494 					"<tr>";
  9299 				thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : "");
  5495 				thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : "");
  9300 				for (dow = 0; dow < 7; dow++) { // days of the week
  5496 				for (dow = 0; dow < 7; dow++) { // days of the week
  9301 					day = (dow + firstDay) % 7;
  5497 					day = (dow + firstDay) % 7;
  9302 					thead += "<th" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" +
  5498 					thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" +
  9303 						"<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>";
  5499 						"<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>";
  9304 				}
  5500 				}
  9305 				calender += thead + "</tr></thead><tbody>";
  5501 				calender += thead + "</tr></thead><tbody>";
  9306 				daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
  5502 				daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
  9307 				if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) {
  5503 				if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) {
  9551 });
  5747 });
  9552 
  5748 
  9553 /*
  5749 /*
  9554  * Bind hover events for datepicker elements.
  5750  * Bind hover events for datepicker elements.
  9555  * Done via delegate so the binding only occurs once in the lifetime of the parent div.
  5751  * Done via delegate so the binding only occurs once in the lifetime of the parent div.
  9556  * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
  5752  * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
  9557  */
  5753  */
  9558 function bindHover(dpDiv) {
  5754 function datepicker_bindHover(dpDiv) {
  9559 	var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
  5755 	var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
  9560 	return dpDiv.delegate(selector, "mouseout", function() {
  5756 	return dpDiv.delegate(selector, "mouseout", function() {
  9561 			$(this).removeClass("ui-state-hover");
  5757 			$(this).removeClass("ui-state-hover");
  9562 			if (this.className.indexOf("ui-datepicker-prev") !== -1) {
  5758 			if (this.className.indexOf("ui-datepicker-prev") !== -1) {
  9563 				$(this).removeClass("ui-datepicker-prev-hover");
  5759 				$(this).removeClass("ui-datepicker-prev-hover");
  9564 			}
  5760 			}
  9565 			if (this.className.indexOf("ui-datepicker-next") !== -1) {
  5761 			if (this.className.indexOf("ui-datepicker-next") !== -1) {
  9566 				$(this).removeClass("ui-datepicker-next-hover");
  5762 				$(this).removeClass("ui-datepicker-next-hover");
  9567 			}
  5763 			}
  9568 		})
  5764 		})
  9569 		.delegate(selector, "mouseover", function(){
  5765 		.delegate( selector, "mouseover", datepicker_handleMouseover );
  9570 			if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {
       
  9571 				$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
       
  9572 				$(this).addClass("ui-state-hover");
       
  9573 				if (this.className.indexOf("ui-datepicker-prev") !== -1) {
       
  9574 					$(this).addClass("ui-datepicker-prev-hover");
       
  9575 				}
       
  9576 				if (this.className.indexOf("ui-datepicker-next") !== -1) {
       
  9577 					$(this).addClass("ui-datepicker-next-hover");
       
  9578 				}
       
  9579 			}
       
  9580 		});
       
  9581 }
  5766 }
  9582 
  5767 
       
  5768 function datepicker_handleMouseover() {
       
  5769 	if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) {
       
  5770 		$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
       
  5771 		$(this).addClass("ui-state-hover");
       
  5772 		if (this.className.indexOf("ui-datepicker-prev") !== -1) {
       
  5773 			$(this).addClass("ui-datepicker-prev-hover");
       
  5774 		}
       
  5775 		if (this.className.indexOf("ui-datepicker-next") !== -1) {
       
  5776 			$(this).addClass("ui-datepicker-next-hover");
       
  5777 		}
       
  5778 	}
       
  5779 }
       
  5780 
  9583 /* jQuery extend now ignores nulls! */
  5781 /* jQuery extend now ignores nulls! */
  9584 function extendRemove(target, props) {
  5782 function datepicker_extendRemove(target, props) {
  9585 	$.extend(target, props);
  5783 	$.extend(target, props);
  9586 	for (var name in props) {
  5784 	for (var name in props) {
  9587 		if (props[name] == null) {
  5785 		if (props[name] == null) {
  9588 			target[name] = props[name];
  5786 			target[name] = props[name];
  9589 		}
  5787 		}
  9631 };
  5829 };
  9632 
  5830 
  9633 $.datepicker = new Datepicker(); // singleton instance
  5831 $.datepicker = new Datepicker(); // singleton instance
  9634 $.datepicker.initialized = false;
  5832 $.datepicker.initialized = false;
  9635 $.datepicker.uuid = new Date().getTime();
  5833 $.datepicker.uuid = new Date().getTime();
  9636 $.datepicker.version = "1.10.3";
  5834 $.datepicker.version = "1.11.4";
  9637 
  5835 
  9638 })(jQuery);
  5836 var datepicker = $.datepicker;
  9639 
  5837 
  9640 (function( $, undefined ) {
  5838 
  9641 
  5839 /*!
  9642 var sizeRelatedOptions = {
  5840  * jQuery UI Draggable 1.11.4
  9643 		buttons: true,
  5841  * http://jqueryui.com
  9644 		height: true,
  5842  *
  9645 		maxHeight: true,
  5843  * Copyright jQuery Foundation and other contributors
  9646 		maxWidth: true,
  5844  * Released under the MIT license.
  9647 		minHeight: true,
  5845  * http://jquery.org/license
  9648 		minWidth: true,
  5846  *
  9649 		width: true
  5847  * http://api.jqueryui.com/draggable/
  9650 	},
  5848  */
  9651 	resizableRelatedOptions = {
  5849 
  9652 		maxHeight: true,
  5850 
  9653 		maxWidth: true,
  5851 $.widget("ui.draggable", $.ui.mouse, {
  9654 		minHeight: true,
  5852 	version: "1.11.4",
  9655 		minWidth: true
  5853 	widgetEventPrefix: "drag",
  9656 	};
  5854 	options: {
  9657 
  5855 		addClasses: true,
  9658 $.widget( "ui.dialog", {
  5856 		appendTo: "parent",
  9659 	version: "1.10.3",
  5857 		axis: false,
       
  5858 		connectToSortable: false,
       
  5859 		containment: false,
       
  5860 		cursor: "auto",
       
  5861 		cursorAt: false,
       
  5862 		grid: false,
       
  5863 		handle: false,
       
  5864 		helper: "original",
       
  5865 		iframeFix: false,
       
  5866 		opacity: false,
       
  5867 		refreshPositions: false,
       
  5868 		revert: false,
       
  5869 		revertDuration: 500,
       
  5870 		scope: "default",
       
  5871 		scroll: true,
       
  5872 		scrollSensitivity: 20,
       
  5873 		scrollSpeed: 20,
       
  5874 		snap: false,
       
  5875 		snapMode: "both",
       
  5876 		snapTolerance: 20,
       
  5877 		stack: false,
       
  5878 		zIndex: false,
       
  5879 
       
  5880 		// callbacks
       
  5881 		drag: null,
       
  5882 		start: null,
       
  5883 		stop: null
       
  5884 	},
       
  5885 	_create: function() {
       
  5886 
       
  5887 		if ( this.options.helper === "original" ) {
       
  5888 			this._setPositionRelative();
       
  5889 		}
       
  5890 		if (this.options.addClasses){
       
  5891 			this.element.addClass("ui-draggable");
       
  5892 		}
       
  5893 		if (this.options.disabled){
       
  5894 			this.element.addClass("ui-draggable-disabled");
       
  5895 		}
       
  5896 		this._setHandleClassName();
       
  5897 
       
  5898 		this._mouseInit();
       
  5899 	},
       
  5900 
       
  5901 	_setOption: function( key, value ) {
       
  5902 		this._super( key, value );
       
  5903 		if ( key === "handle" ) {
       
  5904 			this._removeHandleClassName();
       
  5905 			this._setHandleClassName();
       
  5906 		}
       
  5907 	},
       
  5908 
       
  5909 	_destroy: function() {
       
  5910 		if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
       
  5911 			this.destroyOnClear = true;
       
  5912 			return;
       
  5913 		}
       
  5914 		this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
       
  5915 		this._removeHandleClassName();
       
  5916 		this._mouseDestroy();
       
  5917 	},
       
  5918 
       
  5919 	_mouseCapture: function(event) {
       
  5920 		var o = this.options;
       
  5921 
       
  5922 		this._blurActiveElement( event );
       
  5923 
       
  5924 		// among others, prevent a drag on a resizable-handle
       
  5925 		if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
       
  5926 			return false;
       
  5927 		}
       
  5928 
       
  5929 		//Quit if we're not on a valid handle
       
  5930 		this.handle = this._getHandle(event);
       
  5931 		if (!this.handle) {
       
  5932 			return false;
       
  5933 		}
       
  5934 
       
  5935 		this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
       
  5936 
       
  5937 		return true;
       
  5938 
       
  5939 	},
       
  5940 
       
  5941 	_blockFrames: function( selector ) {
       
  5942 		this.iframeBlocks = this.document.find( selector ).map(function() {
       
  5943 			var iframe = $( this );
       
  5944 
       
  5945 			return $( "<div>" )
       
  5946 				.css( "position", "absolute" )
       
  5947 				.appendTo( iframe.parent() )
       
  5948 				.outerWidth( iframe.outerWidth() )
       
  5949 				.outerHeight( iframe.outerHeight() )
       
  5950 				.offset( iframe.offset() )[ 0 ];
       
  5951 		});
       
  5952 	},
       
  5953 
       
  5954 	_unblockFrames: function() {
       
  5955 		if ( this.iframeBlocks ) {
       
  5956 			this.iframeBlocks.remove();
       
  5957 			delete this.iframeBlocks;
       
  5958 		}
       
  5959 	},
       
  5960 
       
  5961 	_blurActiveElement: function( event ) {
       
  5962 		var document = this.document[ 0 ];
       
  5963 
       
  5964 		// Only need to blur if the event occurred on the draggable itself, see #10527
       
  5965 		if ( !this.handleElement.is( event.target ) ) {
       
  5966 			return;
       
  5967 		}
       
  5968 
       
  5969 		// support: IE9
       
  5970 		// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
       
  5971 		try {
       
  5972 
       
  5973 			// Support: IE9, IE10
       
  5974 			// If the <body> is blurred, IE will switch windows, see #9520
       
  5975 			if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
       
  5976 
       
  5977 				// Blur any element that currently has focus, see #4261
       
  5978 				$( document.activeElement ).blur();
       
  5979 			}
       
  5980 		} catch ( error ) {}
       
  5981 	},
       
  5982 
       
  5983 	_mouseStart: function(event) {
       
  5984 
       
  5985 		var o = this.options;
       
  5986 
       
  5987 		//Create and append the visible helper
       
  5988 		this.helper = this._createHelper(event);
       
  5989 
       
  5990 		this.helper.addClass("ui-draggable-dragging");
       
  5991 
       
  5992 		//Cache the helper size
       
  5993 		this._cacheHelperProportions();
       
  5994 
       
  5995 		//If ddmanager is used for droppables, set the global draggable
       
  5996 		if ($.ui.ddmanager) {
       
  5997 			$.ui.ddmanager.current = this;
       
  5998 		}
       
  5999 
       
  6000 		/*
       
  6001 		 * - Position generation -
       
  6002 		 * This block generates everything position related - it's the core of draggables.
       
  6003 		 */
       
  6004 
       
  6005 		//Cache the margins of the original element
       
  6006 		this._cacheMargins();
       
  6007 
       
  6008 		//Store the helper's css position
       
  6009 		this.cssPosition = this.helper.css( "position" );
       
  6010 		this.scrollParent = this.helper.scrollParent( true );
       
  6011 		this.offsetParent = this.helper.offsetParent();
       
  6012 		this.hasFixedAncestor = this.helper.parents().filter(function() {
       
  6013 				return $( this ).css( "position" ) === "fixed";
       
  6014 			}).length > 0;
       
  6015 
       
  6016 		//The element's absolute position on the page minus margins
       
  6017 		this.positionAbs = this.element.offset();
       
  6018 		this._refreshOffsets( event );
       
  6019 
       
  6020 		//Generate the original position
       
  6021 		this.originalPosition = this.position = this._generatePosition( event, false );
       
  6022 		this.originalPageX = event.pageX;
       
  6023 		this.originalPageY = event.pageY;
       
  6024 
       
  6025 		//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
       
  6026 		(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
       
  6027 
       
  6028 		//Set a containment if given in the options
       
  6029 		this._setContainment();
       
  6030 
       
  6031 		//Trigger event + callbacks
       
  6032 		if (this._trigger("start", event) === false) {
       
  6033 			this._clear();
       
  6034 			return false;
       
  6035 		}
       
  6036 
       
  6037 		//Recache the helper size
       
  6038 		this._cacheHelperProportions();
       
  6039 
       
  6040 		//Prepare the droppable offsets
       
  6041 		if ($.ui.ddmanager && !o.dropBehaviour) {
       
  6042 			$.ui.ddmanager.prepareOffsets(this, event);
       
  6043 		}
       
  6044 
       
  6045 		// Reset helper's right/bottom css if they're set and set explicit width/height instead
       
  6046 		// as this prevents resizing of elements with right/bottom set (see #7772)
       
  6047 		this._normalizeRightBottom();
       
  6048 
       
  6049 		this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
       
  6050 
       
  6051 		//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
       
  6052 		if ( $.ui.ddmanager ) {
       
  6053 			$.ui.ddmanager.dragStart(this, event);
       
  6054 		}
       
  6055 
       
  6056 		return true;
       
  6057 	},
       
  6058 
       
  6059 	_refreshOffsets: function( event ) {
       
  6060 		this.offset = {
       
  6061 			top: this.positionAbs.top - this.margins.top,
       
  6062 			left: this.positionAbs.left - this.margins.left,
       
  6063 			scroll: false,
       
  6064 			parent: this._getParentOffset(),
       
  6065 			relative: this._getRelativeOffset()
       
  6066 		};
       
  6067 
       
  6068 		this.offset.click = {
       
  6069 			left: event.pageX - this.offset.left,
       
  6070 			top: event.pageY - this.offset.top
       
  6071 		};
       
  6072 	},
       
  6073 
       
  6074 	_mouseDrag: function(event, noPropagation) {
       
  6075 		// reset any necessary cached properties (see #5009)
       
  6076 		if ( this.hasFixedAncestor ) {
       
  6077 			this.offset.parent = this._getParentOffset();
       
  6078 		}
       
  6079 
       
  6080 		//Compute the helpers position
       
  6081 		this.position = this._generatePosition( event, true );
       
  6082 		this.positionAbs = this._convertPositionTo("absolute");
       
  6083 
       
  6084 		//Call plugins and callbacks and use the resulting position if something is returned
       
  6085 		if (!noPropagation) {
       
  6086 			var ui = this._uiHash();
       
  6087 			if (this._trigger("drag", event, ui) === false) {
       
  6088 				this._mouseUp({});
       
  6089 				return false;
       
  6090 			}
       
  6091 			this.position = ui.position;
       
  6092 		}
       
  6093 
       
  6094 		this.helper[ 0 ].style.left = this.position.left + "px";
       
  6095 		this.helper[ 0 ].style.top = this.position.top + "px";
       
  6096 
       
  6097 		if ($.ui.ddmanager) {
       
  6098 			$.ui.ddmanager.drag(this, event);
       
  6099 		}
       
  6100 
       
  6101 		return false;
       
  6102 	},
       
  6103 
       
  6104 	_mouseStop: function(event) {
       
  6105 
       
  6106 		//If we are using droppables, inform the manager about the drop
       
  6107 		var that = this,
       
  6108 			dropped = false;
       
  6109 		if ($.ui.ddmanager && !this.options.dropBehaviour) {
       
  6110 			dropped = $.ui.ddmanager.drop(this, event);
       
  6111 		}
       
  6112 
       
  6113 		//if a drop comes from outside (a sortable)
       
  6114 		if (this.dropped) {
       
  6115 			dropped = this.dropped;
       
  6116 			this.dropped = false;
       
  6117 		}
       
  6118 
       
  6119 		if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
       
  6120 			$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
       
  6121 				if (that._trigger("stop", event) !== false) {
       
  6122 					that._clear();
       
  6123 				}
       
  6124 			});
       
  6125 		} else {
       
  6126 			if (this._trigger("stop", event) !== false) {
       
  6127 				this._clear();
       
  6128 			}
       
  6129 		}
       
  6130 
       
  6131 		return false;
       
  6132 	},
       
  6133 
       
  6134 	_mouseUp: function( event ) {
       
  6135 		this._unblockFrames();
       
  6136 
       
  6137 		//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
       
  6138 		if ( $.ui.ddmanager ) {
       
  6139 			$.ui.ddmanager.dragStop(this, event);
       
  6140 		}
       
  6141 
       
  6142 		// Only need to focus if the event occurred on the draggable itself, see #10527
       
  6143 		if ( this.handleElement.is( event.target ) ) {
       
  6144 			// The interaction is over; whether or not the click resulted in a drag, focus the element
       
  6145 			this.element.focus();
       
  6146 		}
       
  6147 
       
  6148 		return $.ui.mouse.prototype._mouseUp.call(this, event);
       
  6149 	},
       
  6150 
       
  6151 	cancel: function() {
       
  6152 
       
  6153 		if (this.helper.is(".ui-draggable-dragging")) {
       
  6154 			this._mouseUp({});
       
  6155 		} else {
       
  6156 			this._clear();
       
  6157 		}
       
  6158 
       
  6159 		return this;
       
  6160 
       
  6161 	},
       
  6162 
       
  6163 	_getHandle: function(event) {
       
  6164 		return this.options.handle ?
       
  6165 			!!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
       
  6166 			true;
       
  6167 	},
       
  6168 
       
  6169 	_setHandleClassName: function() {
       
  6170 		this.handleElement = this.options.handle ?
       
  6171 			this.element.find( this.options.handle ) : this.element;
       
  6172 		this.handleElement.addClass( "ui-draggable-handle" );
       
  6173 	},
       
  6174 
       
  6175 	_removeHandleClassName: function() {
       
  6176 		this.handleElement.removeClass( "ui-draggable-handle" );
       
  6177 	},
       
  6178 
       
  6179 	_createHelper: function(event) {
       
  6180 
       
  6181 		var o = this.options,
       
  6182 			helperIsFunction = $.isFunction( o.helper ),
       
  6183 			helper = helperIsFunction ?
       
  6184 				$( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
       
  6185 				( o.helper === "clone" ?
       
  6186 					this.element.clone().removeAttr( "id" ) :
       
  6187 					this.element );
       
  6188 
       
  6189 		if (!helper.parents("body").length) {
       
  6190 			helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
       
  6191 		}
       
  6192 
       
  6193 		// http://bugs.jqueryui.com/ticket/9446
       
  6194 		// a helper function can return the original element
       
  6195 		// which wouldn't have been set to relative in _create
       
  6196 		if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
       
  6197 			this._setPositionRelative();
       
  6198 		}
       
  6199 
       
  6200 		if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
       
  6201 			helper.css("position", "absolute");
       
  6202 		}
       
  6203 
       
  6204 		return helper;
       
  6205 
       
  6206 	},
       
  6207 
       
  6208 	_setPositionRelative: function() {
       
  6209 		if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
       
  6210 			this.element[ 0 ].style.position = "relative";
       
  6211 		}
       
  6212 	},
       
  6213 
       
  6214 	_adjustOffsetFromHelper: function(obj) {
       
  6215 		if (typeof obj === "string") {
       
  6216 			obj = obj.split(" ");
       
  6217 		}
       
  6218 		if ($.isArray(obj)) {
       
  6219 			obj = { left: +obj[0], top: +obj[1] || 0 };
       
  6220 		}
       
  6221 		if ("left" in obj) {
       
  6222 			this.offset.click.left = obj.left + this.margins.left;
       
  6223 		}
       
  6224 		if ("right" in obj) {
       
  6225 			this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
       
  6226 		}
       
  6227 		if ("top" in obj) {
       
  6228 			this.offset.click.top = obj.top + this.margins.top;
       
  6229 		}
       
  6230 		if ("bottom" in obj) {
       
  6231 			this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
       
  6232 		}
       
  6233 	},
       
  6234 
       
  6235 	_isRootNode: function( element ) {
       
  6236 		return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
       
  6237 	},
       
  6238 
       
  6239 	_getParentOffset: function() {
       
  6240 
       
  6241 		//Get the offsetParent and cache its position
       
  6242 		var po = this.offsetParent.offset(),
       
  6243 			document = this.document[ 0 ];
       
  6244 
       
  6245 		// This is a special case where we need to modify a offset calculated on start, since the following happened:
       
  6246 		// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
       
  6247 		// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
       
  6248 		//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
       
  6249 		if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
       
  6250 			po.left += this.scrollParent.scrollLeft();
       
  6251 			po.top += this.scrollParent.scrollTop();
       
  6252 		}
       
  6253 
       
  6254 		if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
       
  6255 			po = { top: 0, left: 0 };
       
  6256 		}
       
  6257 
       
  6258 		return {
       
  6259 			top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
       
  6260 			left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
       
  6261 		};
       
  6262 
       
  6263 	},
       
  6264 
       
  6265 	_getRelativeOffset: function() {
       
  6266 		if ( this.cssPosition !== "relative" ) {
       
  6267 			return { top: 0, left: 0 };
       
  6268 		}
       
  6269 
       
  6270 		var p = this.element.position(),
       
  6271 			scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
       
  6272 
       
  6273 		return {
       
  6274 			top: p.top - ( parseInt(this.helper.css( "top" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
       
  6275 			left: p.left - ( parseInt(this.helper.css( "left" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
       
  6276 		};
       
  6277 
       
  6278 	},
       
  6279 
       
  6280 	_cacheMargins: function() {
       
  6281 		this.margins = {
       
  6282 			left: (parseInt(this.element.css("marginLeft"), 10) || 0),
       
  6283 			top: (parseInt(this.element.css("marginTop"), 10) || 0),
       
  6284 			right: (parseInt(this.element.css("marginRight"), 10) || 0),
       
  6285 			bottom: (parseInt(this.element.css("marginBottom"), 10) || 0)
       
  6286 		};
       
  6287 	},
       
  6288 
       
  6289 	_cacheHelperProportions: function() {
       
  6290 		this.helperProportions = {
       
  6291 			width: this.helper.outerWidth(),
       
  6292 			height: this.helper.outerHeight()
       
  6293 		};
       
  6294 	},
       
  6295 
       
  6296 	_setContainment: function() {
       
  6297 
       
  6298 		var isUserScrollable, c, ce,
       
  6299 			o = this.options,
       
  6300 			document = this.document[ 0 ];
       
  6301 
       
  6302 		this.relativeContainer = null;
       
  6303 
       
  6304 		if ( !o.containment ) {
       
  6305 			this.containment = null;
       
  6306 			return;
       
  6307 		}
       
  6308 
       
  6309 		if ( o.containment === "window" ) {
       
  6310 			this.containment = [
       
  6311 				$( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
       
  6312 				$( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
       
  6313 				$( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left,
       
  6314 				$( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
       
  6315 			];
       
  6316 			return;
       
  6317 		}
       
  6318 
       
  6319 		if ( o.containment === "document") {
       
  6320 			this.containment = [
       
  6321 				0,
       
  6322 				0,
       
  6323 				$( document ).width() - this.helperProportions.width - this.margins.left,
       
  6324 				( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
       
  6325 			];
       
  6326 			return;
       
  6327 		}
       
  6328 
       
  6329 		if ( o.containment.constructor === Array ) {
       
  6330 			this.containment = o.containment;
       
  6331 			return;
       
  6332 		}
       
  6333 
       
  6334 		if ( o.containment === "parent" ) {
       
  6335 			o.containment = this.helper[ 0 ].parentNode;
       
  6336 		}
       
  6337 
       
  6338 		c = $( o.containment );
       
  6339 		ce = c[ 0 ];
       
  6340 
       
  6341 		if ( !ce ) {
       
  6342 			return;
       
  6343 		}
       
  6344 
       
  6345 		isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
       
  6346 
       
  6347 		this.containment = [
       
  6348 			( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
       
  6349 			( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
       
  6350 			( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
       
  6351 				( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
       
  6352 				( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
       
  6353 				this.helperProportions.width -
       
  6354 				this.margins.left -
       
  6355 				this.margins.right,
       
  6356 			( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
       
  6357 				( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
       
  6358 				( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
       
  6359 				this.helperProportions.height -
       
  6360 				this.margins.top -
       
  6361 				this.margins.bottom
       
  6362 		];
       
  6363 		this.relativeContainer = c;
       
  6364 	},
       
  6365 
       
  6366 	_convertPositionTo: function(d, pos) {
       
  6367 
       
  6368 		if (!pos) {
       
  6369 			pos = this.position;
       
  6370 		}
       
  6371 
       
  6372 		var mod = d === "absolute" ? 1 : -1,
       
  6373 			scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
       
  6374 
       
  6375 		return {
       
  6376 			top: (
       
  6377 				pos.top	+																// The absolute mouse position
       
  6378 				this.offset.relative.top * mod +										// Only for relative positioned nodes: Relative offset from element to offset parent
       
  6379 				this.offset.parent.top * mod -										// The offsetParent's offset without borders (offset + border)
       
  6380 				( ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod)
       
  6381 			),
       
  6382 			left: (
       
  6383 				pos.left +																// The absolute mouse position
       
  6384 				this.offset.relative.left * mod +										// Only for relative positioned nodes: Relative offset from element to offset parent
       
  6385 				this.offset.parent.left * mod	-										// The offsetParent's offset without borders (offset + border)
       
  6386 				( ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod)
       
  6387 			)
       
  6388 		};
       
  6389 
       
  6390 	},
       
  6391 
       
  6392 	_generatePosition: function( event, constrainPosition ) {
       
  6393 
       
  6394 		var containment, co, top, left,
       
  6395 			o = this.options,
       
  6396 			scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
       
  6397 			pageX = event.pageX,
       
  6398 			pageY = event.pageY;
       
  6399 
       
  6400 		// Cache the scroll
       
  6401 		if ( !scrollIsRootNode || !this.offset.scroll ) {
       
  6402 			this.offset.scroll = {
       
  6403 				top: this.scrollParent.scrollTop(),
       
  6404 				left: this.scrollParent.scrollLeft()
       
  6405 			};
       
  6406 		}
       
  6407 
       
  6408 		/*
       
  6409 		 * - Position constraining -
       
  6410 		 * Constrain the position to a mix of grid, containment.
       
  6411 		 */
       
  6412 
       
  6413 		// If we are not dragging yet, we won't check for options
       
  6414 		if ( constrainPosition ) {
       
  6415 			if ( this.containment ) {
       
  6416 				if ( this.relativeContainer ){
       
  6417 					co = this.relativeContainer.offset();
       
  6418 					containment = [
       
  6419 						this.containment[ 0 ] + co.left,
       
  6420 						this.containment[ 1 ] + co.top,
       
  6421 						this.containment[ 2 ] + co.left,
       
  6422 						this.containment[ 3 ] + co.top
       
  6423 					];
       
  6424 				} else {
       
  6425 					containment = this.containment;
       
  6426 				}
       
  6427 
       
  6428 				if (event.pageX - this.offset.click.left < containment[0]) {
       
  6429 					pageX = containment[0] + this.offset.click.left;
       
  6430 				}
       
  6431 				if (event.pageY - this.offset.click.top < containment[1]) {
       
  6432 					pageY = containment[1] + this.offset.click.top;
       
  6433 				}
       
  6434 				if (event.pageX - this.offset.click.left > containment[2]) {
       
  6435 					pageX = containment[2] + this.offset.click.left;
       
  6436 				}
       
  6437 				if (event.pageY - this.offset.click.top > containment[3]) {
       
  6438 					pageY = containment[3] + this.offset.click.top;
       
  6439 				}
       
  6440 			}
       
  6441 
       
  6442 			if (o.grid) {
       
  6443 				//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
       
  6444 				top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
       
  6445 				pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
       
  6446 
       
  6447 				left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
       
  6448 				pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
       
  6449 			}
       
  6450 
       
  6451 			if ( o.axis === "y" ) {
       
  6452 				pageX = this.originalPageX;
       
  6453 			}
       
  6454 
       
  6455 			if ( o.axis === "x" ) {
       
  6456 				pageY = this.originalPageY;
       
  6457 			}
       
  6458 		}
       
  6459 
       
  6460 		return {
       
  6461 			top: (
       
  6462 				pageY -																	// The absolute mouse position
       
  6463 				this.offset.click.top	-												// Click offset (relative to the element)
       
  6464 				this.offset.relative.top -												// Only for relative positioned nodes: Relative offset from element to offset parent
       
  6465 				this.offset.parent.top +												// The offsetParent's offset without borders (offset + border)
       
  6466 				( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
       
  6467 			),
       
  6468 			left: (
       
  6469 				pageX -																	// The absolute mouse position
       
  6470 				this.offset.click.left -												// Click offset (relative to the element)
       
  6471 				this.offset.relative.left -												// Only for relative positioned nodes: Relative offset from element to offset parent
       
  6472 				this.offset.parent.left +												// The offsetParent's offset without borders (offset + border)
       
  6473 				( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
       
  6474 			)
       
  6475 		};
       
  6476 
       
  6477 	},
       
  6478 
       
  6479 	_clear: function() {
       
  6480 		this.helper.removeClass("ui-draggable-dragging");
       
  6481 		if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
       
  6482 			this.helper.remove();
       
  6483 		}
       
  6484 		this.helper = null;
       
  6485 		this.cancelHelperRemoval = false;
       
  6486 		if ( this.destroyOnClear ) {
       
  6487 			this.destroy();
       
  6488 		}
       
  6489 	},
       
  6490 
       
  6491 	_normalizeRightBottom: function() {
       
  6492 		if ( this.options.axis !== "y" && this.helper.css( "right" ) !== "auto" ) {
       
  6493 			this.helper.width( this.helper.width() );
       
  6494 			this.helper.css( "right", "auto" );
       
  6495 		}
       
  6496 		if ( this.options.axis !== "x" && this.helper.css( "bottom" ) !== "auto" ) {
       
  6497 			this.helper.height( this.helper.height() );
       
  6498 			this.helper.css( "bottom", "auto" );
       
  6499 		}
       
  6500 	},
       
  6501 
       
  6502 	// From now on bulk stuff - mainly helpers
       
  6503 
       
  6504 	_trigger: function( type, event, ui ) {
       
  6505 		ui = ui || this._uiHash();
       
  6506 		$.ui.plugin.call( this, type, [ event, ui, this ], true );
       
  6507 
       
  6508 		// Absolute position and offset (see #6884 ) have to be recalculated after plugins
       
  6509 		if ( /^(drag|start|stop)/.test( type ) ) {
       
  6510 			this.positionAbs = this._convertPositionTo( "absolute" );
       
  6511 			ui.offset = this.positionAbs;
       
  6512 		}
       
  6513 		return $.Widget.prototype._trigger.call( this, type, event, ui );
       
  6514 	},
       
  6515 
       
  6516 	plugins: {},
       
  6517 
       
  6518 	_uiHash: function() {
       
  6519 		return {
       
  6520 			helper: this.helper,
       
  6521 			position: this.position,
       
  6522 			originalPosition: this.originalPosition,
       
  6523 			offset: this.positionAbs
       
  6524 		};
       
  6525 	}
       
  6526 
       
  6527 });
       
  6528 
       
  6529 $.ui.plugin.add( "draggable", "connectToSortable", {
       
  6530 	start: function( event, ui, draggable ) {
       
  6531 		var uiSortable = $.extend( {}, ui, {
       
  6532 			item: draggable.element
       
  6533 		});
       
  6534 
       
  6535 		draggable.sortables = [];
       
  6536 		$( draggable.options.connectToSortable ).each(function() {
       
  6537 			var sortable = $( this ).sortable( "instance" );
       
  6538 
       
  6539 			if ( sortable && !sortable.options.disabled ) {
       
  6540 				draggable.sortables.push( sortable );
       
  6541 
       
  6542 				// refreshPositions is called at drag start to refresh the containerCache
       
  6543 				// which is used in drag. This ensures it's initialized and synchronized
       
  6544 				// with any changes that might have happened on the page since initialization.
       
  6545 				sortable.refreshPositions();
       
  6546 				sortable._trigger("activate", event, uiSortable);
       
  6547 			}
       
  6548 		});
       
  6549 	},
       
  6550 	stop: function( event, ui, draggable ) {
       
  6551 		var uiSortable = $.extend( {}, ui, {
       
  6552 			item: draggable.element
       
  6553 		});
       
  6554 
       
  6555 		draggable.cancelHelperRemoval = false;
       
  6556 
       
  6557 		$.each( draggable.sortables, function() {
       
  6558 			var sortable = this;
       
  6559 
       
  6560 			if ( sortable.isOver ) {
       
  6561 				sortable.isOver = 0;
       
  6562 
       
  6563 				// Allow this sortable to handle removing the helper
       
  6564 				draggable.cancelHelperRemoval = true;
       
  6565 				sortable.cancelHelperRemoval = false;
       
  6566 
       
  6567 				// Use _storedCSS To restore properties in the sortable,
       
  6568 				// as this also handles revert (#9675) since the draggable
       
  6569 				// may have modified them in unexpected ways (#8809)
       
  6570 				sortable._storedCSS = {
       
  6571 					position: sortable.placeholder.css( "position" ),
       
  6572 					top: sortable.placeholder.css( "top" ),
       
  6573 					left: sortable.placeholder.css( "left" )
       
  6574 				};
       
  6575 
       
  6576 				sortable._mouseStop(event);
       
  6577 
       
  6578 				// Once drag has ended, the sortable should return to using
       
  6579 				// its original helper, not the shared helper from draggable
       
  6580 				sortable.options.helper = sortable.options._helper;
       
  6581 			} else {
       
  6582 				// Prevent this Sortable from removing the helper.
       
  6583 				// However, don't set the draggable to remove the helper
       
  6584 				// either as another connected Sortable may yet handle the removal.
       
  6585 				sortable.cancelHelperRemoval = true;
       
  6586 
       
  6587 				sortable._trigger( "deactivate", event, uiSortable );
       
  6588 			}
       
  6589 		});
       
  6590 	},
       
  6591 	drag: function( event, ui, draggable ) {
       
  6592 		$.each( draggable.sortables, function() {
       
  6593 			var innermostIntersecting = false,
       
  6594 				sortable = this;
       
  6595 
       
  6596 			// Copy over variables that sortable's _intersectsWith uses
       
  6597 			sortable.positionAbs = draggable.positionAbs;
       
  6598 			sortable.helperProportions = draggable.helperProportions;
       
  6599 			sortable.offset.click = draggable.offset.click;
       
  6600 
       
  6601 			if ( sortable._intersectsWith( sortable.containerCache ) ) {
       
  6602 				innermostIntersecting = true;
       
  6603 
       
  6604 				$.each( draggable.sortables, function() {
       
  6605 					// Copy over variables that sortable's _intersectsWith uses
       
  6606 					this.positionAbs = draggable.positionAbs;
       
  6607 					this.helperProportions = draggable.helperProportions;
       
  6608 					this.offset.click = draggable.offset.click;
       
  6609 
       
  6610 					if ( this !== sortable &&
       
  6611 							this._intersectsWith( this.containerCache ) &&
       
  6612 							$.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
       
  6613 						innermostIntersecting = false;
       
  6614 					}
       
  6615 
       
  6616 					return innermostIntersecting;
       
  6617 				});
       
  6618 			}
       
  6619 
       
  6620 			if ( innermostIntersecting ) {
       
  6621 				// If it intersects, we use a little isOver variable and set it once,
       
  6622 				// so that the move-in stuff gets fired only once.
       
  6623 				if ( !sortable.isOver ) {
       
  6624 					sortable.isOver = 1;
       
  6625 
       
  6626 					// Store draggable's parent in case we need to reappend to it later.
       
  6627 					draggable._parent = ui.helper.parent();
       
  6628 
       
  6629 					sortable.currentItem = ui.helper
       
  6630 						.appendTo( sortable.element )
       
  6631 						.data( "ui-sortable-item", true );
       
  6632 
       
  6633 					// Store helper option to later restore it
       
  6634 					sortable.options._helper = sortable.options.helper;
       
  6635 
       
  6636 					sortable.options.helper = function() {
       
  6637 						return ui.helper[ 0 ];
       
  6638 					};
       
  6639 
       
  6640 					// Fire the start events of the sortable with our passed browser event,
       
  6641 					// and our own helper (so it doesn't create a new one)
       
  6642 					event.target = sortable.currentItem[ 0 ];
       
  6643 					sortable._mouseCapture( event, true );
       
  6644 					sortable._mouseStart( event, true, true );
       
  6645 
       
  6646 					// Because the browser event is way off the new appended portlet,
       
  6647 					// modify necessary variables to reflect the changes
       
  6648 					sortable.offset.click.top = draggable.offset.click.top;
       
  6649 					sortable.offset.click.left = draggable.offset.click.left;
       
  6650 					sortable.offset.parent.left -= draggable.offset.parent.left -
       
  6651 						sortable.offset.parent.left;
       
  6652 					sortable.offset.parent.top -= draggable.offset.parent.top -
       
  6653 						sortable.offset.parent.top;
       
  6654 
       
  6655 					draggable._trigger( "toSortable", event );
       
  6656 
       
  6657 					// Inform draggable that the helper is in a valid drop zone,
       
  6658 					// used solely in the revert option to handle "valid/invalid".
       
  6659 					draggable.dropped = sortable.element;
       
  6660 
       
  6661 					// Need to refreshPositions of all sortables in the case that
       
  6662 					// adding to one sortable changes the location of the other sortables (#9675)
       
  6663 					$.each( draggable.sortables, function() {
       
  6664 						this.refreshPositions();
       
  6665 					});
       
  6666 
       
  6667 					// hack so receive/update callbacks work (mostly)
       
  6668 					draggable.currentItem = draggable.element;
       
  6669 					sortable.fromOutside = draggable;
       
  6670 				}
       
  6671 
       
  6672 				if ( sortable.currentItem ) {
       
  6673 					sortable._mouseDrag( event );
       
  6674 					// Copy the sortable's position because the draggable's can potentially reflect
       
  6675 					// a relative position, while sortable is always absolute, which the dragged
       
  6676 					// element has now become. (#8809)
       
  6677 					ui.position = sortable.position;
       
  6678 				}
       
  6679 			} else {
       
  6680 				// If it doesn't intersect with the sortable, and it intersected before,
       
  6681 				// we fake the drag stop of the sortable, but make sure it doesn't remove
       
  6682 				// the helper by using cancelHelperRemoval.
       
  6683 				if ( sortable.isOver ) {
       
  6684 
       
  6685 					sortable.isOver = 0;
       
  6686 					sortable.cancelHelperRemoval = true;
       
  6687 
       
  6688 					// Calling sortable's mouseStop would trigger a revert,
       
  6689 					// so revert must be temporarily false until after mouseStop is called.
       
  6690 					sortable.options._revert = sortable.options.revert;
       
  6691 					sortable.options.revert = false;
       
  6692 
       
  6693 					sortable._trigger( "out", event, sortable._uiHash( sortable ) );
       
  6694 					sortable._mouseStop( event, true );
       
  6695 
       
  6696 					// restore sortable behaviors that were modfied
       
  6697 					// when the draggable entered the sortable area (#9481)
       
  6698 					sortable.options.revert = sortable.options._revert;
       
  6699 					sortable.options.helper = sortable.options._helper;
       
  6700 
       
  6701 					if ( sortable.placeholder ) {
       
  6702 						sortable.placeholder.remove();
       
  6703 					}
       
  6704 
       
  6705 					// Restore and recalculate the draggable's offset considering the sortable
       
  6706 					// may have modified them in unexpected ways. (#8809, #10669)
       
  6707 					ui.helper.appendTo( draggable._parent );
       
  6708 					draggable._refreshOffsets( event );
       
  6709 					ui.position = draggable._generatePosition( event, true );
       
  6710 
       
  6711 					draggable._trigger( "fromSortable", event );
       
  6712 
       
  6713 					// Inform draggable that the helper is no longer in a valid drop zone
       
  6714 					draggable.dropped = false;
       
  6715 
       
  6716 					// Need to refreshPositions of all sortables just in case removing
       
  6717 					// from one sortable changes the location of other sortables (#9675)
       
  6718 					$.each( draggable.sortables, function() {
       
  6719 						this.refreshPositions();
       
  6720 					});
       
  6721 				}
       
  6722 			}
       
  6723 		});
       
  6724 	}
       
  6725 });
       
  6726 
       
  6727 $.ui.plugin.add("draggable", "cursor", {
       
  6728 	start: function( event, ui, instance ) {
       
  6729 		var t = $( "body" ),
       
  6730 			o = instance.options;
       
  6731 
       
  6732 		if (t.css("cursor")) {
       
  6733 			o._cursor = t.css("cursor");
       
  6734 		}
       
  6735 		t.css("cursor", o.cursor);
       
  6736 	},
       
  6737 	stop: function( event, ui, instance ) {
       
  6738 		var o = instance.options;
       
  6739 		if (o._cursor) {
       
  6740 			$("body").css("cursor", o._cursor);
       
  6741 		}
       
  6742 	}
       
  6743 });
       
  6744 
       
  6745 $.ui.plugin.add("draggable", "opacity", {
       
  6746 	start: function( event, ui, instance ) {
       
  6747 		var t = $( ui.helper ),
       
  6748 			o = instance.options;
       
  6749 		if (t.css("opacity")) {
       
  6750 			o._opacity = t.css("opacity");
       
  6751 		}
       
  6752 		t.css("opacity", o.opacity);
       
  6753 	},
       
  6754 	stop: function( event, ui, instance ) {
       
  6755 		var o = instance.options;
       
  6756 		if (o._opacity) {
       
  6757 			$(ui.helper).css("opacity", o._opacity);
       
  6758 		}
       
  6759 	}
       
  6760 });
       
  6761 
       
  6762 $.ui.plugin.add("draggable", "scroll", {
       
  6763 	start: function( event, ui, i ) {
       
  6764 		if ( !i.scrollParentNotHidden ) {
       
  6765 			i.scrollParentNotHidden = i.helper.scrollParent( false );
       
  6766 		}
       
  6767 
       
  6768 		if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
       
  6769 			i.overflowOffset = i.scrollParentNotHidden.offset();
       
  6770 		}
       
  6771 	},
       
  6772 	drag: function( event, ui, i  ) {
       
  6773 
       
  6774 		var o = i.options,
       
  6775 			scrolled = false,
       
  6776 			scrollParent = i.scrollParentNotHidden[ 0 ],
       
  6777 			document = i.document[ 0 ];
       
  6778 
       
  6779 		if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
       
  6780 			if ( !o.axis || o.axis !== "x" ) {
       
  6781 				if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < o.scrollSensitivity ) {
       
  6782 					scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
       
  6783 				} else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
       
  6784 					scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
       
  6785 				}
       
  6786 			}
       
  6787 
       
  6788 			if ( !o.axis || o.axis !== "y" ) {
       
  6789 				if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < o.scrollSensitivity ) {
       
  6790 					scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
       
  6791 				} else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
       
  6792 					scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
       
  6793 				}
       
  6794 			}
       
  6795 
       
  6796 		} else {
       
  6797 
       
  6798 			if (!o.axis || o.axis !== "x") {
       
  6799 				if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
       
  6800 					scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
       
  6801 				} else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
       
  6802 					scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
       
  6803 				}
       
  6804 			}
       
  6805 
       
  6806 			if (!o.axis || o.axis !== "y") {
       
  6807 				if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
       
  6808 					scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
       
  6809 				} else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
       
  6810 					scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
       
  6811 				}
       
  6812 			}
       
  6813 
       
  6814 		}
       
  6815 
       
  6816 		if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
       
  6817 			$.ui.ddmanager.prepareOffsets(i, event);
       
  6818 		}
       
  6819 
       
  6820 	}
       
  6821 });
       
  6822 
       
  6823 $.ui.plugin.add("draggable", "snap", {
       
  6824 	start: function( event, ui, i ) {
       
  6825 
       
  6826 		var o = i.options;
       
  6827 
       
  6828 		i.snapElements = [];
       
  6829 
       
  6830 		$(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
       
  6831 			var $t = $(this),
       
  6832 				$o = $t.offset();
       
  6833 			if (this !== i.element[0]) {
       
  6834 				i.snapElements.push({
       
  6835 					item: this,
       
  6836 					width: $t.outerWidth(), height: $t.outerHeight(),
       
  6837 					top: $o.top, left: $o.left
       
  6838 				});
       
  6839 			}
       
  6840 		});
       
  6841 
       
  6842 	},
       
  6843 	drag: function( event, ui, inst ) {
       
  6844 
       
  6845 		var ts, bs, ls, rs, l, r, t, b, i, first,
       
  6846 			o = inst.options,
       
  6847 			d = o.snapTolerance,
       
  6848 			x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
       
  6849 			y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
       
  6850 
       
  6851 		for (i = inst.snapElements.length - 1; i >= 0; i--){
       
  6852 
       
  6853 			l = inst.snapElements[i].left - inst.margins.left;
       
  6854 			r = l + inst.snapElements[i].width;
       
  6855 			t = inst.snapElements[i].top - inst.margins.top;
       
  6856 			b = t + inst.snapElements[i].height;
       
  6857 
       
  6858 			if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
       
  6859 				if (inst.snapElements[i].snapping) {
       
  6860 					(inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
       
  6861 				}
       
  6862 				inst.snapElements[i].snapping = false;
       
  6863 				continue;
       
  6864 			}
       
  6865 
       
  6866 			if (o.snapMode !== "inner") {
       
  6867 				ts = Math.abs(t - y2) <= d;
       
  6868 				bs = Math.abs(b - y1) <= d;
       
  6869 				ls = Math.abs(l - x2) <= d;
       
  6870 				rs = Math.abs(r - x1) <= d;
       
  6871 				if (ts) {
       
  6872 					ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
       
  6873 				}
       
  6874 				if (bs) {
       
  6875 					ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top;
       
  6876 				}
       
  6877 				if (ls) {
       
  6878 					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
       
  6879 				}
       
  6880 				if (rs) {
       
  6881 					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
       
  6882 				}
       
  6883 			}
       
  6884 
       
  6885 			first = (ts || bs || ls || rs);
       
  6886 
       
  6887 			if (o.snapMode !== "outer") {
       
  6888 				ts = Math.abs(t - y1) <= d;
       
  6889 				bs = Math.abs(b - y2) <= d;
       
  6890 				ls = Math.abs(l - x1) <= d;
       
  6891 				rs = Math.abs(r - x2) <= d;
       
  6892 				if (ts) {
       
  6893 					ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top;
       
  6894 				}
       
  6895 				if (bs) {
       
  6896 					ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
       
  6897 				}
       
  6898 				if (ls) {
       
  6899 					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
       
  6900 				}
       
  6901 				if (rs) {
       
  6902 					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
       
  6903 				}
       
  6904 			}
       
  6905 
       
  6906 			if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
       
  6907 				(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
       
  6908 			}
       
  6909 			inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
       
  6910 
       
  6911 		}
       
  6912 
       
  6913 	}
       
  6914 });
       
  6915 
       
  6916 $.ui.plugin.add("draggable", "stack", {
       
  6917 	start: function( event, ui, instance ) {
       
  6918 		var min,
       
  6919 			o = instance.options,
       
  6920 			group = $.makeArray($(o.stack)).sort(function(a, b) {
       
  6921 				return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0);
       
  6922 			});
       
  6923 
       
  6924 		if (!group.length) { return; }
       
  6925 
       
  6926 		min = parseInt($(group[0]).css("zIndex"), 10) || 0;
       
  6927 		$(group).each(function(i) {
       
  6928 			$(this).css("zIndex", min + i);
       
  6929 		});
       
  6930 		this.css("zIndex", (min + group.length));
       
  6931 	}
       
  6932 });
       
  6933 
       
  6934 $.ui.plugin.add("draggable", "zIndex", {
       
  6935 	start: function( event, ui, instance ) {
       
  6936 		var t = $( ui.helper ),
       
  6937 			o = instance.options;
       
  6938 
       
  6939 		if (t.css("zIndex")) {
       
  6940 			o._zIndex = t.css("zIndex");
       
  6941 		}
       
  6942 		t.css("zIndex", o.zIndex);
       
  6943 	},
       
  6944 	stop: function( event, ui, instance ) {
       
  6945 		var o = instance.options;
       
  6946 
       
  6947 		if (o._zIndex) {
       
  6948 			$(ui.helper).css("zIndex", o._zIndex);
       
  6949 		}
       
  6950 	}
       
  6951 });
       
  6952 
       
  6953 var draggable = $.ui.draggable;
       
  6954 
       
  6955 
       
  6956 /*!
       
  6957  * jQuery UI Resizable 1.11.4
       
  6958  * http://jqueryui.com
       
  6959  *
       
  6960  * Copyright jQuery Foundation and other contributors
       
  6961  * Released under the MIT license.
       
  6962  * http://jquery.org/license
       
  6963  *
       
  6964  * http://api.jqueryui.com/resizable/
       
  6965  */
       
  6966 
       
  6967 
       
  6968 $.widget("ui.resizable", $.ui.mouse, {
       
  6969 	version: "1.11.4",
       
  6970 	widgetEventPrefix: "resize",
       
  6971 	options: {
       
  6972 		alsoResize: false,
       
  6973 		animate: false,
       
  6974 		animateDuration: "slow",
       
  6975 		animateEasing: "swing",
       
  6976 		aspectRatio: false,
       
  6977 		autoHide: false,
       
  6978 		containment: false,
       
  6979 		ghost: false,
       
  6980 		grid: false,
       
  6981 		handles: "e,s,se",
       
  6982 		helper: false,
       
  6983 		maxHeight: null,
       
  6984 		maxWidth: null,
       
  6985 		minHeight: 10,
       
  6986 		minWidth: 10,
       
  6987 		// See #7960
       
  6988 		zIndex: 90,
       
  6989 
       
  6990 		// callbacks
       
  6991 		resize: null,
       
  6992 		start: null,
       
  6993 		stop: null
       
  6994 	},
       
  6995 
       
  6996 	_num: function( value ) {
       
  6997 		return parseInt( value, 10 ) || 0;
       
  6998 	},
       
  6999 
       
  7000 	_isNumber: function( value ) {
       
  7001 		return !isNaN( parseInt( value, 10 ) );
       
  7002 	},
       
  7003 
       
  7004 	_hasScroll: function( el, a ) {
       
  7005 
       
  7006 		if ( $( el ).css( "overflow" ) === "hidden") {
       
  7007 			return false;
       
  7008 		}
       
  7009 
       
  7010 		var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
       
  7011 			has = false;
       
  7012 
       
  7013 		if ( el[ scroll ] > 0 ) {
       
  7014 			return true;
       
  7015 		}
       
  7016 
       
  7017 		// TODO: determine which cases actually cause this to happen
       
  7018 		// if the element doesn't have the scroll set, see if it's possible to
       
  7019 		// set the scroll
       
  7020 		el[ scroll ] = 1;
       
  7021 		has = ( el[ scroll ] > 0 );
       
  7022 		el[ scroll ] = 0;
       
  7023 		return has;
       
  7024 	},
       
  7025 
       
  7026 	_create: function() {
       
  7027 
       
  7028 		var n, i, handle, axis, hname,
       
  7029 			that = this,
       
  7030 			o = this.options;
       
  7031 		this.element.addClass("ui-resizable");
       
  7032 
       
  7033 		$.extend(this, {
       
  7034 			_aspectRatio: !!(o.aspectRatio),
       
  7035 			aspectRatio: o.aspectRatio,
       
  7036 			originalElement: this.element,
       
  7037 			_proportionallyResizeElements: [],
       
  7038 			_helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
       
  7039 		});
       
  7040 
       
  7041 		// Wrap the element if it cannot hold child nodes
       
  7042 		if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) {
       
  7043 
       
  7044 			this.element.wrap(
       
  7045 				$("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
       
  7046 					position: this.element.css("position"),
       
  7047 					width: this.element.outerWidth(),
       
  7048 					height: this.element.outerHeight(),
       
  7049 					top: this.element.css("top"),
       
  7050 					left: this.element.css("left")
       
  7051 				})
       
  7052 			);
       
  7053 
       
  7054 			this.element = this.element.parent().data(
       
  7055 				"ui-resizable", this.element.resizable( "instance" )
       
  7056 			);
       
  7057 
       
  7058 			this.elementIsWrapper = true;
       
  7059 
       
  7060 			this.element.css({
       
  7061 				marginLeft: this.originalElement.css("marginLeft"),
       
  7062 				marginTop: this.originalElement.css("marginTop"),
       
  7063 				marginRight: this.originalElement.css("marginRight"),
       
  7064 				marginBottom: this.originalElement.css("marginBottom")
       
  7065 			});
       
  7066 			this.originalElement.css({
       
  7067 				marginLeft: 0,
       
  7068 				marginTop: 0,
       
  7069 				marginRight: 0,
       
  7070 				marginBottom: 0
       
  7071 			});
       
  7072 			// support: Safari
       
  7073 			// Prevent Safari textarea resize
       
  7074 			this.originalResizeStyle = this.originalElement.css("resize");
       
  7075 			this.originalElement.css("resize", "none");
       
  7076 
       
  7077 			this._proportionallyResizeElements.push( this.originalElement.css({
       
  7078 				position: "static",
       
  7079 				zoom: 1,
       
  7080 				display: "block"
       
  7081 			}) );
       
  7082 
       
  7083 			// support: IE9
       
  7084 			// avoid IE jump (hard set the margin)
       
  7085 			this.originalElement.css({ margin: this.originalElement.css("margin") });
       
  7086 
       
  7087 			this._proportionallyResize();
       
  7088 		}
       
  7089 
       
  7090 		this.handles = o.handles ||
       
  7091 			( !$(".ui-resizable-handle", this.element).length ?
       
  7092 				"e,s,se" : {
       
  7093 					n: ".ui-resizable-n",
       
  7094 					e: ".ui-resizable-e",
       
  7095 					s: ".ui-resizable-s",
       
  7096 					w: ".ui-resizable-w",
       
  7097 					se: ".ui-resizable-se",
       
  7098 					sw: ".ui-resizable-sw",
       
  7099 					ne: ".ui-resizable-ne",
       
  7100 					nw: ".ui-resizable-nw"
       
  7101 				} );
       
  7102 
       
  7103 		this._handles = $();
       
  7104 		if ( this.handles.constructor === String ) {
       
  7105 
       
  7106 			if ( this.handles === "all") {
       
  7107 				this.handles = "n,e,s,w,se,sw,ne,nw";
       
  7108 			}
       
  7109 
       
  7110 			n = this.handles.split(",");
       
  7111 			this.handles = {};
       
  7112 
       
  7113 			for (i = 0; i < n.length; i++) {
       
  7114 
       
  7115 				handle = $.trim(n[i]);
       
  7116 				hname = "ui-resizable-" + handle;
       
  7117 				axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
       
  7118 
       
  7119 				axis.css({ zIndex: o.zIndex });
       
  7120 
       
  7121 				// TODO : What's going on here?
       
  7122 				if ("se" === handle) {
       
  7123 					axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
       
  7124 				}
       
  7125 
       
  7126 				this.handles[handle] = ".ui-resizable-" + handle;
       
  7127 				this.element.append(axis);
       
  7128 			}
       
  7129 
       
  7130 		}
       
  7131 
       
  7132 		this._renderAxis = function(target) {
       
  7133 
       
  7134 			var i, axis, padPos, padWrapper;
       
  7135 
       
  7136 			target = target || this.element;
       
  7137 
       
  7138 			for (i in this.handles) {
       
  7139 
       
  7140 				if (this.handles[i].constructor === String) {
       
  7141 					this.handles[i] = this.element.children( this.handles[ i ] ).first().show();
       
  7142 				} else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
       
  7143 					this.handles[ i ] = $( this.handles[ i ] );
       
  7144 					this._on( this.handles[ i ], { "mousedown": that._mouseDown });
       
  7145 				}
       
  7146 
       
  7147 				if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)) {
       
  7148 
       
  7149 					axis = $(this.handles[i], this.element);
       
  7150 
       
  7151 					padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
       
  7152 
       
  7153 					padPos = [ "padding",
       
  7154 						/ne|nw|n/.test(i) ? "Top" :
       
  7155 						/se|sw|s/.test(i) ? "Bottom" :
       
  7156 						/^e$/.test(i) ? "Right" : "Left" ].join("");
       
  7157 
       
  7158 					target.css(padPos, padWrapper);
       
  7159 
       
  7160 					this._proportionallyResize();
       
  7161 				}
       
  7162 
       
  7163 				this._handles = this._handles.add( this.handles[ i ] );
       
  7164 			}
       
  7165 		};
       
  7166 
       
  7167 		// TODO: make renderAxis a prototype function
       
  7168 		this._renderAxis(this.element);
       
  7169 
       
  7170 		this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
       
  7171 		this._handles.disableSelection();
       
  7172 
       
  7173 		this._handles.mouseover(function() {
       
  7174 			if (!that.resizing) {
       
  7175 				if (this.className) {
       
  7176 					axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
       
  7177 				}
       
  7178 				that.axis = axis && axis[1] ? axis[1] : "se";
       
  7179 			}
       
  7180 		});
       
  7181 
       
  7182 		if (o.autoHide) {
       
  7183 			this._handles.hide();
       
  7184 			$(this.element)
       
  7185 				.addClass("ui-resizable-autohide")
       
  7186 				.mouseenter(function() {
       
  7187 					if (o.disabled) {
       
  7188 						return;
       
  7189 					}
       
  7190 					$(this).removeClass("ui-resizable-autohide");
       
  7191 					that._handles.show();
       
  7192 				})
       
  7193 				.mouseleave(function() {
       
  7194 					if (o.disabled) {
       
  7195 						return;
       
  7196 					}
       
  7197 					if (!that.resizing) {
       
  7198 						$(this).addClass("ui-resizable-autohide");
       
  7199 						that._handles.hide();
       
  7200 					}
       
  7201 				});
       
  7202 		}
       
  7203 
       
  7204 		this._mouseInit();
       
  7205 	},
       
  7206 
       
  7207 	_destroy: function() {
       
  7208 
       
  7209 		this._mouseDestroy();
       
  7210 
       
  7211 		var wrapper,
       
  7212 			_destroy = function(exp) {
       
  7213 				$(exp)
       
  7214 					.removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
       
  7215 					.removeData("resizable")
       
  7216 					.removeData("ui-resizable")
       
  7217 					.unbind(".resizable")
       
  7218 					.find(".ui-resizable-handle")
       
  7219 						.remove();
       
  7220 			};
       
  7221 
       
  7222 		// TODO: Unwrap at same DOM position
       
  7223 		if (this.elementIsWrapper) {
       
  7224 			_destroy(this.element);
       
  7225 			wrapper = this.element;
       
  7226 			this.originalElement.css({
       
  7227 				position: wrapper.css("position"),
       
  7228 				width: wrapper.outerWidth(),
       
  7229 				height: wrapper.outerHeight(),
       
  7230 				top: wrapper.css("top"),
       
  7231 				left: wrapper.css("left")
       
  7232 			}).insertAfter( wrapper );
       
  7233 			wrapper.remove();
       
  7234 		}
       
  7235 
       
  7236 		this.originalElement.css("resize", this.originalResizeStyle);
       
  7237 		_destroy(this.originalElement);
       
  7238 
       
  7239 		return this;
       
  7240 	},
       
  7241 
       
  7242 	_mouseCapture: function(event) {
       
  7243 		var i, handle,
       
  7244 			capture = false;
       
  7245 
       
  7246 		for (i in this.handles) {
       
  7247 			handle = $(this.handles[i])[0];
       
  7248 			if (handle === event.target || $.contains(handle, event.target)) {
       
  7249 				capture = true;
       
  7250 			}
       
  7251 		}
       
  7252 
       
  7253 		return !this.options.disabled && capture;
       
  7254 	},
       
  7255 
       
  7256 	_mouseStart: function(event) {
       
  7257 
       
  7258 		var curleft, curtop, cursor,
       
  7259 			o = this.options,
       
  7260 			el = this.element;
       
  7261 
       
  7262 		this.resizing = true;
       
  7263 
       
  7264 		this._renderProxy();
       
  7265 
       
  7266 		curleft = this._num(this.helper.css("left"));
       
  7267 		curtop = this._num(this.helper.css("top"));
       
  7268 
       
  7269 		if (o.containment) {
       
  7270 			curleft += $(o.containment).scrollLeft() || 0;
       
  7271 			curtop += $(o.containment).scrollTop() || 0;
       
  7272 		}
       
  7273 
       
  7274 		this.offset = this.helper.offset();
       
  7275 		this.position = { left: curleft, top: curtop };
       
  7276 
       
  7277 		this.size = this._helper ? {
       
  7278 				width: this.helper.width(),
       
  7279 				height: this.helper.height()
       
  7280 			} : {
       
  7281 				width: el.width(),
       
  7282 				height: el.height()
       
  7283 			};
       
  7284 
       
  7285 		this.originalSize = this._helper ? {
       
  7286 				width: el.outerWidth(),
       
  7287 				height: el.outerHeight()
       
  7288 			} : {
       
  7289 				width: el.width(),
       
  7290 				height: el.height()
       
  7291 			};
       
  7292 
       
  7293 		this.sizeDiff = {
       
  7294 			width: el.outerWidth() - el.width(),
       
  7295 			height: el.outerHeight() - el.height()
       
  7296 		};
       
  7297 
       
  7298 		this.originalPosition = { left: curleft, top: curtop };
       
  7299 		this.originalMousePosition = { left: event.pageX, top: event.pageY };
       
  7300 
       
  7301 		this.aspectRatio = (typeof o.aspectRatio === "number") ?
       
  7302 			o.aspectRatio :
       
  7303 			((this.originalSize.width / this.originalSize.height) || 1);
       
  7304 
       
  7305 		cursor = $(".ui-resizable-" + this.axis).css("cursor");
       
  7306 		$("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
       
  7307 
       
  7308 		el.addClass("ui-resizable-resizing");
       
  7309 		this._propagate("start", event);
       
  7310 		return true;
       
  7311 	},
       
  7312 
       
  7313 	_mouseDrag: function(event) {
       
  7314 
       
  7315 		var data, props,
       
  7316 			smp = this.originalMousePosition,
       
  7317 			a = this.axis,
       
  7318 			dx = (event.pageX - smp.left) || 0,
       
  7319 			dy = (event.pageY - smp.top) || 0,
       
  7320 			trigger = this._change[a];
       
  7321 
       
  7322 		this._updatePrevProperties();
       
  7323 
       
  7324 		if (!trigger) {
       
  7325 			return false;
       
  7326 		}
       
  7327 
       
  7328 		data = trigger.apply(this, [ event, dx, dy ]);
       
  7329 
       
  7330 		this._updateVirtualBoundaries(event.shiftKey);
       
  7331 		if (this._aspectRatio || event.shiftKey) {
       
  7332 			data = this._updateRatio(data, event);
       
  7333 		}
       
  7334 
       
  7335 		data = this._respectSize(data, event);
       
  7336 
       
  7337 		this._updateCache(data);
       
  7338 
       
  7339 		this._propagate("resize", event);
       
  7340 
       
  7341 		props = this._applyChanges();
       
  7342 
       
  7343 		if ( !this._helper && this._proportionallyResizeElements.length ) {
       
  7344 			this._proportionallyResize();
       
  7345 		}
       
  7346 
       
  7347 		if ( !$.isEmptyObject( props ) ) {
       
  7348 			this._updatePrevProperties();
       
  7349 			this._trigger( "resize", event, this.ui() );
       
  7350 			this._applyChanges();
       
  7351 		}
       
  7352 
       
  7353 		return false;
       
  7354 	},
       
  7355 
       
  7356 	_mouseStop: function(event) {
       
  7357 
       
  7358 		this.resizing = false;
       
  7359 		var pr, ista, soffseth, soffsetw, s, left, top,
       
  7360 			o = this.options, that = this;
       
  7361 
       
  7362 		if (this._helper) {
       
  7363 
       
  7364 			pr = this._proportionallyResizeElements;
       
  7365 			ista = pr.length && (/textarea/i).test(pr[0].nodeName);
       
  7366 			soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height;
       
  7367 			soffsetw = ista ? 0 : that.sizeDiff.width;
       
  7368 
       
  7369 			s = {
       
  7370 				width: (that.helper.width()  - soffsetw),
       
  7371 				height: (that.helper.height() - soffseth)
       
  7372 			};
       
  7373 			left = (parseInt(that.element.css("left"), 10) +
       
  7374 				(that.position.left - that.originalPosition.left)) || null;
       
  7375 			top = (parseInt(that.element.css("top"), 10) +
       
  7376 				(that.position.top - that.originalPosition.top)) || null;
       
  7377 
       
  7378 			if (!o.animate) {
       
  7379 				this.element.css($.extend(s, { top: top, left: left }));
       
  7380 			}
       
  7381 
       
  7382 			that.helper.height(that.size.height);
       
  7383 			that.helper.width(that.size.width);
       
  7384 
       
  7385 			if (this._helper && !o.animate) {
       
  7386 				this._proportionallyResize();
       
  7387 			}
       
  7388 		}
       
  7389 
       
  7390 		$("body").css("cursor", "auto");
       
  7391 
       
  7392 		this.element.removeClass("ui-resizable-resizing");
       
  7393 
       
  7394 		this._propagate("stop", event);
       
  7395 
       
  7396 		if (this._helper) {
       
  7397 			this.helper.remove();
       
  7398 		}
       
  7399 
       
  7400 		return false;
       
  7401 
       
  7402 	},
       
  7403 
       
  7404 	_updatePrevProperties: function() {
       
  7405 		this.prevPosition = {
       
  7406 			top: this.position.top,
       
  7407 			left: this.position.left
       
  7408 		};
       
  7409 		this.prevSize = {
       
  7410 			width: this.size.width,
       
  7411 			height: this.size.height
       
  7412 		};
       
  7413 	},
       
  7414 
       
  7415 	_applyChanges: function() {
       
  7416 		var props = {};
       
  7417 
       
  7418 		if ( this.position.top !== this.prevPosition.top ) {
       
  7419 			props.top = this.position.top + "px";
       
  7420 		}
       
  7421 		if ( this.position.left !== this.prevPosition.left ) {
       
  7422 			props.left = this.position.left + "px";
       
  7423 		}
       
  7424 		if ( this.size.width !== this.prevSize.width ) {
       
  7425 			props.width = this.size.width + "px";
       
  7426 		}
       
  7427 		if ( this.size.height !== this.prevSize.height ) {
       
  7428 			props.height = this.size.height + "px";
       
  7429 		}
       
  7430 
       
  7431 		this.helper.css( props );
       
  7432 
       
  7433 		return props;
       
  7434 	},
       
  7435 
       
  7436 	_updateVirtualBoundaries: function(forceAspectRatio) {
       
  7437 		var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
       
  7438 			o = this.options;
       
  7439 
       
  7440 		b = {
       
  7441 			minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0,
       
  7442 			maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity,
       
  7443 			minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0,
       
  7444 			maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity
       
  7445 		};
       
  7446 
       
  7447 		if (this._aspectRatio || forceAspectRatio) {
       
  7448 			pMinWidth = b.minHeight * this.aspectRatio;
       
  7449 			pMinHeight = b.minWidth / this.aspectRatio;
       
  7450 			pMaxWidth = b.maxHeight * this.aspectRatio;
       
  7451 			pMaxHeight = b.maxWidth / this.aspectRatio;
       
  7452 
       
  7453 			if (pMinWidth > b.minWidth) {
       
  7454 				b.minWidth = pMinWidth;
       
  7455 			}
       
  7456 			if (pMinHeight > b.minHeight) {
       
  7457 				b.minHeight = pMinHeight;
       
  7458 			}
       
  7459 			if (pMaxWidth < b.maxWidth) {
       
  7460 				b.maxWidth = pMaxWidth;
       
  7461 			}
       
  7462 			if (pMaxHeight < b.maxHeight) {
       
  7463 				b.maxHeight = pMaxHeight;
       
  7464 			}
       
  7465 		}
       
  7466 		this._vBoundaries = b;
       
  7467 	},
       
  7468 
       
  7469 	_updateCache: function(data) {
       
  7470 		this.offset = this.helper.offset();
       
  7471 		if (this._isNumber(data.left)) {
       
  7472 			this.position.left = data.left;
       
  7473 		}
       
  7474 		if (this._isNumber(data.top)) {
       
  7475 			this.position.top = data.top;
       
  7476 		}
       
  7477 		if (this._isNumber(data.height)) {
       
  7478 			this.size.height = data.height;
       
  7479 		}
       
  7480 		if (this._isNumber(data.width)) {
       
  7481 			this.size.width = data.width;
       
  7482 		}
       
  7483 	},
       
  7484 
       
  7485 	_updateRatio: function( data ) {
       
  7486 
       
  7487 		var cpos = this.position,
       
  7488 			csize = this.size,
       
  7489 			a = this.axis;
       
  7490 
       
  7491 		if (this._isNumber(data.height)) {
       
  7492 			data.width = (data.height * this.aspectRatio);
       
  7493 		} else if (this._isNumber(data.width)) {
       
  7494 			data.height = (data.width / this.aspectRatio);
       
  7495 		}
       
  7496 
       
  7497 		if (a === "sw") {
       
  7498 			data.left = cpos.left + (csize.width - data.width);
       
  7499 			data.top = null;
       
  7500 		}
       
  7501 		if (a === "nw") {
       
  7502 			data.top = cpos.top + (csize.height - data.height);
       
  7503 			data.left = cpos.left + (csize.width - data.width);
       
  7504 		}
       
  7505 
       
  7506 		return data;
       
  7507 	},
       
  7508 
       
  7509 	_respectSize: function( data ) {
       
  7510 
       
  7511 		var o = this._vBoundaries,
       
  7512 			a = this.axis,
       
  7513 			ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width),
       
  7514 			ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
       
  7515 			isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width),
       
  7516 			isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
       
  7517 			dw = this.originalPosition.left + this.originalSize.width,
       
  7518 			dh = this.position.top + this.size.height,
       
  7519 			cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
       
  7520 		if (isminw) {
       
  7521 			data.width = o.minWidth;
       
  7522 		}
       
  7523 		if (isminh) {
       
  7524 			data.height = o.minHeight;
       
  7525 		}
       
  7526 		if (ismaxw) {
       
  7527 			data.width = o.maxWidth;
       
  7528 		}
       
  7529 		if (ismaxh) {
       
  7530 			data.height = o.maxHeight;
       
  7531 		}
       
  7532 
       
  7533 		if (isminw && cw) {
       
  7534 			data.left = dw - o.minWidth;
       
  7535 		}
       
  7536 		if (ismaxw && cw) {
       
  7537 			data.left = dw - o.maxWidth;
       
  7538 		}
       
  7539 		if (isminh && ch) {
       
  7540 			data.top = dh - o.minHeight;
       
  7541 		}
       
  7542 		if (ismaxh && ch) {
       
  7543 			data.top = dh - o.maxHeight;
       
  7544 		}
       
  7545 
       
  7546 		// Fixing jump error on top/left - bug #2330
       
  7547 		if (!data.width && !data.height && !data.left && data.top) {
       
  7548 			data.top = null;
       
  7549 		} else if (!data.width && !data.height && !data.top && data.left) {
       
  7550 			data.left = null;
       
  7551 		}
       
  7552 
       
  7553 		return data;
       
  7554 	},
       
  7555 
       
  7556 	_getPaddingPlusBorderDimensions: function( element ) {
       
  7557 		var i = 0,
       
  7558 			widths = [],
       
  7559 			borders = [
       
  7560 				element.css( "borderTopWidth" ),
       
  7561 				element.css( "borderRightWidth" ),
       
  7562 				element.css( "borderBottomWidth" ),
       
  7563 				element.css( "borderLeftWidth" )
       
  7564 			],
       
  7565 			paddings = [
       
  7566 				element.css( "paddingTop" ),
       
  7567 				element.css( "paddingRight" ),
       
  7568 				element.css( "paddingBottom" ),
       
  7569 				element.css( "paddingLeft" )
       
  7570 			];
       
  7571 
       
  7572 		for ( ; i < 4; i++ ) {
       
  7573 			widths[ i ] = ( parseInt( borders[ i ], 10 ) || 0 );
       
  7574 			widths[ i ] += ( parseInt( paddings[ i ], 10 ) || 0 );
       
  7575 		}
       
  7576 
       
  7577 		return {
       
  7578 			height: widths[ 0 ] + widths[ 2 ],
       
  7579 			width: widths[ 1 ] + widths[ 3 ]
       
  7580 		};
       
  7581 	},
       
  7582 
       
  7583 	_proportionallyResize: function() {
       
  7584 
       
  7585 		if (!this._proportionallyResizeElements.length) {
       
  7586 			return;
       
  7587 		}
       
  7588 
       
  7589 		var prel,
       
  7590 			i = 0,
       
  7591 			element = this.helper || this.element;
       
  7592 
       
  7593 		for ( ; i < this._proportionallyResizeElements.length; i++) {
       
  7594 
       
  7595 			prel = this._proportionallyResizeElements[i];
       
  7596 
       
  7597 			// TODO: Seems like a bug to cache this.outerDimensions
       
  7598 			// considering that we are in a loop.
       
  7599 			if (!this.outerDimensions) {
       
  7600 				this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
       
  7601 			}
       
  7602 
       
  7603 			prel.css({
       
  7604 				height: (element.height() - this.outerDimensions.height) || 0,
       
  7605 				width: (element.width() - this.outerDimensions.width) || 0
       
  7606 			});
       
  7607 
       
  7608 		}
       
  7609 
       
  7610 	},
       
  7611 
       
  7612 	_renderProxy: function() {
       
  7613 
       
  7614 		var el = this.element, o = this.options;
       
  7615 		this.elementOffset = el.offset();
       
  7616 
       
  7617 		if (this._helper) {
       
  7618 
       
  7619 			this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
       
  7620 
       
  7621 			this.helper.addClass(this._helper).css({
       
  7622 				width: this.element.outerWidth() - 1,
       
  7623 				height: this.element.outerHeight() - 1,
       
  7624 				position: "absolute",
       
  7625 				left: this.elementOffset.left + "px",
       
  7626 				top: this.elementOffset.top + "px",
       
  7627 				zIndex: ++o.zIndex //TODO: Don't modify option
       
  7628 			});
       
  7629 
       
  7630 			this.helper
       
  7631 				.appendTo("body")
       
  7632 				.disableSelection();
       
  7633 
       
  7634 		} else {
       
  7635 			this.helper = this.element;
       
  7636 		}
       
  7637 
       
  7638 	},
       
  7639 
       
  7640 	_change: {
       
  7641 		e: function(event, dx) {
       
  7642 			return { width: this.originalSize.width + dx };
       
  7643 		},
       
  7644 		w: function(event, dx) {
       
  7645 			var cs = this.originalSize, sp = this.originalPosition;
       
  7646 			return { left: sp.left + dx, width: cs.width - dx };
       
  7647 		},
       
  7648 		n: function(event, dx, dy) {
       
  7649 			var cs = this.originalSize, sp = this.originalPosition;
       
  7650 			return { top: sp.top + dy, height: cs.height - dy };
       
  7651 		},
       
  7652 		s: function(event, dx, dy) {
       
  7653 			return { height: this.originalSize.height + dy };
       
  7654 		},
       
  7655 		se: function(event, dx, dy) {
       
  7656 			return $.extend(this._change.s.apply(this, arguments),
       
  7657 				this._change.e.apply(this, [ event, dx, dy ]));
       
  7658 		},
       
  7659 		sw: function(event, dx, dy) {
       
  7660 			return $.extend(this._change.s.apply(this, arguments),
       
  7661 				this._change.w.apply(this, [ event, dx, dy ]));
       
  7662 		},
       
  7663 		ne: function(event, dx, dy) {
       
  7664 			return $.extend(this._change.n.apply(this, arguments),
       
  7665 				this._change.e.apply(this, [ event, dx, dy ]));
       
  7666 		},
       
  7667 		nw: function(event, dx, dy) {
       
  7668 			return $.extend(this._change.n.apply(this, arguments),
       
  7669 				this._change.w.apply(this, [ event, dx, dy ]));
       
  7670 		}
       
  7671 	},
       
  7672 
       
  7673 	_propagate: function(n, event) {
       
  7674 		$.ui.plugin.call(this, n, [ event, this.ui() ]);
       
  7675 		(n !== "resize" && this._trigger(n, event, this.ui()));
       
  7676 	},
       
  7677 
       
  7678 	plugins: {},
       
  7679 
       
  7680 	ui: function() {
       
  7681 		return {
       
  7682 			originalElement: this.originalElement,
       
  7683 			element: this.element,
       
  7684 			helper: this.helper,
       
  7685 			position: this.position,
       
  7686 			size: this.size,
       
  7687 			originalSize: this.originalSize,
       
  7688 			originalPosition: this.originalPosition
       
  7689 		};
       
  7690 	}
       
  7691 
       
  7692 });
       
  7693 
       
  7694 /*
       
  7695  * Resizable Extensions
       
  7696  */
       
  7697 
       
  7698 $.ui.plugin.add("resizable", "animate", {
       
  7699 
       
  7700 	stop: function( event ) {
       
  7701 		var that = $(this).resizable( "instance" ),
       
  7702 			o = that.options,
       
  7703 			pr = that._proportionallyResizeElements,
       
  7704 			ista = pr.length && (/textarea/i).test(pr[0].nodeName),
       
  7705 			soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height,
       
  7706 			soffsetw = ista ? 0 : that.sizeDiff.width,
       
  7707 			style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
       
  7708 			left = (parseInt(that.element.css("left"), 10) +
       
  7709 				(that.position.left - that.originalPosition.left)) || null,
       
  7710 			top = (parseInt(that.element.css("top"), 10) +
       
  7711 				(that.position.top - that.originalPosition.top)) || null;
       
  7712 
       
  7713 		that.element.animate(
       
  7714 			$.extend(style, top && left ? { top: top, left: left } : {}), {
       
  7715 				duration: o.animateDuration,
       
  7716 				easing: o.animateEasing,
       
  7717 				step: function() {
       
  7718 
       
  7719 					var data = {
       
  7720 						width: parseInt(that.element.css("width"), 10),
       
  7721 						height: parseInt(that.element.css("height"), 10),
       
  7722 						top: parseInt(that.element.css("top"), 10),
       
  7723 						left: parseInt(that.element.css("left"), 10)
       
  7724 					};
       
  7725 
       
  7726 					if (pr && pr.length) {
       
  7727 						$(pr[0]).css({ width: data.width, height: data.height });
       
  7728 					}
       
  7729 
       
  7730 					// propagating resize, and updating values for each animation step
       
  7731 					that._updateCache(data);
       
  7732 					that._propagate("resize", event);
       
  7733 
       
  7734 				}
       
  7735 			}
       
  7736 		);
       
  7737 	}
       
  7738 
       
  7739 });
       
  7740 
       
  7741 $.ui.plugin.add( "resizable", "containment", {
       
  7742 
       
  7743 	start: function() {
       
  7744 		var element, p, co, ch, cw, width, height,
       
  7745 			that = $( this ).resizable( "instance" ),
       
  7746 			o = that.options,
       
  7747 			el = that.element,
       
  7748 			oc = o.containment,
       
  7749 			ce = ( oc instanceof $ ) ? oc.get( 0 ) : ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
       
  7750 
       
  7751 		if ( !ce ) {
       
  7752 			return;
       
  7753 		}
       
  7754 
       
  7755 		that.containerElement = $( ce );
       
  7756 
       
  7757 		if ( /document/.test( oc ) || oc === document ) {
       
  7758 			that.containerOffset = {
       
  7759 				left: 0,
       
  7760 				top: 0
       
  7761 			};
       
  7762 			that.containerPosition = {
       
  7763 				left: 0,
       
  7764 				top: 0
       
  7765 			};
       
  7766 
       
  7767 			that.parentData = {
       
  7768 				element: $( document ),
       
  7769 				left: 0,
       
  7770 				top: 0,
       
  7771 				width: $( document ).width(),
       
  7772 				height: $( document ).height() || document.body.parentNode.scrollHeight
       
  7773 			};
       
  7774 		} else {
       
  7775 			element = $( ce );
       
  7776 			p = [];
       
  7777 			$([ "Top", "Right", "Left", "Bottom" ]).each(function( i, name ) {
       
  7778 				p[ i ] = that._num( element.css( "padding" + name ) );
       
  7779 			});
       
  7780 
       
  7781 			that.containerOffset = element.offset();
       
  7782 			that.containerPosition = element.position();
       
  7783 			that.containerSize = {
       
  7784 				height: ( element.innerHeight() - p[ 3 ] ),
       
  7785 				width: ( element.innerWidth() - p[ 1 ] )
       
  7786 			};
       
  7787 
       
  7788 			co = that.containerOffset;
       
  7789 			ch = that.containerSize.height;
       
  7790 			cw = that.containerSize.width;
       
  7791 			width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw );
       
  7792 			height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ;
       
  7793 
       
  7794 			that.parentData = {
       
  7795 				element: ce,
       
  7796 				left: co.left,
       
  7797 				top: co.top,
       
  7798 				width: width,
       
  7799 				height: height
       
  7800 			};
       
  7801 		}
       
  7802 	},
       
  7803 
       
  7804 	resize: function( event ) {
       
  7805 		var woset, hoset, isParent, isOffsetRelative,
       
  7806 			that = $( this ).resizable( "instance" ),
       
  7807 			o = that.options,
       
  7808 			co = that.containerOffset,
       
  7809 			cp = that.position,
       
  7810 			pRatio = that._aspectRatio || event.shiftKey,
       
  7811 			cop = {
       
  7812 				top: 0,
       
  7813 				left: 0
       
  7814 			},
       
  7815 			ce = that.containerElement,
       
  7816 			continueResize = true;
       
  7817 
       
  7818 		if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
       
  7819 			cop = co;
       
  7820 		}
       
  7821 
       
  7822 		if ( cp.left < ( that._helper ? co.left : 0 ) ) {
       
  7823 			that.size.width = that.size.width +
       
  7824 				( that._helper ?
       
  7825 					( that.position.left - co.left ) :
       
  7826 					( that.position.left - cop.left ) );
       
  7827 
       
  7828 			if ( pRatio ) {
       
  7829 				that.size.height = that.size.width / that.aspectRatio;
       
  7830 				continueResize = false;
       
  7831 			}
       
  7832 			that.position.left = o.helper ? co.left : 0;
       
  7833 		}
       
  7834 
       
  7835 		if ( cp.top < ( that._helper ? co.top : 0 ) ) {
       
  7836 			that.size.height = that.size.height +
       
  7837 				( that._helper ?
       
  7838 					( that.position.top - co.top ) :
       
  7839 					that.position.top );
       
  7840 
       
  7841 			if ( pRatio ) {
       
  7842 				that.size.width = that.size.height * that.aspectRatio;
       
  7843 				continueResize = false;
       
  7844 			}
       
  7845 			that.position.top = that._helper ? co.top : 0;
       
  7846 		}
       
  7847 
       
  7848 		isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
       
  7849 		isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
       
  7850 
       
  7851 		if ( isParent && isOffsetRelative ) {
       
  7852 			that.offset.left = that.parentData.left + that.position.left;
       
  7853 			that.offset.top = that.parentData.top + that.position.top;
       
  7854 		} else {
       
  7855 			that.offset.left = that.element.offset().left;
       
  7856 			that.offset.top = that.element.offset().top;
       
  7857 		}
       
  7858 
       
  7859 		woset = Math.abs( that.sizeDiff.width +
       
  7860 			(that._helper ?
       
  7861 				that.offset.left - cop.left :
       
  7862 				(that.offset.left - co.left)) );
       
  7863 
       
  7864 		hoset = Math.abs( that.sizeDiff.height +
       
  7865 			(that._helper ?
       
  7866 				that.offset.top - cop.top :
       
  7867 				(that.offset.top - co.top)) );
       
  7868 
       
  7869 		if ( woset + that.size.width >= that.parentData.width ) {
       
  7870 			that.size.width = that.parentData.width - woset;
       
  7871 			if ( pRatio ) {
       
  7872 				that.size.height = that.size.width / that.aspectRatio;
       
  7873 				continueResize = false;
       
  7874 			}
       
  7875 		}
       
  7876 
       
  7877 		if ( hoset + that.size.height >= that.parentData.height ) {
       
  7878 			that.size.height = that.parentData.height - hoset;
       
  7879 			if ( pRatio ) {
       
  7880 				that.size.width = that.size.height * that.aspectRatio;
       
  7881 				continueResize = false;
       
  7882 			}
       
  7883 		}
       
  7884 
       
  7885 		if ( !continueResize ) {
       
  7886 			that.position.left = that.prevPosition.left;
       
  7887 			that.position.top = that.prevPosition.top;
       
  7888 			that.size.width = that.prevSize.width;
       
  7889 			that.size.height = that.prevSize.height;
       
  7890 		}
       
  7891 	},
       
  7892 
       
  7893 	stop: function() {
       
  7894 		var that = $( this ).resizable( "instance" ),
       
  7895 			o = that.options,
       
  7896 			co = that.containerOffset,
       
  7897 			cop = that.containerPosition,
       
  7898 			ce = that.containerElement,
       
  7899 			helper = $( that.helper ),
       
  7900 			ho = helper.offset(),
       
  7901 			w = helper.outerWidth() - that.sizeDiff.width,
       
  7902 			h = helper.outerHeight() - that.sizeDiff.height;
       
  7903 
       
  7904 		if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
       
  7905 			$( this ).css({
       
  7906 				left: ho.left - cop.left - co.left,
       
  7907 				width: w,
       
  7908 				height: h
       
  7909 			});
       
  7910 		}
       
  7911 
       
  7912 		if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
       
  7913 			$( this ).css({
       
  7914 				left: ho.left - cop.left - co.left,
       
  7915 				width: w,
       
  7916 				height: h
       
  7917 			});
       
  7918 		}
       
  7919 	}
       
  7920 });
       
  7921 
       
  7922 $.ui.plugin.add("resizable", "alsoResize", {
       
  7923 
       
  7924 	start: function() {
       
  7925 		var that = $(this).resizable( "instance" ),
       
  7926 			o = that.options;
       
  7927 
       
  7928 		$(o.alsoResize).each(function() {
       
  7929 			var el = $(this);
       
  7930 			el.data("ui-resizable-alsoresize", {
       
  7931 				width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
       
  7932 				left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
       
  7933 			});
       
  7934 		});
       
  7935 	},
       
  7936 
       
  7937 	resize: function(event, ui) {
       
  7938 		var that = $(this).resizable( "instance" ),
       
  7939 			o = that.options,
       
  7940 			os = that.originalSize,
       
  7941 			op = that.originalPosition,
       
  7942 			delta = {
       
  7943 				height: (that.size.height - os.height) || 0,
       
  7944 				width: (that.size.width - os.width) || 0,
       
  7945 				top: (that.position.top - op.top) || 0,
       
  7946 				left: (that.position.left - op.left) || 0
       
  7947 			};
       
  7948 
       
  7949 			$(o.alsoResize).each(function() {
       
  7950 				var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
       
  7951 					css = el.parents(ui.originalElement[0]).length ?
       
  7952 							[ "width", "height" ] :
       
  7953 							[ "width", "height", "top", "left" ];
       
  7954 
       
  7955 				$.each(css, function(i, prop) {
       
  7956 					var sum = (start[prop] || 0) + (delta[prop] || 0);
       
  7957 					if (sum && sum >= 0) {
       
  7958 						style[prop] = sum || null;
       
  7959 					}
       
  7960 				});
       
  7961 
       
  7962 				el.css(style);
       
  7963 			});
       
  7964 	},
       
  7965 
       
  7966 	stop: function() {
       
  7967 		$(this).removeData("resizable-alsoresize");
       
  7968 	}
       
  7969 });
       
  7970 
       
  7971 $.ui.plugin.add("resizable", "ghost", {
       
  7972 
       
  7973 	start: function() {
       
  7974 
       
  7975 		var that = $(this).resizable( "instance" ), o = that.options, cs = that.size;
       
  7976 
       
  7977 		that.ghost = that.originalElement.clone();
       
  7978 		that.ghost
       
  7979 			.css({
       
  7980 				opacity: 0.25,
       
  7981 				display: "block",
       
  7982 				position: "relative",
       
  7983 				height: cs.height,
       
  7984 				width: cs.width,
       
  7985 				margin: 0,
       
  7986 				left: 0,
       
  7987 				top: 0
       
  7988 			})
       
  7989 			.addClass("ui-resizable-ghost")
       
  7990 			.addClass(typeof o.ghost === "string" ? o.ghost : "");
       
  7991 
       
  7992 		that.ghost.appendTo(that.helper);
       
  7993 
       
  7994 	},
       
  7995 
       
  7996 	resize: function() {
       
  7997 		var that = $(this).resizable( "instance" );
       
  7998 		if (that.ghost) {
       
  7999 			that.ghost.css({
       
  8000 				position: "relative",
       
  8001 				height: that.size.height,
       
  8002 				width: that.size.width
       
  8003 			});
       
  8004 		}
       
  8005 	},
       
  8006 
       
  8007 	stop: function() {
       
  8008 		var that = $(this).resizable( "instance" );
       
  8009 		if (that.ghost && that.helper) {
       
  8010 			that.helper.get(0).removeChild(that.ghost.get(0));
       
  8011 		}
       
  8012 	}
       
  8013 
       
  8014 });
       
  8015 
       
  8016 $.ui.plugin.add("resizable", "grid", {
       
  8017 
       
  8018 	resize: function() {
       
  8019 		var outerDimensions,
       
  8020 			that = $(this).resizable( "instance" ),
       
  8021 			o = that.options,
       
  8022 			cs = that.size,
       
  8023 			os = that.originalSize,
       
  8024 			op = that.originalPosition,
       
  8025 			a = that.axis,
       
  8026 			grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
       
  8027 			gridX = (grid[0] || 1),
       
  8028 			gridY = (grid[1] || 1),
       
  8029 			ox = Math.round((cs.width - os.width) / gridX) * gridX,
       
  8030 			oy = Math.round((cs.height - os.height) / gridY) * gridY,
       
  8031 			newWidth = os.width + ox,
       
  8032 			newHeight = os.height + oy,
       
  8033 			isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
       
  8034 			isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
       
  8035 			isMinWidth = o.minWidth && (o.minWidth > newWidth),
       
  8036 			isMinHeight = o.minHeight && (o.minHeight > newHeight);
       
  8037 
       
  8038 		o.grid = grid;
       
  8039 
       
  8040 		if (isMinWidth) {
       
  8041 			newWidth += gridX;
       
  8042 		}
       
  8043 		if (isMinHeight) {
       
  8044 			newHeight += gridY;
       
  8045 		}
       
  8046 		if (isMaxWidth) {
       
  8047 			newWidth -= gridX;
       
  8048 		}
       
  8049 		if (isMaxHeight) {
       
  8050 			newHeight -= gridY;
       
  8051 		}
       
  8052 
       
  8053 		if (/^(se|s|e)$/.test(a)) {
       
  8054 			that.size.width = newWidth;
       
  8055 			that.size.height = newHeight;
       
  8056 		} else if (/^(ne)$/.test(a)) {
       
  8057 			that.size.width = newWidth;
       
  8058 			that.size.height = newHeight;
       
  8059 			that.position.top = op.top - oy;
       
  8060 		} else if (/^(sw)$/.test(a)) {
       
  8061 			that.size.width = newWidth;
       
  8062 			that.size.height = newHeight;
       
  8063 			that.position.left = op.left - ox;
       
  8064 		} else {
       
  8065 			if ( newHeight - gridY <= 0 || newWidth - gridX <= 0) {
       
  8066 				outerDimensions = that._getPaddingPlusBorderDimensions( this );
       
  8067 			}
       
  8068 
       
  8069 			if ( newHeight - gridY > 0 ) {
       
  8070 				that.size.height = newHeight;
       
  8071 				that.position.top = op.top - oy;
       
  8072 			} else {
       
  8073 				newHeight = gridY - outerDimensions.height;
       
  8074 				that.size.height = newHeight;
       
  8075 				that.position.top = op.top + os.height - newHeight;
       
  8076 			}
       
  8077 			if ( newWidth - gridX > 0 ) {
       
  8078 				that.size.width = newWidth;
       
  8079 				that.position.left = op.left - ox;
       
  8080 			} else {
       
  8081 				newWidth = gridX - outerDimensions.width;
       
  8082 				that.size.width = newWidth;
       
  8083 				that.position.left = op.left + os.width - newWidth;
       
  8084 			}
       
  8085 		}
       
  8086 	}
       
  8087 
       
  8088 });
       
  8089 
       
  8090 var resizable = $.ui.resizable;
       
  8091 
       
  8092 
       
  8093 /*!
       
  8094  * jQuery UI Dialog 1.11.4
       
  8095  * http://jqueryui.com
       
  8096  *
       
  8097  * Copyright jQuery Foundation and other contributors
       
  8098  * Released under the MIT license.
       
  8099  * http://jquery.org/license
       
  8100  *
       
  8101  * http://api.jqueryui.com/dialog/
       
  8102  */
       
  8103 
       
  8104 
       
  8105 var dialog = $.widget( "ui.dialog", {
       
  8106 	version: "1.11.4",
  9660 	options: {
  8107 	options: {
  9661 		appendTo: "body",
  8108 		appendTo: "body",
  9662 		autoOpen: true,
  8109 		autoOpen: true,
  9663 		buttons: [],
  8110 		buttons: [],
  9664 		closeOnEscape: true,
  8111 		closeOnEscape: true,
  9665 		closeText: "close",
  8112 		closeText: "Close",
  9666 		dialogClass: "",
  8113 		dialogClass: "",
  9667 		draggable: true,
  8114 		draggable: true,
  9668 		hide: null,
  8115 		hide: null,
  9669 		height: "auto",
  8116 		height: "auto",
  9670 		maxHeight: null,
  8117 		maxHeight: null,
  9701 		resize: null,
  8148 		resize: null,
  9702 		resizeStart: null,
  8149 		resizeStart: null,
  9703 		resizeStop: null
  8150 		resizeStop: null
  9704 	},
  8151 	},
  9705 
  8152 
       
  8153 	sizeRelatedOptions: {
       
  8154 		buttons: true,
       
  8155 		height: true,
       
  8156 		maxHeight: true,
       
  8157 		maxWidth: true,
       
  8158 		minHeight: true,
       
  8159 		minWidth: true,
       
  8160 		width: true
       
  8161 	},
       
  8162 
       
  8163 	resizableRelatedOptions: {
       
  8164 		maxHeight: true,
       
  8165 		maxWidth: true,
       
  8166 		minHeight: true,
       
  8167 		minWidth: true
       
  8168 	},
       
  8169 
  9706 	_create: function() {
  8170 	_create: function() {
  9707 		this.originalCss = {
  8171 		this.originalCss = {
  9708 			display: this.element[0].style.display,
  8172 			display: this.element[ 0 ].style.display,
  9709 			width: this.element[0].style.width,
  8173 			width: this.element[ 0 ].style.width,
  9710 			minHeight: this.element[0].style.minHeight,
  8174 			minHeight: this.element[ 0 ].style.minHeight,
  9711 			maxHeight: this.element[0].style.maxHeight,
  8175 			maxHeight: this.element[ 0 ].style.maxHeight,
  9712 			height: this.element[0].style.height
  8176 			height: this.element[ 0 ].style.height
  9713 		};
  8177 		};
  9714 		this.originalPosition = {
  8178 		this.originalPosition = {
  9715 			parent: this.element.parent(),
  8179 			parent: this.element.parent(),
  9716 			index: this.element.parent().children().index( this.element )
  8180 			index: this.element.parent().children().index( this.element )
  9717 		};
  8181 		};
  9718 		this.originalTitle = this.element.attr("title");
  8182 		this.originalTitle = this.element.attr( "title" );
  9719 		this.options.title = this.options.title || this.originalTitle;
  8183 		this.options.title = this.options.title || this.originalTitle;
  9720 
  8184 
  9721 		this._createWrapper();
  8185 		this._createWrapper();
  9722 
  8186 
  9723 		this.element
  8187 		this.element
  9724 			.show()
  8188 			.show()
  9725 			.removeAttr("title")
  8189 			.removeAttr( "title" )
  9726 			.addClass("ui-dialog-content ui-widget-content")
  8190 			.addClass( "ui-dialog-content ui-widget-content" )
  9727 			.appendTo( this.uiDialog );
  8191 			.appendTo( this.uiDialog );
  9728 
  8192 
  9729 		this._createTitlebar();
  8193 		this._createTitlebar();
  9730 		this._createButtonPane();
  8194 		this._createButtonPane();
  9731 
  8195 
  9735 		if ( this.options.resizable && $.fn.resizable ) {
  8199 		if ( this.options.resizable && $.fn.resizable ) {
  9736 			this._makeResizable();
  8200 			this._makeResizable();
  9737 		}
  8201 		}
  9738 
  8202 
  9739 		this._isOpen = false;
  8203 		this._isOpen = false;
       
  8204 
       
  8205 		this._trackFocus();
  9740 	},
  8206 	},
  9741 
  8207 
  9742 	_init: function() {
  8208 	_init: function() {
  9743 		if ( this.options.autoOpen ) {
  8209 		if ( this.options.autoOpen ) {
  9744 			this.open();
  8210 			this.open();
  9755 
  8221 
  9756 	_destroy: function() {
  8222 	_destroy: function() {
  9757 		var next,
  8223 		var next,
  9758 			originalPosition = this.originalPosition;
  8224 			originalPosition = this.originalPosition;
  9759 
  8225 
       
  8226 		this._untrackInstance();
  9760 		this._destroyOverlay();
  8227 		this._destroyOverlay();
  9761 
  8228 
  9762 		this.element
  8229 		this.element
  9763 			.removeUniqueId()
  8230 			.removeUniqueId()
  9764 			.removeClass("ui-dialog-content ui-widget-content")
  8231 			.removeClass( "ui-dialog-content ui-widget-content" )
  9765 			.css( this.originalCss )
  8232 			.css( this.originalCss )
  9766 			// Without detaching first, the following becomes really slow
  8233 			// Without detaching first, the following becomes really slow
  9767 			.detach();
  8234 			.detach();
  9768 
  8235 
  9769 		this.uiDialog.stop( true, true ).remove();
  8236 		this.uiDialog.stop( true, true ).remove();
  9772 			this.element.attr( "title", this.originalTitle );
  8239 			this.element.attr( "title", this.originalTitle );
  9773 		}
  8240 		}
  9774 
  8241 
  9775 		next = originalPosition.parent.children().eq( originalPosition.index );
  8242 		next = originalPosition.parent.children().eq( originalPosition.index );
  9776 		// Don't try to place the dialog next to itself (#8613)
  8243 		// Don't try to place the dialog next to itself (#8613)
  9777 		if ( next.length && next[0] !== this.element[0] ) {
  8244 		if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
  9778 			next.before( this.element );
  8245 			next.before( this.element );
  9779 		} else {
  8246 		} else {
  9780 			originalPosition.parent.append( this.element );
  8247 			originalPosition.parent.append( this.element );
  9781 		}
  8248 		}
  9782 	},
  8249 	},
  9787 
  8254 
  9788 	disable: $.noop,
  8255 	disable: $.noop,
  9789 	enable: $.noop,
  8256 	enable: $.noop,
  9790 
  8257 
  9791 	close: function( event ) {
  8258 	close: function( event ) {
  9792 		var that = this;
  8259 		var activeElement,
       
  8260 			that = this;
  9793 
  8261 
  9794 		if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
  8262 		if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
  9795 			return;
  8263 			return;
  9796 		}
  8264 		}
  9797 
  8265 
  9798 		this._isOpen = false;
  8266 		this._isOpen = false;
       
  8267 		this._focusedElement = null;
  9799 		this._destroyOverlay();
  8268 		this._destroyOverlay();
  9800 
  8269 		this._untrackInstance();
  9801 		if ( !this.opener.filter(":focusable").focus().length ) {
  8270 
  9802 			// Hiding a focused element doesn't trigger blur in WebKit
  8271 		if ( !this.opener.filter( ":focusable" ).focus().length ) {
  9803 			// so in case we have nothing to focus on, explicitly blur the active element
  8272 
  9804 			// https://bugs.webkit.org/show_bug.cgi?id=47182
  8273 			// support: IE9
  9805 			$( this.document[0].activeElement ).blur();
  8274 			// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
       
  8275 			try {
       
  8276 				activeElement = this.document[ 0 ].activeElement;
       
  8277 
       
  8278 				// Support: IE9, IE10
       
  8279 				// If the <body> is blurred, IE will switch windows, see #4520
       
  8280 				if ( activeElement && activeElement.nodeName.toLowerCase() !== "body" ) {
       
  8281 
       
  8282 					// Hiding a focused element doesn't trigger blur in WebKit
       
  8283 					// so in case we have nothing to focus on, explicitly blur the active element
       
  8284 					// https://bugs.webkit.org/show_bug.cgi?id=47182
       
  8285 					$( activeElement ).blur();
       
  8286 				}
       
  8287 			} catch ( error ) {}
  9806 		}
  8288 		}
  9807 
  8289 
  9808 		this._hide( this.uiDialog, this.options.hide, function() {
  8290 		this._hide( this.uiDialog, this.options.hide, function() {
  9809 			that._trigger( "close", event );
  8291 			that._trigger( "close", event );
  9810 		});
  8292 		});
  9817 	moveToTop: function() {
  8299 	moveToTop: function() {
  9818 		this._moveToTop();
  8300 		this._moveToTop();
  9819 	},
  8301 	},
  9820 
  8302 
  9821 	_moveToTop: function( event, silent ) {
  8303 	_moveToTop: function( event, silent ) {
  9822 		var moved = !!this.uiDialog.nextAll(":visible").insertBefore( this.uiDialog ).length;
  8304 		var moved = false,
       
  8305 			zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map(function() {
       
  8306 				return +$( this ).css( "z-index" );
       
  8307 			}).get(),
       
  8308 			zIndexMax = Math.max.apply( null, zIndices );
       
  8309 
       
  8310 		if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
       
  8311 			this.uiDialog.css( "z-index", zIndexMax + 1 );
       
  8312 			moved = true;
       
  8313 		}
       
  8314 
  9823 		if ( moved && !silent ) {
  8315 		if ( moved && !silent ) {
  9824 			this._trigger( "focus", event );
  8316 			this._trigger( "focus", event );
  9825 		}
  8317 		}
  9826 		return moved;
  8318 		return moved;
  9827 	},
  8319 	},
  9834 			}
  8326 			}
  9835 			return;
  8327 			return;
  9836 		}
  8328 		}
  9837 
  8329 
  9838 		this._isOpen = true;
  8330 		this._isOpen = true;
  9839 		this.opener = $( this.document[0].activeElement );
  8331 		this.opener = $( this.document[ 0 ].activeElement );
  9840 
  8332 
  9841 		this._size();
  8333 		this._size();
  9842 		this._position();
  8334 		this._position();
  9843 		this._createOverlay();
  8335 		this._createOverlay();
  9844 		this._moveToTop( null, true );
  8336 		this._moveToTop( null, true );
       
  8337 
       
  8338 		// Ensure the overlay is moved to the top with the dialog, but only when
       
  8339 		// opening. The overlay shouldn't move after the dialog is open so that
       
  8340 		// modeless dialogs opened after the modal dialog stack properly.
       
  8341 		if ( this.overlay ) {
       
  8342 			this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
       
  8343 		}
       
  8344 
  9845 		this._show( this.uiDialog, this.options.show, function() {
  8345 		this._show( this.uiDialog, this.options.show, function() {
  9846 			that._focusTabbable();
  8346 			that._focusTabbable();
  9847 			that._trigger("focus");
  8347 			that._trigger( "focus" );
  9848 		});
  8348 		});
  9849 
  8349 
  9850 		this._trigger("open");
  8350 		// Track the dialog immediately upon openening in case a focus event
       
  8351 		// somehow occurs outside of the dialog before an element inside the
       
  8352 		// dialog is focused (#10152)
       
  8353 		this._makeFocusTarget();
       
  8354 
       
  8355 		this._trigger( "open" );
  9851 	},
  8356 	},
  9852 
  8357 
  9853 	_focusTabbable: function() {
  8358 	_focusTabbable: function() {
  9854 		// Set focus to the first match:
  8359 		// Set focus to the first match:
  9855 		// 1. First element inside the dialog matching [autofocus]
  8360 		// 1. An element that was focused previously
  9856 		// 2. Tabbable element inside the content element
  8361 		// 2. First element inside the dialog matching [autofocus]
  9857 		// 3. Tabbable element inside the buttonpane
  8362 		// 3. Tabbable element inside the content element
  9858 		// 4. The close button
  8363 		// 4. Tabbable element inside the buttonpane
  9859 		// 5. The dialog itself
  8364 		// 5. The close button
  9860 		var hasFocus = this.element.find("[autofocus]");
  8365 		// 6. The dialog itself
       
  8366 		var hasFocus = this._focusedElement;
       
  8367 		if ( !hasFocus ) {
       
  8368 			hasFocus = this.element.find( "[autofocus]" );
       
  8369 		}
  9861 		if ( !hasFocus.length ) {
  8370 		if ( !hasFocus.length ) {
  9862 			hasFocus = this.element.find(":tabbable");
  8371 			hasFocus = this.element.find( ":tabbable" );
  9863 		}
  8372 		}
  9864 		if ( !hasFocus.length ) {
  8373 		if ( !hasFocus.length ) {
  9865 			hasFocus = this.uiDialogButtonPane.find(":tabbable");
  8374 			hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
  9866 		}
  8375 		}
  9867 		if ( !hasFocus.length ) {
  8376 		if ( !hasFocus.length ) {
  9868 			hasFocus = this.uiDialogTitlebarClose.filter(":tabbable");
  8377 			hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
  9869 		}
  8378 		}
  9870 		if ( !hasFocus.length ) {
  8379 		if ( !hasFocus.length ) {
  9871 			hasFocus = this.uiDialog;
  8380 			hasFocus = this.uiDialog;
  9872 		}
  8381 		}
  9873 		hasFocus.eq( 0 ).focus();
  8382 		hasFocus.eq( 0 ).focus();
  9910 					this.close( event );
  8419 					this.close( event );
  9911 					return;
  8420 					return;
  9912 				}
  8421 				}
  9913 
  8422 
  9914 				// prevent tabbing out of dialogs
  8423 				// prevent tabbing out of dialogs
  9915 				if ( event.keyCode !== $.ui.keyCode.TAB ) {
  8424 				if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
  9916 					return;
  8425 					return;
  9917 				}
  8426 				}
  9918 				var tabbables = this.uiDialog.find(":tabbable"),
  8427 				var tabbables = this.uiDialog.find( ":tabbable" ),
  9919 					first = tabbables.filter(":first"),
  8428 					first = tabbables.filter( ":first" ),
  9920 					last  = tabbables.filter(":last");
  8429 					last = tabbables.filter( ":last" );
  9921 
  8430 
  9922 				if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) {
  8431 				if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) {
  9923 					first.focus( 1 );
  8432 					this._delay(function() {
       
  8433 						first.focus();
       
  8434 					});
  9924 					event.preventDefault();
  8435 					event.preventDefault();
  9925 				} else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) {
  8436 				} else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) {
  9926 					last.focus( 1 );
  8437 					this._delay(function() {
       
  8438 						last.focus();
       
  8439 					});
  9927 					event.preventDefault();
  8440 					event.preventDefault();
  9928 				}
  8441 				}
  9929 			},
  8442 			},
  9930 			mousedown: function( event ) {
  8443 			mousedown: function( event ) {
  9931 				if ( this._moveToTop( event ) ) {
  8444 				if ( this._moveToTop( event ) ) {
  9935 		});
  8448 		});
  9936 
  8449 
  9937 		// We assume that any existing aria-describedby attribute means
  8450 		// We assume that any existing aria-describedby attribute means
  9938 		// that the dialog content is marked up properly
  8451 		// that the dialog content is marked up properly
  9939 		// otherwise we brute force the content as the description
  8452 		// otherwise we brute force the content as the description
  9940 		if ( !this.element.find("[aria-describedby]").length ) {
  8453 		if ( !this.element.find( "[aria-describedby]" ).length ) {
  9941 			this.uiDialog.attr({
  8454 			this.uiDialog.attr({
  9942 				"aria-describedby": this.element.uniqueId().attr("id")
  8455 				"aria-describedby": this.element.uniqueId().attr( "id" )
  9943 			});
  8456 			});
  9944 		}
  8457 		}
  9945 	},
  8458 	},
  9946 
  8459 
  9947 	_createTitlebar: function() {
  8460 	_createTitlebar: function() {
  9948 		var uiDialogTitle;
  8461 		var uiDialogTitle;
  9949 
  8462 
  9950 		this.uiDialogTitlebar = $("<div>")
  8463 		this.uiDialogTitlebar = $( "<div>" )
  9951 			.addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix")
  8464 			.addClass( "ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix" )
  9952 			.prependTo( this.uiDialog );
  8465 			.prependTo( this.uiDialog );
  9953 		this._on( this.uiDialogTitlebar, {
  8466 		this._on( this.uiDialogTitlebar, {
  9954 			mousedown: function( event ) {
  8467 			mousedown: function( event ) {
  9955 				// Don't prevent click on close button (#8838)
  8468 				// Don't prevent click on close button (#8838)
  9956 				// Focusing a dialog that is partially scrolled out of view
  8469 				// Focusing a dialog that is partially scrolled out of view
  9957 				// causes the browser to scroll it into view, preventing the click event
  8470 				// causes the browser to scroll it into view, preventing the click event
  9958 				if ( !$( event.target ).closest(".ui-dialog-titlebar-close") ) {
  8471 				if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
  9959 					// Dialog isn't getting focus when dragging (#8063)
  8472 					// Dialog isn't getting focus when dragging (#8063)
  9960 					this.uiDialog.focus();
  8473 					this.uiDialog.focus();
  9961 				}
  8474 				}
  9962 			}
  8475 			}
  9963 		});
  8476 		});
  9964 
  8477 
  9965 		this.uiDialogTitlebarClose = $("<button></button>")
  8478 		// support: IE
       
  8479 		// Use type="button" to prevent enter keypresses in textboxes from closing the
       
  8480 		// dialog in IE (#9312)
       
  8481 		this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
  9966 			.button({
  8482 			.button({
  9967 				label: this.options.closeText,
  8483 				label: this.options.closeText,
  9968 				icons: {
  8484 				icons: {
  9969 					primary: "ui-icon-closethick"
  8485 					primary: "ui-icon-closethick"
  9970 				},
  8486 				},
  9971 				text: false
  8487 				text: false
  9972 			})
  8488 			})
  9973 			.addClass("ui-dialog-titlebar-close")
  8489 			.addClass( "ui-dialog-titlebar-close" )
  9974 			.appendTo( this.uiDialogTitlebar );
  8490 			.appendTo( this.uiDialogTitlebar );
  9975 		this._on( this.uiDialogTitlebarClose, {
  8491 		this._on( this.uiDialogTitlebarClose, {
  9976 			click: function( event ) {
  8492 			click: function( event ) {
  9977 				event.preventDefault();
  8493 				event.preventDefault();
  9978 				this.close( event );
  8494 				this.close( event );
  9979 			}
  8495 			}
  9980 		});
  8496 		});
  9981 
  8497 
  9982 		uiDialogTitle = $("<span>")
  8498 		uiDialogTitle = $( "<span>" )
  9983 			.uniqueId()
  8499 			.uniqueId()
  9984 			.addClass("ui-dialog-title")
  8500 			.addClass( "ui-dialog-title" )
  9985 			.prependTo( this.uiDialogTitlebar );
  8501 			.prependTo( this.uiDialogTitlebar );
  9986 		this._title( uiDialogTitle );
  8502 		this._title( uiDialogTitle );
  9987 
  8503 
  9988 		this.uiDialog.attr({
  8504 		this.uiDialog.attr({
  9989 			"aria-labelledby": uiDialogTitle.attr("id")
  8505 			"aria-labelledby": uiDialogTitle.attr( "id" )
  9990 		});
  8506 		});
  9991 	},
  8507 	},
  9992 
  8508 
  9993 	_title: function( title ) {
  8509 	_title: function( title ) {
  9994 		if ( !this.options.title ) {
  8510 		if ( !this.options.title ) {
  9995 			title.html("&#160;");
  8511 			title.html( "&#160;" );
  9996 		}
  8512 		}
  9997 		title.text( this.options.title );
  8513 		title.text( this.options.title );
  9998 	},
  8514 	},
  9999 
  8515 
 10000 	_createButtonPane: function() {
  8516 	_createButtonPane: function() {
 10001 		this.uiDialogButtonPane = $("<div>")
  8517 		this.uiDialogButtonPane = $( "<div>" )
 10002 			.addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");
  8518 			.addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
 10003 
  8519 
 10004 		this.uiButtonSet = $("<div>")
  8520 		this.uiButtonSet = $( "<div>" )
 10005 			.addClass("ui-dialog-buttonset")
  8521 			.addClass( "ui-dialog-buttonset" )
 10006 			.appendTo( this.uiDialogButtonPane );
  8522 			.appendTo( this.uiDialogButtonPane );
 10007 
  8523 
 10008 		this._createButtons();
  8524 		this._createButtons();
 10009 	},
  8525 	},
 10010 
  8526 
 10015 		// if we already have a button pane, remove it
  8531 		// if we already have a button pane, remove it
 10016 		this.uiDialogButtonPane.remove();
  8532 		this.uiDialogButtonPane.remove();
 10017 		this.uiButtonSet.empty();
  8533 		this.uiButtonSet.empty();
 10018 
  8534 
 10019 		if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
  8535 		if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
 10020 			this.uiDialog.removeClass("ui-dialog-buttons");
  8536 			this.uiDialog.removeClass( "ui-dialog-buttons" );
 10021 			return;
  8537 			return;
 10022 		}
  8538 		}
 10023 
  8539 
 10024 		$.each( buttons, function( name, props ) {
  8540 		$.each( buttons, function( name, props ) {
 10025 			var click, buttonOptions;
  8541 			var click, buttonOptions;
 10029 			// Default to a non-submitting button
  8545 			// Default to a non-submitting button
 10030 			props = $.extend( { type: "button" }, props );
  8546 			props = $.extend( { type: "button" }, props );
 10031 			// Change the context for the click callback to be the main element
  8547 			// Change the context for the click callback to be the main element
 10032 			click = props.click;
  8548 			click = props.click;
 10033 			props.click = function() {
  8549 			props.click = function() {
 10034 				click.apply( that.element[0], arguments );
  8550 				click.apply( that.element[ 0 ], arguments );
 10035 			};
  8551 			};
 10036 			buttonOptions = {
  8552 			buttonOptions = {
 10037 				icons: props.icons,
  8553 				icons: props.icons,
 10038 				text: props.showText
  8554 				text: props.showText
 10039 			};
  8555 			};
 10041 			delete props.showText;
  8557 			delete props.showText;
 10042 			$( "<button></button>", props )
  8558 			$( "<button></button>", props )
 10043 				.button( buttonOptions )
  8559 				.button( buttonOptions )
 10044 				.appendTo( that.uiButtonSet );
  8560 				.appendTo( that.uiButtonSet );
 10045 		});
  8561 		});
 10046 		this.uiDialog.addClass("ui-dialog-buttons");
  8562 		this.uiDialog.addClass( "ui-dialog-buttons" );
 10047 		this.uiDialogButtonPane.appendTo( this.uiDialog );
  8563 		this.uiDialogButtonPane.appendTo( this.uiDialog );
 10048 	},
  8564 	},
 10049 
  8565 
 10050 	_makeDraggable: function() {
  8566 	_makeDraggable: function() {
 10051 		var that = this,
  8567 		var that = this,
 10061 		this.uiDialog.draggable({
  8577 		this.uiDialog.draggable({
 10062 			cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
  8578 			cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
 10063 			handle: ".ui-dialog-titlebar",
  8579 			handle: ".ui-dialog-titlebar",
 10064 			containment: "document",
  8580 			containment: "document",
 10065 			start: function( event, ui ) {
  8581 			start: function( event, ui ) {
 10066 				$( this ).addClass("ui-dialog-dragging");
  8582 				$( this ).addClass( "ui-dialog-dragging" );
 10067 				that._blockFrames();
  8583 				that._blockFrames();
 10068 				that._trigger( "dragStart", event, filteredUi( ui ) );
  8584 				that._trigger( "dragStart", event, filteredUi( ui ) );
 10069 			},
  8585 			},
 10070 			drag: function( event, ui ) {
  8586 			drag: function( event, ui ) {
 10071 				that._trigger( "drag", event, filteredUi( ui ) );
  8587 				that._trigger( "drag", event, filteredUi( ui ) );
 10072 			},
  8588 			},
 10073 			stop: function( event, ui ) {
  8589 			stop: function( event, ui ) {
 10074 				options.position = [
  8590 				var left = ui.offset.left - that.document.scrollLeft(),
 10075 					ui.position.left - that.document.scrollLeft(),
  8591 					top = ui.offset.top - that.document.scrollTop();
 10076 					ui.position.top - that.document.scrollTop()
  8592 
 10077 				];
  8593 				options.position = {
 10078 				$( this ).removeClass("ui-dialog-dragging");
  8594 					my: "left top",
       
  8595 					at: "left" + (left >= 0 ? "+" : "") + left + " " +
       
  8596 						"top" + (top >= 0 ? "+" : "") + top,
       
  8597 					of: that.window
       
  8598 				};
       
  8599 				$( this ).removeClass( "ui-dialog-dragging" );
 10079 				that._unblockFrames();
  8600 				that._unblockFrames();
 10080 				that._trigger( "dragStop", event, filteredUi( ui ) );
  8601 				that._trigger( "dragStop", event, filteredUi( ui ) );
 10081 			}
  8602 			}
 10082 		});
  8603 		});
 10083 	},
  8604 	},
 10110 			maxHeight: options.maxHeight,
  8631 			maxHeight: options.maxHeight,
 10111 			minWidth: options.minWidth,
  8632 			minWidth: options.minWidth,
 10112 			minHeight: this._minHeight(),
  8633 			minHeight: this._minHeight(),
 10113 			handles: resizeHandles,
  8634 			handles: resizeHandles,
 10114 			start: function( event, ui ) {
  8635 			start: function( event, ui ) {
 10115 				$( this ).addClass("ui-dialog-resizing");
  8636 				$( this ).addClass( "ui-dialog-resizing" );
 10116 				that._blockFrames();
  8637 				that._blockFrames();
 10117 				that._trigger( "resizeStart", event, filteredUi( ui ) );
  8638 				that._trigger( "resizeStart", event, filteredUi( ui ) );
 10118 			},
  8639 			},
 10119 			resize: function( event, ui ) {
  8640 			resize: function( event, ui ) {
 10120 				that._trigger( "resize", event, filteredUi( ui ) );
  8641 				that._trigger( "resize", event, filteredUi( ui ) );
 10121 			},
  8642 			},
 10122 			stop: function( event, ui ) {
  8643 			stop: function( event, ui ) {
 10123 				options.height = $( this ).height();
  8644 				var offset = that.uiDialog.offset(),
 10124 				options.width = $( this ).width();
  8645 					left = offset.left - that.document.scrollLeft(),
 10125 				$( this ).removeClass("ui-dialog-resizing");
  8646 					top = offset.top - that.document.scrollTop();
       
  8647 
       
  8648 				options.height = that.uiDialog.height();
       
  8649 				options.width = that.uiDialog.width();
       
  8650 				options.position = {
       
  8651 					my: "left top",
       
  8652 					at: "left" + (left >= 0 ? "+" : "") + left + " " +
       
  8653 						"top" + (top >= 0 ? "+" : "") + top,
       
  8654 					of: that.window
       
  8655 				};
       
  8656 				$( this ).removeClass( "ui-dialog-resizing" );
 10126 				that._unblockFrames();
  8657 				that._unblockFrames();
 10127 				that._trigger( "resizeStop", event, filteredUi( ui ) );
  8658 				that._trigger( "resizeStop", event, filteredUi( ui ) );
 10128 			}
  8659 			}
 10129 		})
  8660 		})
 10130 		.css( "position", position );
  8661 		.css( "position", position );
       
  8662 	},
       
  8663 
       
  8664 	_trackFocus: function() {
       
  8665 		this._on( this.widget(), {
       
  8666 			focusin: function( event ) {
       
  8667 				this._makeFocusTarget();
       
  8668 				this._focusedElement = $( event.target );
       
  8669 			}
       
  8670 		});
       
  8671 	},
       
  8672 
       
  8673 	_makeFocusTarget: function() {
       
  8674 		this._untrackInstance();
       
  8675 		this._trackingInstances().unshift( this );
       
  8676 	},
       
  8677 
       
  8678 	_untrackInstance: function() {
       
  8679 		var instances = this._trackingInstances(),
       
  8680 			exists = $.inArray( this, instances );
       
  8681 		if ( exists !== -1 ) {
       
  8682 			instances.splice( exists, 1 );
       
  8683 		}
       
  8684 	},
       
  8685 
       
  8686 	_trackingInstances: function() {
       
  8687 		var instances = this.document.data( "ui-dialog-instances" );
       
  8688 		if ( !instances ) {
       
  8689 			instances = [];
       
  8690 			this.document.data( "ui-dialog-instances", instances );
       
  8691 		}
       
  8692 		return instances;
 10131 	},
  8693 	},
 10132 
  8694 
 10133 	_minHeight: function() {
  8695 	_minHeight: function() {
 10134 		var options = this.options;
  8696 		var options = this.options;
 10135 
  8697 
 10138 			Math.min( options.minHeight, options.height );
  8700 			Math.min( options.minHeight, options.height );
 10139 	},
  8701 	},
 10140 
  8702 
 10141 	_position: function() {
  8703 	_position: function() {
 10142 		// Need to show the dialog to get the actual offset in the position plugin
  8704 		// Need to show the dialog to get the actual offset in the position plugin
 10143 		var isVisible = this.uiDialog.is(":visible");
  8705 		var isVisible = this.uiDialog.is( ":visible" );
 10144 		if ( !isVisible ) {
  8706 		if ( !isVisible ) {
 10145 			this.uiDialog.show();
  8707 			this.uiDialog.show();
 10146 		}
  8708 		}
 10147 		this.uiDialog.position( this.options.position );
  8709 		this.uiDialog.position( this.options.position );
 10148 		if ( !isVisible ) {
  8710 		if ( !isVisible ) {
 10156 			resizableOptions = {};
  8718 			resizableOptions = {};
 10157 
  8719 
 10158 		$.each( options, function( key, value ) {
  8720 		$.each( options, function( key, value ) {
 10159 			that._setOption( key, value );
  8721 			that._setOption( key, value );
 10160 
  8722 
 10161 			if ( key in sizeRelatedOptions ) {
  8723 			if ( key in that.sizeRelatedOptions ) {
 10162 				resize = true;
  8724 				resize = true;
 10163 			}
  8725 			}
 10164 			if ( key in resizableRelatedOptions ) {
  8726 			if ( key in that.resizableRelatedOptions ) {
 10165 				resizableOptions[ key ] = value;
  8727 				resizableOptions[ key ] = value;
 10166 			}
  8728 			}
 10167 		});
  8729 		});
 10168 
  8730 
 10169 		if ( resize ) {
  8731 		if ( resize ) {
 10170 			this._size();
  8732 			this._size();
 10171 			this._position();
  8733 			this._position();
 10172 		}
  8734 		}
 10173 		if ( this.uiDialog.is(":data(ui-resizable)") ) {
  8735 		if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
 10174 			this.uiDialog.resizable( "option", resizableOptions );
  8736 			this.uiDialog.resizable( "option", resizableOptions );
 10175 		}
  8737 		}
 10176 	},
  8738 	},
 10177 
  8739 
 10178 	_setOption: function( key, value ) {
  8740 	_setOption: function( key, value ) {
 10179 		/*jshint maxcomplexity:15*/
       
 10180 		var isDraggable, isResizable,
  8741 		var isDraggable, isResizable,
 10181 			uiDialog = this.uiDialog;
  8742 			uiDialog = this.uiDialog;
 10182 
  8743 
 10183 		if ( key === "dialogClass" ) {
  8744 		if ( key === "dialogClass" ) {
 10184 			uiDialog
  8745 			uiDialog
 10206 				label: "" + value
  8767 				label: "" + value
 10207 			});
  8768 			});
 10208 		}
  8769 		}
 10209 
  8770 
 10210 		if ( key === "draggable" ) {
  8771 		if ( key === "draggable" ) {
 10211 			isDraggable = uiDialog.is(":data(ui-draggable)");
  8772 			isDraggable = uiDialog.is( ":data(ui-draggable)" );
 10212 			if ( isDraggable && !value ) {
  8773 			if ( isDraggable && !value ) {
 10213 				uiDialog.draggable("destroy");
  8774 				uiDialog.draggable( "destroy" );
 10214 			}
  8775 			}
 10215 
  8776 
 10216 			if ( !isDraggable && value ) {
  8777 			if ( !isDraggable && value ) {
 10217 				this._makeDraggable();
  8778 				this._makeDraggable();
 10218 			}
  8779 			}
 10222 			this._position();
  8783 			this._position();
 10223 		}
  8784 		}
 10224 
  8785 
 10225 		if ( key === "resizable" ) {
  8786 		if ( key === "resizable" ) {
 10226 			// currently resizable, becoming non-resizable
  8787 			// currently resizable, becoming non-resizable
 10227 			isResizable = uiDialog.is(":data(ui-resizable)");
  8788 			isResizable = uiDialog.is( ":data(ui-resizable)" );
 10228 			if ( isResizable && !value ) {
  8789 			if ( isResizable && !value ) {
 10229 				uiDialog.resizable("destroy");
  8790 				uiDialog.resizable( "destroy" );
 10230 			}
  8791 			}
 10231 
  8792 
 10232 			// currently resizable, changing handles
  8793 			// currently resizable, changing handles
 10233 			if ( isResizable && typeof value === "string" ) {
  8794 			if ( isResizable && typeof value === "string" ) {
 10234 				uiDialog.resizable( "option", "handles", value );
  8795 				uiDialog.resizable( "option", "handles", value );
 10239 				this._makeResizable();
  8800 				this._makeResizable();
 10240 			}
  8801 			}
 10241 		}
  8802 		}
 10242 
  8803 
 10243 		if ( key === "title" ) {
  8804 		if ( key === "title" ) {
 10244 			this._title( this.uiDialogTitlebar.find(".ui-dialog-title") );
  8805 			this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
 10245 		}
  8806 		}
 10246 	},
  8807 	},
 10247 
  8808 
 10248 	_size: function() {
  8809 	_size: function() {
 10249 		// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
  8810 		// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
 10283 			});
  8844 			});
 10284 		} else {
  8845 		} else {
 10285 			this.element.height( Math.max( 0, options.height - nonContentHeight ) );
  8846 			this.element.height( Math.max( 0, options.height - nonContentHeight ) );
 10286 		}
  8847 		}
 10287 
  8848 
 10288 		if (this.uiDialog.is(":data(ui-resizable)") ) {
  8849 		if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
 10289 			this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
  8850 			this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
 10290 		}
  8851 		}
 10291 	},
  8852 	},
 10292 
  8853 
 10293 	_blockFrames: function() {
  8854 	_blockFrames: function() {
 10311 			delete this.iframeBlocks;
  8872 			delete this.iframeBlocks;
 10312 		}
  8873 		}
 10313 	},
  8874 	},
 10314 
  8875 
 10315 	_allowInteraction: function( event ) {
  8876 	_allowInteraction: function( event ) {
 10316 		if ( $( event.target ).closest(".ui-dialog").length ) {
  8877 		if ( $( event.target ).closest( ".ui-dialog" ).length ) {
 10317 			return true;
  8878 			return true;
 10318 		}
  8879 		}
 10319 
  8880 
 10320 		// TODO: Remove hack when datepicker implements
  8881 		// TODO: Remove hack when datepicker implements
 10321 		// the .ui-front logic (#8989)
  8882 		// the .ui-front logic (#8989)
 10322 		return !!$( event.target ).closest(".ui-datepicker").length;
  8883 		return !!$( event.target ).closest( ".ui-datepicker" ).length;
 10323 	},
  8884 	},
 10324 
  8885 
 10325 	_createOverlay: function() {
  8886 	_createOverlay: function() {
 10326 		if ( !this.options.modal ) {
  8887 		if ( !this.options.modal ) {
 10327 			return;
  8888 			return;
 10328 		}
  8889 		}
 10329 
  8890 
 10330 		var that = this,
  8891 		// We use a delay in case the overlay is created from an
 10331 			widgetFullName = this.widgetFullName;
  8892 		// event that we're going to be cancelling (#2804)
 10332 		if ( !$.ui.dialog.overlayInstances ) {
  8893 		var isOpening = true;
 10333 			// Prevent use of anchors and inputs.
  8894 		this._delay(function() {
 10334 			// We use a delay in case the overlay is created from an
  8895 			isOpening = false;
 10335 			// event that we're going to be cancelling. (#2804)
  8896 		});
 10336 			this._delay(function() {
  8897 
 10337 				// Handle .dialog().dialog("close") (#4065)
  8898 		if ( !this.document.data( "ui-dialog-overlays" ) ) {
 10338 				if ( $.ui.dialog.overlayInstances ) {
  8899 
 10339 					this.document.bind( "focusin.dialog", function( event ) {
  8900 			// Prevent use of anchors and inputs
 10340 						if ( !that._allowInteraction( event ) ) {
  8901 			// Using _on() for an event handler shared across many instances is
 10341 							event.preventDefault();
  8902 			// safe because the dialogs stack and must be closed in reverse order
 10342 							$(".ui-dialog:visible:last .ui-dialog-content")
  8903 			this._on( this.document, {
 10343 								.data( widgetFullName )._focusTabbable();
  8904 				focusin: function( event ) {
 10344 						}
  8905 					if ( isOpening ) {
 10345 					});
  8906 						return;
       
  8907 					}
       
  8908 
       
  8909 					if ( !this._allowInteraction( event ) ) {
       
  8910 						event.preventDefault();
       
  8911 						this._trackingInstances()[ 0 ]._focusTabbable();
       
  8912 					}
 10346 				}
  8913 				}
 10347 			});
  8914 			});
 10348 		}
  8915 		}
 10349 
  8916 
 10350 		this.overlay = $("<div>")
  8917 		this.overlay = $( "<div>" )
 10351 			.addClass("ui-widget-overlay ui-front")
  8918 			.addClass( "ui-widget-overlay ui-front" )
 10352 			.appendTo( this._appendTo() );
  8919 			.appendTo( this._appendTo() );
 10353 		this._on( this.overlay, {
  8920 		this._on( this.overlay, {
 10354 			mousedown: "_keepFocus"
  8921 			mousedown: "_keepFocus"
 10355 		});
  8922 		});
 10356 		$.ui.dialog.overlayInstances++;
  8923 		this.document.data( "ui-dialog-overlays",
       
  8924 			(this.document.data( "ui-dialog-overlays" ) || 0) + 1 );
 10357 	},
  8925 	},
 10358 
  8926 
 10359 	_destroyOverlay: function() {
  8927 	_destroyOverlay: function() {
 10360 		if ( !this.options.modal ) {
  8928 		if ( !this.options.modal ) {
 10361 			return;
  8929 			return;
 10362 		}
  8930 		}
 10363 
  8931 
 10364 		if ( this.overlay ) {
  8932 		if ( this.overlay ) {
 10365 			$.ui.dialog.overlayInstances--;
  8933 			var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
 10366 
  8934 
 10367 			if ( !$.ui.dialog.overlayInstances ) {
  8935 			if ( !overlays ) {
 10368 				this.document.unbind( "focusin.dialog" );
  8936 				this.document
 10369 			}
  8937 					.unbind( "focusin" )
       
  8938 					.removeData( "ui-dialog-overlays" );
       
  8939 			} else {
       
  8940 				this.document.data( "ui-dialog-overlays", overlays );
       
  8941 			}
       
  8942 
 10370 			this.overlay.remove();
  8943 			this.overlay.remove();
 10371 			this.overlay = null;
  8944 			this.overlay = null;
 10372 		}
  8945 		}
 10373 	}
  8946 	}
 10374 });
  8947 });
 10375 
  8948 
 10376 $.ui.dialog.overlayInstances = 0;
  8949 
 10377 
  8950 /*!
 10378 // DEPRECATED
  8951  * jQuery UI Droppable 1.11.4
 10379 if ( $.uiBackCompat !== false ) {
  8952  * http://jqueryui.com
 10380 	// position option with array notation
  8953  *
 10381 	// just override with old implementation
  8954  * Copyright jQuery Foundation and other contributors
 10382 	$.widget( "ui.dialog", $.ui.dialog, {
  8955  * Released under the MIT license.
 10383 		_position: function() {
  8956  * http://jquery.org/license
 10384 			var position = this.options.position,
  8957  *
 10385 				myAt = [],
  8958  * http://api.jqueryui.com/droppable/
 10386 				offset = [ 0, 0 ],
  8959  */
 10387 				isVisible;
  8960 
 10388 
  8961 
 10389 			if ( position ) {
  8962 $.widget( "ui.droppable", {
 10390 				if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) {
  8963 	version: "1.11.4",
 10391 					myAt = position.split ? position.split(" ") : [ position[0], position[1] ];
  8964 	widgetEventPrefix: "drop",
 10392 					if ( myAt.length === 1 ) {
  8965 	options: {
 10393 						myAt[1] = myAt[0];
  8966 		accept: "*",
       
  8967 		activeClass: false,
       
  8968 		addClasses: true,
       
  8969 		greedy: false,
       
  8970 		hoverClass: false,
       
  8971 		scope: "default",
       
  8972 		tolerance: "intersect",
       
  8973 
       
  8974 		// callbacks
       
  8975 		activate: null,
       
  8976 		deactivate: null,
       
  8977 		drop: null,
       
  8978 		out: null,
       
  8979 		over: null
       
  8980 	},
       
  8981 	_create: function() {
       
  8982 
       
  8983 		var proportions,
       
  8984 			o = this.options,
       
  8985 			accept = o.accept;
       
  8986 
       
  8987 		this.isover = false;
       
  8988 		this.isout = true;
       
  8989 
       
  8990 		this.accept = $.isFunction( accept ) ? accept : function( d ) {
       
  8991 			return d.is( accept );
       
  8992 		};
       
  8993 
       
  8994 		this.proportions = function( /* valueToWrite */ ) {
       
  8995 			if ( arguments.length ) {
       
  8996 				// Store the droppable's proportions
       
  8997 				proportions = arguments[ 0 ];
       
  8998 			} else {
       
  8999 				// Retrieve or derive the droppable's proportions
       
  9000 				return proportions ?
       
  9001 					proportions :
       
  9002 					proportions = {
       
  9003 						width: this.element[ 0 ].offsetWidth,
       
  9004 						height: this.element[ 0 ].offsetHeight
       
  9005 					};
       
  9006 			}
       
  9007 		};
       
  9008 
       
  9009 		this._addToManager( o.scope );
       
  9010 
       
  9011 		o.addClasses && this.element.addClass( "ui-droppable" );
       
  9012 
       
  9013 	},
       
  9014 
       
  9015 	_addToManager: function( scope ) {
       
  9016 		// Add the reference and positions to the manager
       
  9017 		$.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
       
  9018 		$.ui.ddmanager.droppables[ scope ].push( this );
       
  9019 	},
       
  9020 
       
  9021 	_splice: function( drop ) {
       
  9022 		var i = 0;
       
  9023 		for ( ; i < drop.length; i++ ) {
       
  9024 			if ( drop[ i ] === this ) {
       
  9025 				drop.splice( i, 1 );
       
  9026 			}
       
  9027 		}
       
  9028 	},
       
  9029 
       
  9030 	_destroy: function() {
       
  9031 		var drop = $.ui.ddmanager.droppables[ this.options.scope ];
       
  9032 
       
  9033 		this._splice( drop );
       
  9034 
       
  9035 		this.element.removeClass( "ui-droppable ui-droppable-disabled" );
       
  9036 	},
       
  9037 
       
  9038 	_setOption: function( key, value ) {
       
  9039 
       
  9040 		if ( key === "accept" ) {
       
  9041 			this.accept = $.isFunction( value ) ? value : function( d ) {
       
  9042 				return d.is( value );
       
  9043 			};
       
  9044 		} else if ( key === "scope" ) {
       
  9045 			var drop = $.ui.ddmanager.droppables[ this.options.scope ];
       
  9046 
       
  9047 			this._splice( drop );
       
  9048 			this._addToManager( value );
       
  9049 		}
       
  9050 
       
  9051 		this._super( key, value );
       
  9052 	},
       
  9053 
       
  9054 	_activate: function( event ) {
       
  9055 		var draggable = $.ui.ddmanager.current;
       
  9056 		if ( this.options.activeClass ) {
       
  9057 			this.element.addClass( this.options.activeClass );
       
  9058 		}
       
  9059 		if ( draggable ){
       
  9060 			this._trigger( "activate", event, this.ui( draggable ) );
       
  9061 		}
       
  9062 	},
       
  9063 
       
  9064 	_deactivate: function( event ) {
       
  9065 		var draggable = $.ui.ddmanager.current;
       
  9066 		if ( this.options.activeClass ) {
       
  9067 			this.element.removeClass( this.options.activeClass );
       
  9068 		}
       
  9069 		if ( draggable ){
       
  9070 			this._trigger( "deactivate", event, this.ui( draggable ) );
       
  9071 		}
       
  9072 	},
       
  9073 
       
  9074 	_over: function( event ) {
       
  9075 
       
  9076 		var draggable = $.ui.ddmanager.current;
       
  9077 
       
  9078 		// Bail if draggable and droppable are same element
       
  9079 		if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
       
  9080 			return;
       
  9081 		}
       
  9082 
       
  9083 		if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
       
  9084 			if ( this.options.hoverClass ) {
       
  9085 				this.element.addClass( this.options.hoverClass );
       
  9086 			}
       
  9087 			this._trigger( "over", event, this.ui( draggable ) );
       
  9088 		}
       
  9089 
       
  9090 	},
       
  9091 
       
  9092 	_out: function( event ) {
       
  9093 
       
  9094 		var draggable = $.ui.ddmanager.current;
       
  9095 
       
  9096 		// Bail if draggable and droppable are same element
       
  9097 		if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
       
  9098 			return;
       
  9099 		}
       
  9100 
       
  9101 		if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
       
  9102 			if ( this.options.hoverClass ) {
       
  9103 				this.element.removeClass( this.options.hoverClass );
       
  9104 			}
       
  9105 			this._trigger( "out", event, this.ui( draggable ) );
       
  9106 		}
       
  9107 
       
  9108 	},
       
  9109 
       
  9110 	_drop: function( event, custom ) {
       
  9111 
       
  9112 		var draggable = custom || $.ui.ddmanager.current,
       
  9113 			childrenIntersection = false;
       
  9114 
       
  9115 		// Bail if draggable and droppable are same element
       
  9116 		if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
       
  9117 			return false;
       
  9118 		}
       
  9119 
       
  9120 		this.element.find( ":data(ui-droppable)" ).not( ".ui-draggable-dragging" ).each(function() {
       
  9121 			var inst = $( this ).droppable( "instance" );
       
  9122 			if (
       
  9123 				inst.options.greedy &&
       
  9124 				!inst.options.disabled &&
       
  9125 				inst.options.scope === draggable.options.scope &&
       
  9126 				inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
       
  9127 				$.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event )
       
  9128 			) { childrenIntersection = true; return false; }
       
  9129 		});
       
  9130 		if ( childrenIntersection ) {
       
  9131 			return false;
       
  9132 		}
       
  9133 
       
  9134 		if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
       
  9135 			if ( this.options.activeClass ) {
       
  9136 				this.element.removeClass( this.options.activeClass );
       
  9137 			}
       
  9138 			if ( this.options.hoverClass ) {
       
  9139 				this.element.removeClass( this.options.hoverClass );
       
  9140 			}
       
  9141 			this._trigger( "drop", event, this.ui( draggable ) );
       
  9142 			return this.element;
       
  9143 		}
       
  9144 
       
  9145 		return false;
       
  9146 
       
  9147 	},
       
  9148 
       
  9149 	ui: function( c ) {
       
  9150 		return {
       
  9151 			draggable: ( c.currentItem || c.element ),
       
  9152 			helper: c.helper,
       
  9153 			position: c.position,
       
  9154 			offset: c.positionAbs
       
  9155 		};
       
  9156 	}
       
  9157 
       
  9158 });
       
  9159 
       
  9160 $.ui.intersect = (function() {
       
  9161 	function isOverAxis( x, reference, size ) {
       
  9162 		return ( x >= reference ) && ( x < ( reference + size ) );
       
  9163 	}
       
  9164 
       
  9165 	return function( draggable, droppable, toleranceMode, event ) {
       
  9166 
       
  9167 		if ( !droppable.offset ) {
       
  9168 			return false;
       
  9169 		}
       
  9170 
       
  9171 		var x1 = ( draggable.positionAbs || draggable.position.absolute ).left + draggable.margins.left,
       
  9172 			y1 = ( draggable.positionAbs || draggable.position.absolute ).top + draggable.margins.top,
       
  9173 			x2 = x1 + draggable.helperProportions.width,
       
  9174 			y2 = y1 + draggable.helperProportions.height,
       
  9175 			l = droppable.offset.left,
       
  9176 			t = droppable.offset.top,
       
  9177 			r = l + droppable.proportions().width,
       
  9178 			b = t + droppable.proportions().height;
       
  9179 
       
  9180 		switch ( toleranceMode ) {
       
  9181 		case "fit":
       
  9182 			return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
       
  9183 		case "intersect":
       
  9184 			return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
       
  9185 				x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
       
  9186 				t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
       
  9187 				y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
       
  9188 		case "pointer":
       
  9189 			return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width );
       
  9190 		case "touch":
       
  9191 			return (
       
  9192 				( y1 >= t && y1 <= b ) || // Top edge touching
       
  9193 				( y2 >= t && y2 <= b ) || // Bottom edge touching
       
  9194 				( y1 < t && y2 > b ) // Surrounded vertically
       
  9195 			) && (
       
  9196 				( x1 >= l && x1 <= r ) || // Left edge touching
       
  9197 				( x2 >= l && x2 <= r ) || // Right edge touching
       
  9198 				( x1 < l && x2 > r ) // Surrounded horizontally
       
  9199 			);
       
  9200 		default:
       
  9201 			return false;
       
  9202 		}
       
  9203 	};
       
  9204 })();
       
  9205 
       
  9206 /*
       
  9207 	This manager tracks offsets of draggables and droppables
       
  9208 */
       
  9209 $.ui.ddmanager = {
       
  9210 	current: null,
       
  9211 	droppables: { "default": [] },
       
  9212 	prepareOffsets: function( t, event ) {
       
  9213 
       
  9214 		var i, j,
       
  9215 			m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
       
  9216 			type = event ? event.type : null, // workaround for #2317
       
  9217 			list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
       
  9218 
       
  9219 		droppablesLoop: for ( i = 0; i < m.length; i++ ) {
       
  9220 
       
  9221 			// No disabled and non-accepted
       
  9222 			if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], ( t.currentItem || t.element ) ) ) ) {
       
  9223 				continue;
       
  9224 			}
       
  9225 
       
  9226 			// Filter out elements in the current dragged item
       
  9227 			for ( j = 0; j < list.length; j++ ) {
       
  9228 				if ( list[ j ] === m[ i ].element[ 0 ] ) {
       
  9229 					m[ i ].proportions().height = 0;
       
  9230 					continue droppablesLoop;
       
  9231 				}
       
  9232 			}
       
  9233 
       
  9234 			m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
       
  9235 			if ( !m[ i ].visible ) {
       
  9236 				continue;
       
  9237 			}
       
  9238 
       
  9239 			// Activate the droppable if used directly from draggables
       
  9240 			if ( type === "mousedown" ) {
       
  9241 				m[ i ]._activate.call( m[ i ], event );
       
  9242 			}
       
  9243 
       
  9244 			m[ i ].offset = m[ i ].element.offset();
       
  9245 			m[ i ].proportions({ width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight });
       
  9246 
       
  9247 		}
       
  9248 
       
  9249 	},
       
  9250 	drop: function( draggable, event ) {
       
  9251 
       
  9252 		var dropped = false;
       
  9253 		// Create a copy of the droppables in case the list changes during the drop (#9116)
       
  9254 		$.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
       
  9255 
       
  9256 			if ( !this.options ) {
       
  9257 				return;
       
  9258 			}
       
  9259 			if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
       
  9260 				dropped = this._drop.call( this, event ) || dropped;
       
  9261 			}
       
  9262 
       
  9263 			if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
       
  9264 				this.isout = true;
       
  9265 				this.isover = false;
       
  9266 				this._deactivate.call( this, event );
       
  9267 			}
       
  9268 
       
  9269 		});
       
  9270 		return dropped;
       
  9271 
       
  9272 	},
       
  9273 	dragStart: function( draggable, event ) {
       
  9274 		// Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
       
  9275 		draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
       
  9276 			if ( !draggable.options.refreshPositions ) {
       
  9277 				$.ui.ddmanager.prepareOffsets( draggable, event );
       
  9278 			}
       
  9279 		});
       
  9280 	},
       
  9281 	drag: function( draggable, event ) {
       
  9282 
       
  9283 		// If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
       
  9284 		if ( draggable.options.refreshPositions ) {
       
  9285 			$.ui.ddmanager.prepareOffsets( draggable, event );
       
  9286 		}
       
  9287 
       
  9288 		// Run through all droppables and check their positions based on specific tolerance options
       
  9289 		$.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
       
  9290 
       
  9291 			if ( this.options.disabled || this.greedyChild || !this.visible ) {
       
  9292 				return;
       
  9293 			}
       
  9294 
       
  9295 			var parentInstance, scope, parent,
       
  9296 				intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
       
  9297 				c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null );
       
  9298 			if ( !c ) {
       
  9299 				return;
       
  9300 			}
       
  9301 
       
  9302 			if ( this.options.greedy ) {
       
  9303 				// find droppable parents with same scope
       
  9304 				scope = this.options.scope;
       
  9305 				parent = this.element.parents( ":data(ui-droppable)" ).filter(function() {
       
  9306 					return $( this ).droppable( "instance" ).options.scope === scope;
       
  9307 				});
       
  9308 
       
  9309 				if ( parent.length ) {
       
  9310 					parentInstance = $( parent[ 0 ] ).droppable( "instance" );
       
  9311 					parentInstance.greedyChild = ( c === "isover" );
       
  9312 				}
       
  9313 			}
       
  9314 
       
  9315 			// we just moved into a greedy child
       
  9316 			if ( parentInstance && c === "isover" ) {
       
  9317 				parentInstance.isover = false;
       
  9318 				parentInstance.isout = true;
       
  9319 				parentInstance._out.call( parentInstance, event );
       
  9320 			}
       
  9321 
       
  9322 			this[ c ] = true;
       
  9323 			this[c === "isout" ? "isover" : "isout"] = false;
       
  9324 			this[c === "isover" ? "_over" : "_out"].call( this, event );
       
  9325 
       
  9326 			// we just moved out of a greedy child
       
  9327 			if ( parentInstance && c === "isout" ) {
       
  9328 				parentInstance.isout = false;
       
  9329 				parentInstance.isover = true;
       
  9330 				parentInstance._over.call( parentInstance, event );
       
  9331 			}
       
  9332 		});
       
  9333 
       
  9334 	},
       
  9335 	dragStop: function( draggable, event ) {
       
  9336 		draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
       
  9337 		// Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
       
  9338 		if ( !draggable.options.refreshPositions ) {
       
  9339 			$.ui.ddmanager.prepareOffsets( draggable, event );
       
  9340 		}
       
  9341 	}
       
  9342 };
       
  9343 
       
  9344 var droppable = $.ui.droppable;
       
  9345 
       
  9346 
       
  9347 /*!
       
  9348  * jQuery UI Effects 1.11.4
       
  9349  * http://jqueryui.com
       
  9350  *
       
  9351  * Copyright jQuery Foundation and other contributors
       
  9352  * Released under the MIT license.
       
  9353  * http://jquery.org/license
       
  9354  *
       
  9355  * http://api.jqueryui.com/category/effects-core/
       
  9356  */
       
  9357 
       
  9358 
       
  9359 var dataSpace = "ui-effects-",
       
  9360 
       
  9361 	// Create a local jQuery because jQuery Color relies on it and the
       
  9362 	// global may not exist with AMD and a custom build (#10199)
       
  9363 	jQuery = $;
       
  9364 
       
  9365 $.effects = {
       
  9366 	effect: {}
       
  9367 };
       
  9368 
       
  9369 /*!
       
  9370  * jQuery Color Animations v2.1.2
       
  9371  * https://github.com/jquery/jquery-color
       
  9372  *
       
  9373  * Copyright 2014 jQuery Foundation and other contributors
       
  9374  * Released under the MIT license.
       
  9375  * http://jquery.org/license
       
  9376  *
       
  9377  * Date: Wed Jan 16 08:47:09 2013 -0600
       
  9378  */
       
  9379 (function( jQuery, undefined ) {
       
  9380 
       
  9381 	var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
       
  9382 
       
  9383 	// plusequals test for += 100 -= 100
       
  9384 	rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
       
  9385 	// a set of RE's that can match strings and generate color tuples.
       
  9386 	stringParsers = [ {
       
  9387 			re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
       
  9388 			parse: function( execResult ) {
       
  9389 				return [
       
  9390 					execResult[ 1 ],
       
  9391 					execResult[ 2 ],
       
  9392 					execResult[ 3 ],
       
  9393 					execResult[ 4 ]
       
  9394 				];
       
  9395 			}
       
  9396 		}, {
       
  9397 			re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
       
  9398 			parse: function( execResult ) {
       
  9399 				return [
       
  9400 					execResult[ 1 ] * 2.55,
       
  9401 					execResult[ 2 ] * 2.55,
       
  9402 					execResult[ 3 ] * 2.55,
       
  9403 					execResult[ 4 ]
       
  9404 				];
       
  9405 			}
       
  9406 		}, {
       
  9407 			// this regex ignores A-F because it's compared against an already lowercased string
       
  9408 			re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
       
  9409 			parse: function( execResult ) {
       
  9410 				return [
       
  9411 					parseInt( execResult[ 1 ], 16 ),
       
  9412 					parseInt( execResult[ 2 ], 16 ),
       
  9413 					parseInt( execResult[ 3 ], 16 )
       
  9414 				];
       
  9415 			}
       
  9416 		}, {
       
  9417 			// this regex ignores A-F because it's compared against an already lowercased string
       
  9418 			re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
       
  9419 			parse: function( execResult ) {
       
  9420 				return [
       
  9421 					parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
       
  9422 					parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
       
  9423 					parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
       
  9424 				];
       
  9425 			}
       
  9426 		}, {
       
  9427 			re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
       
  9428 			space: "hsla",
       
  9429 			parse: function( execResult ) {
       
  9430 				return [
       
  9431 					execResult[ 1 ],
       
  9432 					execResult[ 2 ] / 100,
       
  9433 					execResult[ 3 ] / 100,
       
  9434 					execResult[ 4 ]
       
  9435 				];
       
  9436 			}
       
  9437 		} ],
       
  9438 
       
  9439 	// jQuery.Color( )
       
  9440 	color = jQuery.Color = function( color, green, blue, alpha ) {
       
  9441 		return new jQuery.Color.fn.parse( color, green, blue, alpha );
       
  9442 	},
       
  9443 	spaces = {
       
  9444 		rgba: {
       
  9445 			props: {
       
  9446 				red: {
       
  9447 					idx: 0,
       
  9448 					type: "byte"
       
  9449 				},
       
  9450 				green: {
       
  9451 					idx: 1,
       
  9452 					type: "byte"
       
  9453 				},
       
  9454 				blue: {
       
  9455 					idx: 2,
       
  9456 					type: "byte"
       
  9457 				}
       
  9458 			}
       
  9459 		},
       
  9460 
       
  9461 		hsla: {
       
  9462 			props: {
       
  9463 				hue: {
       
  9464 					idx: 0,
       
  9465 					type: "degrees"
       
  9466 				},
       
  9467 				saturation: {
       
  9468 					idx: 1,
       
  9469 					type: "percent"
       
  9470 				},
       
  9471 				lightness: {
       
  9472 					idx: 2,
       
  9473 					type: "percent"
       
  9474 				}
       
  9475 			}
       
  9476 		}
       
  9477 	},
       
  9478 	propTypes = {
       
  9479 		"byte": {
       
  9480 			floor: true,
       
  9481 			max: 255
       
  9482 		},
       
  9483 		"percent": {
       
  9484 			max: 1
       
  9485 		},
       
  9486 		"degrees": {
       
  9487 			mod: 360,
       
  9488 			floor: true
       
  9489 		}
       
  9490 	},
       
  9491 	support = color.support = {},
       
  9492 
       
  9493 	// element for support tests
       
  9494 	supportElem = jQuery( "<p>" )[ 0 ],
       
  9495 
       
  9496 	// colors = jQuery.Color.names
       
  9497 	colors,
       
  9498 
       
  9499 	// local aliases of functions called often
       
  9500 	each = jQuery.each;
       
  9501 
       
  9502 // determine rgba support immediately
       
  9503 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
       
  9504 support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
       
  9505 
       
  9506 // define cache name and alpha properties
       
  9507 // for rgba and hsla spaces
       
  9508 each( spaces, function( spaceName, space ) {
       
  9509 	space.cache = "_" + spaceName;
       
  9510 	space.props.alpha = {
       
  9511 		idx: 3,
       
  9512 		type: "percent",
       
  9513 		def: 1
       
  9514 	};
       
  9515 });
       
  9516 
       
  9517 function clamp( value, prop, allowEmpty ) {
       
  9518 	var type = propTypes[ prop.type ] || {};
       
  9519 
       
  9520 	if ( value == null ) {
       
  9521 		return (allowEmpty || !prop.def) ? null : prop.def;
       
  9522 	}
       
  9523 
       
  9524 	// ~~ is an short way of doing floor for positive numbers
       
  9525 	value = type.floor ? ~~value : parseFloat( value );
       
  9526 
       
  9527 	// IE will pass in empty strings as value for alpha,
       
  9528 	// which will hit this case
       
  9529 	if ( isNaN( value ) ) {
       
  9530 		return prop.def;
       
  9531 	}
       
  9532 
       
  9533 	if ( type.mod ) {
       
  9534 		// we add mod before modding to make sure that negatives values
       
  9535 		// get converted properly: -10 -> 350
       
  9536 		return (value + type.mod) % type.mod;
       
  9537 	}
       
  9538 
       
  9539 	// for now all property types without mod have min and max
       
  9540 	return 0 > value ? 0 : type.max < value ? type.max : value;
       
  9541 }
       
  9542 
       
  9543 function stringParse( string ) {
       
  9544 	var inst = color(),
       
  9545 		rgba = inst._rgba = [];
       
  9546 
       
  9547 	string = string.toLowerCase();
       
  9548 
       
  9549 	each( stringParsers, function( i, parser ) {
       
  9550 		var parsed,
       
  9551 			match = parser.re.exec( string ),
       
  9552 			values = match && parser.parse( match ),
       
  9553 			spaceName = parser.space || "rgba";
       
  9554 
       
  9555 		if ( values ) {
       
  9556 			parsed = inst[ spaceName ]( values );
       
  9557 
       
  9558 			// if this was an rgba parse the assignment might happen twice
       
  9559 			// oh well....
       
  9560 			inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
       
  9561 			rgba = inst._rgba = parsed._rgba;
       
  9562 
       
  9563 			// exit each( stringParsers ) here because we matched
       
  9564 			return false;
       
  9565 		}
       
  9566 	});
       
  9567 
       
  9568 	// Found a stringParser that handled it
       
  9569 	if ( rgba.length ) {
       
  9570 
       
  9571 		// if this came from a parsed string, force "transparent" when alpha is 0
       
  9572 		// chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
       
  9573 		if ( rgba.join() === "0,0,0,0" ) {
       
  9574 			jQuery.extend( rgba, colors.transparent );
       
  9575 		}
       
  9576 		return inst;
       
  9577 	}
       
  9578 
       
  9579 	// named colors
       
  9580 	return colors[ string ];
       
  9581 }
       
  9582 
       
  9583 color.fn = jQuery.extend( color.prototype, {
       
  9584 	parse: function( red, green, blue, alpha ) {
       
  9585 		if ( red === undefined ) {
       
  9586 			this._rgba = [ null, null, null, null ];
       
  9587 			return this;
       
  9588 		}
       
  9589 		if ( red.jquery || red.nodeType ) {
       
  9590 			red = jQuery( red ).css( green );
       
  9591 			green = undefined;
       
  9592 		}
       
  9593 
       
  9594 		var inst = this,
       
  9595 			type = jQuery.type( red ),
       
  9596 			rgba = this._rgba = [];
       
  9597 
       
  9598 		// more than 1 argument specified - assume ( red, green, blue, alpha )
       
  9599 		if ( green !== undefined ) {
       
  9600 			red = [ red, green, blue, alpha ];
       
  9601 			type = "array";
       
  9602 		}
       
  9603 
       
  9604 		if ( type === "string" ) {
       
  9605 			return this.parse( stringParse( red ) || colors._default );
       
  9606 		}
       
  9607 
       
  9608 		if ( type === "array" ) {
       
  9609 			each( spaces.rgba.props, function( key, prop ) {
       
  9610 				rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
       
  9611 			});
       
  9612 			return this;
       
  9613 		}
       
  9614 
       
  9615 		if ( type === "object" ) {
       
  9616 			if ( red instanceof color ) {
       
  9617 				each( spaces, function( spaceName, space ) {
       
  9618 					if ( red[ space.cache ] ) {
       
  9619 						inst[ space.cache ] = red[ space.cache ].slice();
 10394 					}
  9620 					}
 10395 
  9621 				});
 10396 					$.each( [ "left", "top" ], function( i, offsetPosition ) {
  9622 			} else {
 10397 						if ( +myAt[ i ] === myAt[ i ] ) {
  9623 				each( spaces, function( spaceName, space ) {
 10398 							offset[ i ] = myAt[ i ];
  9624 					var cache = space.cache;
 10399 							myAt[ i ] = offsetPosition;
  9625 					each( space.props, function( key, prop ) {
       
  9626 
       
  9627 						// if the cache doesn't exist, and we know how to convert
       
  9628 						if ( !inst[ cache ] && space.to ) {
       
  9629 
       
  9630 							// if the value was null, we don't need to copy it
       
  9631 							// if the key was alpha, we don't need to copy it either
       
  9632 							if ( key === "alpha" || red[ key ] == null ) {
       
  9633 								return;
       
  9634 							}
       
  9635 							inst[ cache ] = space.to( inst._rgba );
 10400 						}
  9636 						}
       
  9637 
       
  9638 						// this is the only case where we allow nulls for ALL properties.
       
  9639 						// call clamp with alwaysAllowEmpty
       
  9640 						inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
 10401 					});
  9641 					});
 10402 
  9642 
 10403 					position = {
  9643 					// everything defined but alpha?
 10404 						my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " +
  9644 					if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
 10405 							myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]),
  9645 						// use the default of 1
 10406 						at: myAt.join(" ")
  9646 						inst[ cache ][ 3 ] = 1;
 10407 					};
  9647 						if ( space.from ) {
 10408 				}
  9648 							inst._rgba = space.from( inst[ cache ] );
 10409 
  9649 						}
 10410 				position = $.extend( {}, $.ui.dialog.prototype.options.position, position );
  9650 					}
       
  9651 				});
       
  9652 			}
       
  9653 			return this;
       
  9654 		}
       
  9655 	},
       
  9656 	is: function( compare ) {
       
  9657 		var is = color( compare ),
       
  9658 			same = true,
       
  9659 			inst = this;
       
  9660 
       
  9661 		each( spaces, function( _, space ) {
       
  9662 			var localCache,
       
  9663 				isCache = is[ space.cache ];
       
  9664 			if (isCache) {
       
  9665 				localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
       
  9666 				each( space.props, function( _, prop ) {
       
  9667 					if ( isCache[ prop.idx ] != null ) {
       
  9668 						same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
       
  9669 						return same;
       
  9670 					}
       
  9671 				});
       
  9672 			}
       
  9673 			return same;
       
  9674 		});
       
  9675 		return same;
       
  9676 	},
       
  9677 	_space: function() {
       
  9678 		var used = [],
       
  9679 			inst = this;
       
  9680 		each( spaces, function( spaceName, space ) {
       
  9681 			if ( inst[ space.cache ] ) {
       
  9682 				used.push( spaceName );
       
  9683 			}
       
  9684 		});
       
  9685 		return used.pop();
       
  9686 	},
       
  9687 	transition: function( other, distance ) {
       
  9688 		var end = color( other ),
       
  9689 			spaceName = end._space(),
       
  9690 			space = spaces[ spaceName ],
       
  9691 			startColor = this.alpha() === 0 ? color( "transparent" ) : this,
       
  9692 			start = startColor[ space.cache ] || space.to( startColor._rgba ),
       
  9693 			result = start.slice();
       
  9694 
       
  9695 		end = end[ space.cache ];
       
  9696 		each( space.props, function( key, prop ) {
       
  9697 			var index = prop.idx,
       
  9698 				startValue = start[ index ],
       
  9699 				endValue = end[ index ],
       
  9700 				type = propTypes[ prop.type ] || {};
       
  9701 
       
  9702 			// if null, don't override start value
       
  9703 			if ( endValue === null ) {
       
  9704 				return;
       
  9705 			}
       
  9706 			// if null - use end
       
  9707 			if ( startValue === null ) {
       
  9708 				result[ index ] = endValue;
 10411 			} else {
  9709 			} else {
 10412 				position = $.ui.dialog.prototype.options.position;
  9710 				if ( type.mod ) {
 10413 			}
  9711 					if ( endValue - startValue > type.mod / 2 ) {
 10414 
  9712 						startValue += type.mod;
 10415 			// need to show the dialog to get the actual offset in the position plugin
  9713 					} else if ( startValue - endValue > type.mod / 2 ) {
 10416 			isVisible = this.uiDialog.is(":visible");
  9714 						startValue -= type.mod;
 10417 			if ( !isVisible ) {
  9715 					}
 10418 				this.uiDialog.show();
  9716 				}
 10419 			}
  9717 				result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
 10420 			this.uiDialog.position( position );
  9718 			}
 10421 			if ( !isVisible ) {
  9719 		});
 10422 				this.uiDialog.hide();
  9720 		return this[ spaceName ]( result );
 10423 			}
  9721 	},
 10424 		}
  9722 	blend: function( opaque ) {
       
  9723 		// if we are already opaque - return ourself
       
  9724 		if ( this._rgba[ 3 ] === 1 ) {
       
  9725 			return this;
       
  9726 		}
       
  9727 
       
  9728 		var rgb = this._rgba.slice(),
       
  9729 			a = rgb.pop(),
       
  9730 			blend = color( opaque )._rgba;
       
  9731 
       
  9732 		return color( jQuery.map( rgb, function( v, i ) {
       
  9733 			return ( 1 - a ) * blend[ i ] + a * v;
       
  9734 		}));
       
  9735 	},
       
  9736 	toRgbaString: function() {
       
  9737 		var prefix = "rgba(",
       
  9738 			rgba = jQuery.map( this._rgba, function( v, i ) {
       
  9739 				return v == null ? ( i > 2 ? 1 : 0 ) : v;
       
  9740 			});
       
  9741 
       
  9742 		if ( rgba[ 3 ] === 1 ) {
       
  9743 			rgba.pop();
       
  9744 			prefix = "rgb(";
       
  9745 		}
       
  9746 
       
  9747 		return prefix + rgba.join() + ")";
       
  9748 	},
       
  9749 	toHslaString: function() {
       
  9750 		var prefix = "hsla(",
       
  9751 			hsla = jQuery.map( this.hsla(), function( v, i ) {
       
  9752 				if ( v == null ) {
       
  9753 					v = i > 2 ? 1 : 0;
       
  9754 				}
       
  9755 
       
  9756 				// catch 1 and 2
       
  9757 				if ( i && i < 3 ) {
       
  9758 					v = Math.round( v * 100 ) + "%";
       
  9759 				}
       
  9760 				return v;
       
  9761 			});
       
  9762 
       
  9763 		if ( hsla[ 3 ] === 1 ) {
       
  9764 			hsla.pop();
       
  9765 			prefix = "hsl(";
       
  9766 		}
       
  9767 		return prefix + hsla.join() + ")";
       
  9768 	},
       
  9769 	toHexString: function( includeAlpha ) {
       
  9770 		var rgba = this._rgba.slice(),
       
  9771 			alpha = rgba.pop();
       
  9772 
       
  9773 		if ( includeAlpha ) {
       
  9774 			rgba.push( ~~( alpha * 255 ) );
       
  9775 		}
       
  9776 
       
  9777 		return "#" + jQuery.map( rgba, function( v ) {
       
  9778 
       
  9779 			// default to 0 when nulls exist
       
  9780 			v = ( v || 0 ).toString( 16 );
       
  9781 			return v.length === 1 ? "0" + v : v;
       
  9782 		}).join("");
       
  9783 	},
       
  9784 	toString: function() {
       
  9785 		return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
       
  9786 	}
       
  9787 });
       
  9788 color.fn.parse.prototype = color.fn;
       
  9789 
       
  9790 // hsla conversions adapted from:
       
  9791 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
       
  9792 
       
  9793 function hue2rgb( p, q, h ) {
       
  9794 	h = ( h + 1 ) % 1;
       
  9795 	if ( h * 6 < 1 ) {
       
  9796 		return p + ( q - p ) * h * 6;
       
  9797 	}
       
  9798 	if ( h * 2 < 1) {
       
  9799 		return q;
       
  9800 	}
       
  9801 	if ( h * 3 < 2 ) {
       
  9802 		return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
       
  9803 	}
       
  9804 	return p;
       
  9805 }
       
  9806 
       
  9807 spaces.hsla.to = function( rgba ) {
       
  9808 	if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
       
  9809 		return [ null, null, null, rgba[ 3 ] ];
       
  9810 	}
       
  9811 	var r = rgba[ 0 ] / 255,
       
  9812 		g = rgba[ 1 ] / 255,
       
  9813 		b = rgba[ 2 ] / 255,
       
  9814 		a = rgba[ 3 ],
       
  9815 		max = Math.max( r, g, b ),
       
  9816 		min = Math.min( r, g, b ),
       
  9817 		diff = max - min,
       
  9818 		add = max + min,
       
  9819 		l = add * 0.5,
       
  9820 		h, s;
       
  9821 
       
  9822 	if ( min === max ) {
       
  9823 		h = 0;
       
  9824 	} else if ( r === max ) {
       
  9825 		h = ( 60 * ( g - b ) / diff ) + 360;
       
  9826 	} else if ( g === max ) {
       
  9827 		h = ( 60 * ( b - r ) / diff ) + 120;
       
  9828 	} else {
       
  9829 		h = ( 60 * ( r - g ) / diff ) + 240;
       
  9830 	}
       
  9831 
       
  9832 	// chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
       
  9833 	// otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
       
  9834 	if ( diff === 0 ) {
       
  9835 		s = 0;
       
  9836 	} else if ( l <= 0.5 ) {
       
  9837 		s = diff / add;
       
  9838 	} else {
       
  9839 		s = diff / ( 2 - add );
       
  9840 	}
       
  9841 	return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
       
  9842 };
       
  9843 
       
  9844 spaces.hsla.from = function( hsla ) {
       
  9845 	if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
       
  9846 		return [ null, null, null, hsla[ 3 ] ];
       
  9847 	}
       
  9848 	var h = hsla[ 0 ] / 360,
       
  9849 		s = hsla[ 1 ],
       
  9850 		l = hsla[ 2 ],
       
  9851 		a = hsla[ 3 ],
       
  9852 		q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
       
  9853 		p = 2 * l - q;
       
  9854 
       
  9855 	return [
       
  9856 		Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
       
  9857 		Math.round( hue2rgb( p, q, h ) * 255 ),
       
  9858 		Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
       
  9859 		a
       
  9860 	];
       
  9861 };
       
  9862 
       
  9863 each( spaces, function( spaceName, space ) {
       
  9864 	var props = space.props,
       
  9865 		cache = space.cache,
       
  9866 		to = space.to,
       
  9867 		from = space.from;
       
  9868 
       
  9869 	// makes rgba() and hsla()
       
  9870 	color.fn[ spaceName ] = function( value ) {
       
  9871 
       
  9872 		// generate a cache for this space if it doesn't exist
       
  9873 		if ( to && !this[ cache ] ) {
       
  9874 			this[ cache ] = to( this._rgba );
       
  9875 		}
       
  9876 		if ( value === undefined ) {
       
  9877 			return this[ cache ].slice();
       
  9878 		}
       
  9879 
       
  9880 		var ret,
       
  9881 			type = jQuery.type( value ),
       
  9882 			arr = ( type === "array" || type === "object" ) ? value : arguments,
       
  9883 			local = this[ cache ].slice();
       
  9884 
       
  9885 		each( props, function( key, prop ) {
       
  9886 			var val = arr[ type === "object" ? key : prop.idx ];
       
  9887 			if ( val == null ) {
       
  9888 				val = local[ prop.idx ];
       
  9889 			}
       
  9890 			local[ prop.idx ] = clamp( val, prop );
       
  9891 		});
       
  9892 
       
  9893 		if ( from ) {
       
  9894 			ret = color( from( local ) );
       
  9895 			ret[ cache ] = local;
       
  9896 			return ret;
       
  9897 		} else {
       
  9898 			return color( local );
       
  9899 		}
       
  9900 	};
       
  9901 
       
  9902 	// makes red() green() blue() alpha() hue() saturation() lightness()
       
  9903 	each( props, function( key, prop ) {
       
  9904 		// alpha is included in more than one space
       
  9905 		if ( color.fn[ key ] ) {
       
  9906 			return;
       
  9907 		}
       
  9908 		color.fn[ key ] = function( value ) {
       
  9909 			var vtype = jQuery.type( value ),
       
  9910 				fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
       
  9911 				local = this[ fn ](),
       
  9912 				cur = local[ prop.idx ],
       
  9913 				match;
       
  9914 
       
  9915 			if ( vtype === "undefined" ) {
       
  9916 				return cur;
       
  9917 			}
       
  9918 
       
  9919 			if ( vtype === "function" ) {
       
  9920 				value = value.call( this, cur );
       
  9921 				vtype = jQuery.type( value );
       
  9922 			}
       
  9923 			if ( value == null && prop.empty ) {
       
  9924 				return this;
       
  9925 			}
       
  9926 			if ( vtype === "string" ) {
       
  9927 				match = rplusequals.exec( value );
       
  9928 				if ( match ) {
       
  9929 					value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
       
  9930 				}
       
  9931 			}
       
  9932 			local[ prop.idx ] = value;
       
  9933 			return this[ fn ]( local );
       
  9934 		};
 10425 	});
  9935 	});
       
  9936 });
       
  9937 
       
  9938 // add cssHook and .fx.step function for each named hook.
       
  9939 // accept a space separated string of properties
       
  9940 color.hook = function( hook ) {
       
  9941 	var hooks = hook.split( " " );
       
  9942 	each( hooks, function( i, hook ) {
       
  9943 		jQuery.cssHooks[ hook ] = {
       
  9944 			set: function( elem, value ) {
       
  9945 				var parsed, curElem,
       
  9946 					backgroundColor = "";
       
  9947 
       
  9948 				if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
       
  9949 					value = color( parsed || value );
       
  9950 					if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
       
  9951 						curElem = hook === "backgroundColor" ? elem.parentNode : elem;
       
  9952 						while (
       
  9953 							(backgroundColor === "" || backgroundColor === "transparent") &&
       
  9954 							curElem && curElem.style
       
  9955 						) {
       
  9956 							try {
       
  9957 								backgroundColor = jQuery.css( curElem, "backgroundColor" );
       
  9958 								curElem = curElem.parentNode;
       
  9959 							} catch ( e ) {
       
  9960 							}
       
  9961 						}
       
  9962 
       
  9963 						value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
       
  9964 							backgroundColor :
       
  9965 							"_default" );
       
  9966 					}
       
  9967 
       
  9968 					value = value.toRgbaString();
       
  9969 				}
       
  9970 				try {
       
  9971 					elem.style[ hook ] = value;
       
  9972 				} catch ( e ) {
       
  9973 					// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
       
  9974 				}
       
  9975 			}
       
  9976 		};
       
  9977 		jQuery.fx.step[ hook ] = function( fx ) {
       
  9978 			if ( !fx.colorInit ) {
       
  9979 				fx.start = color( fx.elem, hook );
       
  9980 				fx.end = color( fx.end );
       
  9981 				fx.colorInit = true;
       
  9982 			}
       
  9983 			jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
       
  9984 		};
       
  9985 	});
       
  9986 
       
  9987 };
       
  9988 
       
  9989 color.hook( stepHooks );
       
  9990 
       
  9991 jQuery.cssHooks.borderColor = {
       
  9992 	expand: function( value ) {
       
  9993 		var expanded = {};
       
  9994 
       
  9995 		each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
       
  9996 			expanded[ "border" + part + "Color" ] = value;
       
  9997 		});
       
  9998 		return expanded;
       
  9999 	}
       
 10000 };
       
 10001 
       
 10002 // Basic color names only.
       
 10003 // Usage of any of the other color names requires adding yourself or including
       
 10004 // jquery.color.svg-names.js.
       
 10005 colors = jQuery.Color.names = {
       
 10006 	// 4.1. Basic color keywords
       
 10007 	aqua: "#00ffff",
       
 10008 	black: "#000000",
       
 10009 	blue: "#0000ff",
       
 10010 	fuchsia: "#ff00ff",
       
 10011 	gray: "#808080",
       
 10012 	green: "#008000",
       
 10013 	lime: "#00ff00",
       
 10014 	maroon: "#800000",
       
 10015 	navy: "#000080",
       
 10016 	olive: "#808000",
       
 10017 	purple: "#800080",
       
 10018 	red: "#ff0000",
       
 10019 	silver: "#c0c0c0",
       
 10020 	teal: "#008080",
       
 10021 	white: "#ffffff",
       
 10022 	yellow: "#ffff00",
       
 10023 
       
 10024 	// 4.2.3. "transparent" color keyword
       
 10025 	transparent: [ null, null, null, 0 ],
       
 10026 
       
 10027 	_default: "#ffffff"
       
 10028 };
       
 10029 
       
 10030 })( jQuery );
       
 10031 
       
 10032 /******************************************************************************/
       
 10033 /****************************** CLASS ANIMATIONS ******************************/
       
 10034 /******************************************************************************/
       
 10035 (function() {
       
 10036 
       
 10037 var classAnimationActions = [ "add", "remove", "toggle" ],
       
 10038 	shorthandStyles = {
       
 10039 		border: 1,
       
 10040 		borderBottom: 1,
       
 10041 		borderColor: 1,
       
 10042 		borderLeft: 1,
       
 10043 		borderRight: 1,
       
 10044 		borderTop: 1,
       
 10045 		borderWidth: 1,
       
 10046 		margin: 1,
       
 10047 		padding: 1
       
 10048 	};
       
 10049 
       
 10050 $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
       
 10051 	$.fx.step[ prop ] = function( fx ) {
       
 10052 		if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
       
 10053 			jQuery.style( fx.elem, prop, fx.end );
       
 10054 			fx.setAttr = true;
       
 10055 		}
       
 10056 	};
       
 10057 });
       
 10058 
       
 10059 function getElementStyles( elem ) {
       
 10060 	var key, len,
       
 10061 		style = elem.ownerDocument.defaultView ?
       
 10062 			elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
       
 10063 			elem.currentStyle,
       
 10064 		styles = {};
       
 10065 
       
 10066 	if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
       
 10067 		len = style.length;
       
 10068 		while ( len-- ) {
       
 10069 			key = style[ len ];
       
 10070 			if ( typeof style[ key ] === "string" ) {
       
 10071 				styles[ $.camelCase( key ) ] = style[ key ];
       
 10072 			}
       
 10073 		}
       
 10074 	// support: Opera, IE <9
       
 10075 	} else {
       
 10076 		for ( key in style ) {
       
 10077 			if ( typeof style[ key ] === "string" ) {
       
 10078 				styles[ key ] = style[ key ];
       
 10079 			}
       
 10080 		}
       
 10081 	}
       
 10082 
       
 10083 	return styles;
 10426 }
 10084 }
 10427 
 10085 
 10428 }( jQuery ) );
 10086 function styleDifference( oldStyle, newStyle ) {
 10429 
 10087 	var diff = {},
 10430 (function( $, undefined ) {
 10088 		name, value;
 10431 
 10089 
 10432 var rvertical = /up|down|vertical/,
 10090 	for ( name in newStyle ) {
 10433 	rpositivemotion = /up|left|vertical|horizontal/;
 10091 		value = newStyle[ name ];
 10434 
 10092 		if ( oldStyle[ name ] !== value ) {
 10435 $.effects.effect.blind = function( o, done ) {
 10093 			if ( !shorthandStyles[ name ] ) {
       
 10094 				if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
       
 10095 					diff[ name ] = value;
       
 10096 				}
       
 10097 			}
       
 10098 		}
       
 10099 	}
       
 10100 
       
 10101 	return diff;
       
 10102 }
       
 10103 
       
 10104 // support: jQuery <1.8
       
 10105 if ( !$.fn.addBack ) {
       
 10106 	$.fn.addBack = function( selector ) {
       
 10107 		return this.add( selector == null ?
       
 10108 			this.prevObject : this.prevObject.filter( selector )
       
 10109 		);
       
 10110 	};
       
 10111 }
       
 10112 
       
 10113 $.effects.animateClass = function( value, duration, easing, callback ) {
       
 10114 	var o = $.speed( duration, easing, callback );
       
 10115 
       
 10116 	return this.queue( function() {
       
 10117 		var animated = $( this ),
       
 10118 			baseClass = animated.attr( "class" ) || "",
       
 10119 			applyClassChange,
       
 10120 			allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
       
 10121 
       
 10122 		// map the animated objects to store the original styles.
       
 10123 		allAnimations = allAnimations.map(function() {
       
 10124 			var el = $( this );
       
 10125 			return {
       
 10126 				el: el,
       
 10127 				start: getElementStyles( this )
       
 10128 			};
       
 10129 		});
       
 10130 
       
 10131 		// apply class change
       
 10132 		applyClassChange = function() {
       
 10133 			$.each( classAnimationActions, function(i, action) {
       
 10134 				if ( value[ action ] ) {
       
 10135 					animated[ action + "Class" ]( value[ action ] );
       
 10136 				}
       
 10137 			});
       
 10138 		};
       
 10139 		applyClassChange();
       
 10140 
       
 10141 		// map all animated objects again - calculate new styles and diff
       
 10142 		allAnimations = allAnimations.map(function() {
       
 10143 			this.end = getElementStyles( this.el[ 0 ] );
       
 10144 			this.diff = styleDifference( this.start, this.end );
       
 10145 			return this;
       
 10146 		});
       
 10147 
       
 10148 		// apply original class
       
 10149 		animated.attr( "class", baseClass );
       
 10150 
       
 10151 		// map all animated objects again - this time collecting a promise
       
 10152 		allAnimations = allAnimations.map(function() {
       
 10153 			var styleInfo = this,
       
 10154 				dfd = $.Deferred(),
       
 10155 				opts = $.extend({}, o, {
       
 10156 					queue: false,
       
 10157 					complete: function() {
       
 10158 						dfd.resolve( styleInfo );
       
 10159 					}
       
 10160 				});
       
 10161 
       
 10162 			this.el.animate( this.diff, opts );
       
 10163 			return dfd.promise();
       
 10164 		});
       
 10165 
       
 10166 		// once all animations have completed:
       
 10167 		$.when.apply( $, allAnimations.get() ).done(function() {
       
 10168 
       
 10169 			// set the final class
       
 10170 			applyClassChange();
       
 10171 
       
 10172 			// for each animated element,
       
 10173 			// clear all css properties that were animated
       
 10174 			$.each( arguments, function() {
       
 10175 				var el = this.el;
       
 10176 				$.each( this.diff, function(key) {
       
 10177 					el.css( key, "" );
       
 10178 				});
       
 10179 			});
       
 10180 
       
 10181 			// this is guarnteed to be there if you use jQuery.speed()
       
 10182 			// it also handles dequeuing the next anim...
       
 10183 			o.complete.call( animated[ 0 ] );
       
 10184 		});
       
 10185 	});
       
 10186 };
       
 10187 
       
 10188 $.fn.extend({
       
 10189 	addClass: (function( orig ) {
       
 10190 		return function( classNames, speed, easing, callback ) {
       
 10191 			return speed ?
       
 10192 				$.effects.animateClass.call( this,
       
 10193 					{ add: classNames }, speed, easing, callback ) :
       
 10194 				orig.apply( this, arguments );
       
 10195 		};
       
 10196 	})( $.fn.addClass ),
       
 10197 
       
 10198 	removeClass: (function( orig ) {
       
 10199 		return function( classNames, speed, easing, callback ) {
       
 10200 			return arguments.length > 1 ?
       
 10201 				$.effects.animateClass.call( this,
       
 10202 					{ remove: classNames }, speed, easing, callback ) :
       
 10203 				orig.apply( this, arguments );
       
 10204 		};
       
 10205 	})( $.fn.removeClass ),
       
 10206 
       
 10207 	toggleClass: (function( orig ) {
       
 10208 		return function( classNames, force, speed, easing, callback ) {
       
 10209 			if ( typeof force === "boolean" || force === undefined ) {
       
 10210 				if ( !speed ) {
       
 10211 					// without speed parameter
       
 10212 					return orig.apply( this, arguments );
       
 10213 				} else {
       
 10214 					return $.effects.animateClass.call( this,
       
 10215 						(force ? { add: classNames } : { remove: classNames }),
       
 10216 						speed, easing, callback );
       
 10217 				}
       
 10218 			} else {
       
 10219 				// without force parameter
       
 10220 				return $.effects.animateClass.call( this,
       
 10221 					{ toggle: classNames }, force, speed, easing );
       
 10222 			}
       
 10223 		};
       
 10224 	})( $.fn.toggleClass ),
       
 10225 
       
 10226 	switchClass: function( remove, add, speed, easing, callback) {
       
 10227 		return $.effects.animateClass.call( this, {
       
 10228 			add: add,
       
 10229 			remove: remove
       
 10230 		}, speed, easing, callback );
       
 10231 	}
       
 10232 });
       
 10233 
       
 10234 })();
       
 10235 
       
 10236 /******************************************************************************/
       
 10237 /*********************************** EFFECTS **********************************/
       
 10238 /******************************************************************************/
       
 10239 
       
 10240 (function() {
       
 10241 
       
 10242 $.extend( $.effects, {
       
 10243 	version: "1.11.4",
       
 10244 
       
 10245 	// Saves a set of properties in a data storage
       
 10246 	save: function( element, set ) {
       
 10247 		for ( var i = 0; i < set.length; i++ ) {
       
 10248 			if ( set[ i ] !== null ) {
       
 10249 				element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
       
 10250 			}
       
 10251 		}
       
 10252 	},
       
 10253 
       
 10254 	// Restores a set of previously saved properties from a data storage
       
 10255 	restore: function( element, set ) {
       
 10256 		var val, i;
       
 10257 		for ( i = 0; i < set.length; i++ ) {
       
 10258 			if ( set[ i ] !== null ) {
       
 10259 				val = element.data( dataSpace + set[ i ] );
       
 10260 				// support: jQuery 1.6.2
       
 10261 				// http://bugs.jquery.com/ticket/9917
       
 10262 				// jQuery 1.6.2 incorrectly returns undefined for any falsy value.
       
 10263 				// We can't differentiate between "" and 0 here, so we just assume
       
 10264 				// empty string since it's likely to be a more common value...
       
 10265 				if ( val === undefined ) {
       
 10266 					val = "";
       
 10267 				}
       
 10268 				element.css( set[ i ], val );
       
 10269 			}
       
 10270 		}
       
 10271 	},
       
 10272 
       
 10273 	setMode: function( el, mode ) {
       
 10274 		if (mode === "toggle") {
       
 10275 			mode = el.is( ":hidden" ) ? "show" : "hide";
       
 10276 		}
       
 10277 		return mode;
       
 10278 	},
       
 10279 
       
 10280 	// Translates a [top,left] array into a baseline value
       
 10281 	// this should be a little more flexible in the future to handle a string & hash
       
 10282 	getBaseline: function( origin, original ) {
       
 10283 		var y, x;
       
 10284 		switch ( origin[ 0 ] ) {
       
 10285 			case "top": y = 0; break;
       
 10286 			case "middle": y = 0.5; break;
       
 10287 			case "bottom": y = 1; break;
       
 10288 			default: y = origin[ 0 ] / original.height;
       
 10289 		}
       
 10290 		switch ( origin[ 1 ] ) {
       
 10291 			case "left": x = 0; break;
       
 10292 			case "center": x = 0.5; break;
       
 10293 			case "right": x = 1; break;
       
 10294 			default: x = origin[ 1 ] / original.width;
       
 10295 		}
       
 10296 		return {
       
 10297 			x: x,
       
 10298 			y: y
       
 10299 		};
       
 10300 	},
       
 10301 
       
 10302 	// Wraps the element around a wrapper that copies position properties
       
 10303 	createWrapper: function( element ) {
       
 10304 
       
 10305 		// if the element is already wrapped, return it
       
 10306 		if ( element.parent().is( ".ui-effects-wrapper" )) {
       
 10307 			return element.parent();
       
 10308 		}
       
 10309 
       
 10310 		// wrap the element
       
 10311 		var props = {
       
 10312 				width: element.outerWidth(true),
       
 10313 				height: element.outerHeight(true),
       
 10314 				"float": element.css( "float" )
       
 10315 			},
       
 10316 			wrapper = $( "<div></div>" )
       
 10317 				.addClass( "ui-effects-wrapper" )
       
 10318 				.css({
       
 10319 					fontSize: "100%",
       
 10320 					background: "transparent",
       
 10321 					border: "none",
       
 10322 					margin: 0,
       
 10323 					padding: 0
       
 10324 				}),
       
 10325 			// Store the size in case width/height are defined in % - Fixes #5245
       
 10326 			size = {
       
 10327 				width: element.width(),
       
 10328 				height: element.height()
       
 10329 			},
       
 10330 			active = document.activeElement;
       
 10331 
       
 10332 		// support: Firefox
       
 10333 		// Firefox incorrectly exposes anonymous content
       
 10334 		// https://bugzilla.mozilla.org/show_bug.cgi?id=561664
       
 10335 		try {
       
 10336 			active.id;
       
 10337 		} catch ( e ) {
       
 10338 			active = document.body;
       
 10339 		}
       
 10340 
       
 10341 		element.wrap( wrapper );
       
 10342 
       
 10343 		// Fixes #7595 - Elements lose focus when wrapped.
       
 10344 		if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
       
 10345 			$( active ).focus();
       
 10346 		}
       
 10347 
       
 10348 		wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
       
 10349 
       
 10350 		// transfer positioning properties to the wrapper
       
 10351 		if ( element.css( "position" ) === "static" ) {
       
 10352 			wrapper.css({ position: "relative" });
       
 10353 			element.css({ position: "relative" });
       
 10354 		} else {
       
 10355 			$.extend( props, {
       
 10356 				position: element.css( "position" ),
       
 10357 				zIndex: element.css( "z-index" )
       
 10358 			});
       
 10359 			$.each([ "top", "left", "bottom", "right" ], function(i, pos) {
       
 10360 				props[ pos ] = element.css( pos );
       
 10361 				if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
       
 10362 					props[ pos ] = "auto";
       
 10363 				}
       
 10364 			});
       
 10365 			element.css({
       
 10366 				position: "relative",
       
 10367 				top: 0,
       
 10368 				left: 0,
       
 10369 				right: "auto",
       
 10370 				bottom: "auto"
       
 10371 			});
       
 10372 		}
       
 10373 		element.css(size);
       
 10374 
       
 10375 		return wrapper.css( props ).show();
       
 10376 	},
       
 10377 
       
 10378 	removeWrapper: function( element ) {
       
 10379 		var active = document.activeElement;
       
 10380 
       
 10381 		if ( element.parent().is( ".ui-effects-wrapper" ) ) {
       
 10382 			element.parent().replaceWith( element );
       
 10383 
       
 10384 			// Fixes #7595 - Elements lose focus when wrapped.
       
 10385 			if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
       
 10386 				$( active ).focus();
       
 10387 			}
       
 10388 		}
       
 10389 
       
 10390 		return element;
       
 10391 	},
       
 10392 
       
 10393 	setTransition: function( element, list, factor, value ) {
       
 10394 		value = value || {};
       
 10395 		$.each( list, function( i, x ) {
       
 10396 			var unit = element.cssUnit( x );
       
 10397 			if ( unit[ 0 ] > 0 ) {
       
 10398 				value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
       
 10399 			}
       
 10400 		});
       
 10401 		return value;
       
 10402 	}
       
 10403 });
       
 10404 
       
 10405 // return an effect options object for the given parameters:
       
 10406 function _normalizeArguments( effect, options, speed, callback ) {
       
 10407 
       
 10408 	// allow passing all options as the first parameter
       
 10409 	if ( $.isPlainObject( effect ) ) {
       
 10410 		options = effect;
       
 10411 		effect = effect.effect;
       
 10412 	}
       
 10413 
       
 10414 	// convert to an object
       
 10415 	effect = { effect: effect };
       
 10416 
       
 10417 	// catch (effect, null, ...)
       
 10418 	if ( options == null ) {
       
 10419 		options = {};
       
 10420 	}
       
 10421 
       
 10422 	// catch (effect, callback)
       
 10423 	if ( $.isFunction( options ) ) {
       
 10424 		callback = options;
       
 10425 		speed = null;
       
 10426 		options = {};
       
 10427 	}
       
 10428 
       
 10429 	// catch (effect, speed, ?)
       
 10430 	if ( typeof options === "number" || $.fx.speeds[ options ] ) {
       
 10431 		callback = speed;
       
 10432 		speed = options;
       
 10433 		options = {};
       
 10434 	}
       
 10435 
       
 10436 	// catch (effect, options, callback)
       
 10437 	if ( $.isFunction( speed ) ) {
       
 10438 		callback = speed;
       
 10439 		speed = null;
       
 10440 	}
       
 10441 
       
 10442 	// add options to effect
       
 10443 	if ( options ) {
       
 10444 		$.extend( effect, options );
       
 10445 	}
       
 10446 
       
 10447 	speed = speed || options.duration;
       
 10448 	effect.duration = $.fx.off ? 0 :
       
 10449 		typeof speed === "number" ? speed :
       
 10450 		speed in $.fx.speeds ? $.fx.speeds[ speed ] :
       
 10451 		$.fx.speeds._default;
       
 10452 
       
 10453 	effect.complete = callback || options.complete;
       
 10454 
       
 10455 	return effect;
       
 10456 }
       
 10457 
       
 10458 function standardAnimationOption( option ) {
       
 10459 	// Valid standard speeds (nothing, number, named speed)
       
 10460 	if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
       
 10461 		return true;
       
 10462 	}
       
 10463 
       
 10464 	// Invalid strings - treat as "normal" speed
       
 10465 	if ( typeof option === "string" && !$.effects.effect[ option ] ) {
       
 10466 		return true;
       
 10467 	}
       
 10468 
       
 10469 	// Complete callback
       
 10470 	if ( $.isFunction( option ) ) {
       
 10471 		return true;
       
 10472 	}
       
 10473 
       
 10474 	// Options hash (but not naming an effect)
       
 10475 	if ( typeof option === "object" && !option.effect ) {
       
 10476 		return true;
       
 10477 	}
       
 10478 
       
 10479 	// Didn't match any standard API
       
 10480 	return false;
       
 10481 }
       
 10482 
       
 10483 $.fn.extend({
       
 10484 	effect: function( /* effect, options, speed, callback */ ) {
       
 10485 		var args = _normalizeArguments.apply( this, arguments ),
       
 10486 			mode = args.mode,
       
 10487 			queue = args.queue,
       
 10488 			effectMethod = $.effects.effect[ args.effect ];
       
 10489 
       
 10490 		if ( $.fx.off || !effectMethod ) {
       
 10491 			// delegate to the original method (e.g., .show()) if possible
       
 10492 			if ( mode ) {
       
 10493 				return this[ mode ]( args.duration, args.complete );
       
 10494 			} else {
       
 10495 				return this.each( function() {
       
 10496 					if ( args.complete ) {
       
 10497 						args.complete.call( this );
       
 10498 					}
       
 10499 				});
       
 10500 			}
       
 10501 		}
       
 10502 
       
 10503 		function run( next ) {
       
 10504 			var elem = $( this ),
       
 10505 				complete = args.complete,
       
 10506 				mode = args.mode;
       
 10507 
       
 10508 			function done() {
       
 10509 				if ( $.isFunction( complete ) ) {
       
 10510 					complete.call( elem[0] );
       
 10511 				}
       
 10512 				if ( $.isFunction( next ) ) {
       
 10513 					next();
       
 10514 				}
       
 10515 			}
       
 10516 
       
 10517 			// If the element already has the correct final state, delegate to
       
 10518 			// the core methods so the internal tracking of "olddisplay" works.
       
 10519 			if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
       
 10520 				elem[ mode ]();
       
 10521 				done();
       
 10522 			} else {
       
 10523 				effectMethod.call( elem[0], args, done );
       
 10524 			}
       
 10525 		}
       
 10526 
       
 10527 		return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
       
 10528 	},
       
 10529 
       
 10530 	show: (function( orig ) {
       
 10531 		return function( option ) {
       
 10532 			if ( standardAnimationOption( option ) ) {
       
 10533 				return orig.apply( this, arguments );
       
 10534 			} else {
       
 10535 				var args = _normalizeArguments.apply( this, arguments );
       
 10536 				args.mode = "show";
       
 10537 				return this.effect.call( this, args );
       
 10538 			}
       
 10539 		};
       
 10540 	})( $.fn.show ),
       
 10541 
       
 10542 	hide: (function( orig ) {
       
 10543 		return function( option ) {
       
 10544 			if ( standardAnimationOption( option ) ) {
       
 10545 				return orig.apply( this, arguments );
       
 10546 			} else {
       
 10547 				var args = _normalizeArguments.apply( this, arguments );
       
 10548 				args.mode = "hide";
       
 10549 				return this.effect.call( this, args );
       
 10550 			}
       
 10551 		};
       
 10552 	})( $.fn.hide ),
       
 10553 
       
 10554 	toggle: (function( orig ) {
       
 10555 		return function( option ) {
       
 10556 			if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
       
 10557 				return orig.apply( this, arguments );
       
 10558 			} else {
       
 10559 				var args = _normalizeArguments.apply( this, arguments );
       
 10560 				args.mode = "toggle";
       
 10561 				return this.effect.call( this, args );
       
 10562 			}
       
 10563 		};
       
 10564 	})( $.fn.toggle ),
       
 10565 
       
 10566 	// helper functions
       
 10567 	cssUnit: function(key) {
       
 10568 		var style = this.css( key ),
       
 10569 			val = [];
       
 10570 
       
 10571 		$.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
       
 10572 			if ( style.indexOf( unit ) > 0 ) {
       
 10573 				val = [ parseFloat( style ), unit ];
       
 10574 			}
       
 10575 		});
       
 10576 		return val;
       
 10577 	}
       
 10578 });
       
 10579 
       
 10580 })();
       
 10581 
       
 10582 /******************************************************************************/
       
 10583 /*********************************** EASING ***********************************/
       
 10584 /******************************************************************************/
       
 10585 
       
 10586 (function() {
       
 10587 
       
 10588 // based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
       
 10589 
       
 10590 var baseEasings = {};
       
 10591 
       
 10592 $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
       
 10593 	baseEasings[ name ] = function( p ) {
       
 10594 		return Math.pow( p, i + 2 );
       
 10595 	};
       
 10596 });
       
 10597 
       
 10598 $.extend( baseEasings, {
       
 10599 	Sine: function( p ) {
       
 10600 		return 1 - Math.cos( p * Math.PI / 2 );
       
 10601 	},
       
 10602 	Circ: function( p ) {
       
 10603 		return 1 - Math.sqrt( 1 - p * p );
       
 10604 	},
       
 10605 	Elastic: function( p ) {
       
 10606 		return p === 0 || p === 1 ? p :
       
 10607 			-Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
       
 10608 	},
       
 10609 	Back: function( p ) {
       
 10610 		return p * p * ( 3 * p - 2 );
       
 10611 	},
       
 10612 	Bounce: function( p ) {
       
 10613 		var pow2,
       
 10614 			bounce = 4;
       
 10615 
       
 10616 		while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
       
 10617 		return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
       
 10618 	}
       
 10619 });
       
 10620 
       
 10621 $.each( baseEasings, function( name, easeIn ) {
       
 10622 	$.easing[ "easeIn" + name ] = easeIn;
       
 10623 	$.easing[ "easeOut" + name ] = function( p ) {
       
 10624 		return 1 - easeIn( 1 - p );
       
 10625 	};
       
 10626 	$.easing[ "easeInOut" + name ] = function( p ) {
       
 10627 		return p < 0.5 ?
       
 10628 			easeIn( p * 2 ) / 2 :
       
 10629 			1 - easeIn( p * -2 + 2 ) / 2;
       
 10630 	};
       
 10631 });
       
 10632 
       
 10633 })();
       
 10634 
       
 10635 var effect = $.effects;
       
 10636 
       
 10637 
       
 10638 /*!
       
 10639  * jQuery UI Effects Blind 1.11.4
       
 10640  * http://jqueryui.com
       
 10641  *
       
 10642  * Copyright jQuery Foundation and other contributors
       
 10643  * Released under the MIT license.
       
 10644  * http://jquery.org/license
       
 10645  *
       
 10646  * http://api.jqueryui.com/blind-effect/
       
 10647  */
       
 10648 
       
 10649 
       
 10650 var effectBlind = $.effects.effect.blind = function( o, done ) {
 10436 	// Create element
 10651 	// Create element
 10437 	var el = $( this ),
 10652 	var el = $( this ),
       
 10653 		rvertical = /up|down|vertical/,
       
 10654 		rpositivemotion = /up|left|vertical|horizontal/,
 10438 		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
 10655 		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
 10439 		mode = $.effects.setMode( el, o.mode || "hide" ),
 10656 		mode = $.effects.setMode( el, o.mode || "hide" ),
 10440 		direction = o.direction || "up",
 10657 		direction = o.direction || "up",
 10441 		vertical = rvertical.test( direction ),
 10658 		vertical = rvertical.test( direction ),
 10442 		ref = vertical ? "height" : "width",
 10659 		ref = vertical ? "height" : "width",
 10471 	}
 10688 	}
 10472 
 10689 
 10473 	// start at 0 if we are showing
 10690 	// start at 0 if we are showing
 10474 	if ( show ) {
 10691 	if ( show ) {
 10475 		wrapper.css( ref, 0 );
 10692 		wrapper.css( ref, 0 );
 10476 		if ( ! motion ) {
 10693 		if ( !motion ) {
 10477 			wrapper.css( ref2, margin + distance );
 10694 			wrapper.css( ref2, margin + distance );
 10478 		}
 10695 		}
 10479 	}
 10696 	}
 10480 
 10697 
 10481 	// Animate
 10698 	// Animate
 10490 			$.effects.restore( el, props );
 10707 			$.effects.restore( el, props );
 10491 			$.effects.removeWrapper( el );
 10708 			$.effects.removeWrapper( el );
 10492 			done();
 10709 			done();
 10493 		}
 10710 		}
 10494 	});
 10711 	});
 10495 
       
 10496 };
 10712 };
 10497 
 10713 
 10498 })(jQuery);
 10714 
 10499 
 10715 /*!
 10500 (function( $, undefined ) {
 10716  * jQuery UI Effects Bounce 1.11.4
 10501 
 10717  * http://jqueryui.com
 10502 $.effects.effect.bounce = function( o, done ) {
 10718  *
       
 10719  * Copyright jQuery Foundation and other contributors
       
 10720  * Released under the MIT license.
       
 10721  * http://jquery.org/license
       
 10722  *
       
 10723  * http://api.jqueryui.com/bounce-effect/
       
 10724  */
       
 10725 
       
 10726 
       
 10727 var effectBounce = $.effects.effect.bounce = function( o, done ) {
 10503 	var el = $( this ),
 10728 	var el = $( this ),
 10504 		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
 10729 		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
 10505 
 10730 
 10506 		// defaults:
 10731 		// defaults:
 10507 		mode = $.effects.setMode( el, o.mode || "effect" ),
 10732 		mode = $.effects.setMode( el, o.mode || "effect" ),
 10594 	}
 10819 	}
 10595 	el.dequeue();
 10820 	el.dequeue();
 10596 
 10821 
 10597 };
 10822 };
 10598 
 10823 
 10599 })(jQuery);
 10824 
 10600 
 10825 /*!
 10601 (function( $, undefined ) {
 10826  * jQuery UI Effects Clip 1.11.4
 10602 
 10827  * http://jqueryui.com
 10603 $.effects.effect.clip = function( o, done ) {
 10828  *
       
 10829  * Copyright jQuery Foundation and other contributors
       
 10830  * Released under the MIT license.
       
 10831  * http://jquery.org/license
       
 10832  *
       
 10833  * http://api.jqueryui.com/clip-effect/
       
 10834  */
       
 10835 
       
 10836 
       
 10837 var effectClip = $.effects.effect.clip = function( o, done ) {
 10604 	// Create element
 10838 	// Create element
 10605 	var el = $( this ),
 10839 	var el = $( this ),
 10606 		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
 10840 		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
 10607 		mode = $.effects.setMode( el, o.mode || "hide" ),
 10841 		mode = $.effects.setMode( el, o.mode || "hide" ),
 10608 		show = mode === "show",
 10842 		show = mode === "show",
 10649 		}
 10883 		}
 10650 	});
 10884 	});
 10651 
 10885 
 10652 };
 10886 };
 10653 
 10887 
 10654 })(jQuery);
 10888 
 10655 
 10889 /*!
 10656 (function( $, undefined ) {
 10890  * jQuery UI Effects Drop 1.11.4
 10657 
 10891  * http://jqueryui.com
 10658 $.effects.effect.drop = function( o, done ) {
 10892  *
       
 10893  * Copyright jQuery Foundation and other contributors
       
 10894  * Released under the MIT license.
       
 10895  * http://jquery.org/license
       
 10896  *
       
 10897  * http://api.jqueryui.com/drop-effect/
       
 10898  */
       
 10899 
       
 10900 
       
 10901 var effectDrop = $.effects.effect.drop = function( o, done ) {
 10659 
 10902 
 10660 	var el = $( this ),
 10903 	var el = $( this ),
 10661 		props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
 10904 		props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
 10662 		mode = $.effects.setMode( el, o.mode || "hide" ),
 10905 		mode = $.effects.setMode( el, o.mode || "hide" ),
 10663 		show = mode === "show",
 10906 		show = mode === "show",
 10672 	// Adjust
 10915 	// Adjust
 10673 	$.effects.save( el, props );
 10916 	$.effects.save( el, props );
 10674 	el.show();
 10917 	el.show();
 10675 	$.effects.createWrapper( el );
 10918 	$.effects.createWrapper( el );
 10676 
 10919 
 10677 	distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]( true ) / 2;
 10920 	distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
 10678 
 10921 
 10679 	if ( show ) {
 10922 	if ( show ) {
 10680 		el
 10923 		el
 10681 			.css( "opacity", 0 )
 10924 			.css( "opacity", 0 )
 10682 			.css( ref, motion === "pos" ? -distance : distance );
 10925 			.css( ref, motion === "pos" ? -distance : distance );
 10702 			done();
 10945 			done();
 10703 		}
 10946 		}
 10704 	});
 10947 	});
 10705 };
 10948 };
 10706 
 10949 
 10707 })(jQuery);
 10950 
 10708 
 10951 /*!
 10709 (function( $, undefined ) {
 10952  * jQuery UI Effects Explode 1.11.4
 10710 
 10953  * http://jqueryui.com
 10711 $.effects.effect.explode = function( o, done ) {
 10954  *
       
 10955  * Copyright jQuery Foundation and other contributors
       
 10956  * Released under the MIT license.
       
 10957  * http://jquery.org/license
       
 10958  *
       
 10959  * http://api.jqueryui.com/explode-effect/
       
 10960  */
       
 10961 
       
 10962 
       
 10963 var effectExplode = $.effects.effect.explode = function( o, done ) {
 10712 
 10964 
 10713 	var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
 10965 	var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
 10714 		cells = rows,
 10966 		cells = rows,
 10715 		el = $( this ),
 10967 		el = $( this ),
 10716 		mode = $.effects.setMode( el, o.mode || "hide" ),
 10968 		mode = $.effects.setMode( el, o.mode || "hide" ),
 10734 			animComplete();
 10986 			animComplete();
 10735 		}
 10987 		}
 10736 	}
 10988 	}
 10737 
 10989 
 10738 	// clone the element for each row and cell.
 10990 	// clone the element for each row and cell.
 10739 	for( i = 0; i < rows ; i++ ) { // ===>
 10991 	for ( i = 0; i < rows ; i++ ) { // ===>
 10740 		top = offset.top + i * height;
 10992 		top = offset.top + i * height;
 10741 		my = i - ( rows - 1 ) / 2 ;
 10993 		my = i - ( rows - 1 ) / 2 ;
 10742 
 10994 
 10743 		for( j = 0; j < cells ; j++ ) { // |||
 10995 		for ( j = 0; j < cells ; j++ ) { // |||
 10744 			left = offset.left + j * width;
 10996 			left = offset.left + j * width;
 10745 			mx = j - ( cells - 1 ) / 2 ;
 10997 			mx = j - ( cells - 1 ) / 2 ;
 10746 
 10998 
 10747 			// Create a clone of the now hidden main element that will be absolute positioned
 10999 			// Create a clone of the now hidden main element that will be absolute positioned
 10748 			// within a wrapper div off the -left and -top equal to size of our pieces
 11000 			// within a wrapper div off the -left and -top equal to size of our pieces
 10787 		}
 11039 		}
 10788 		done();
 11040 		done();
 10789 	}
 11041 	}
 10790 };
 11042 };
 10791 
 11043 
 10792 })(jQuery);
 11044 
 10793 
 11045 /*!
 10794 (function( $, undefined ) {
 11046  * jQuery UI Effects Fade 1.11.4
 10795 
 11047  * http://jqueryui.com
 10796 $.effects.effect.fade = function( o, done ) {
 11048  *
       
 11049  * Copyright jQuery Foundation and other contributors
       
 11050  * Released under the MIT license.
       
 11051  * http://jquery.org/license
       
 11052  *
       
 11053  * http://api.jqueryui.com/fade-effect/
       
 11054  */
       
 11055 
       
 11056 
       
 11057 var effectFade = $.effects.effect.fade = function( o, done ) {
 10797 	var el = $( this ),
 11058 	var el = $( this ),
 10798 		mode = $.effects.setMode( el, o.mode || "toggle" );
 11059 		mode = $.effects.setMode( el, o.mode || "toggle" );
 10799 
 11060 
 10800 	el.animate({
 11061 	el.animate({
 10801 		opacity: mode
 11062 		opacity: mode
 10805 		easing: o.easing,
 11066 		easing: o.easing,
 10806 		complete: done
 11067 		complete: done
 10807 	});
 11068 	});
 10808 };
 11069 };
 10809 
 11070 
 10810 })( jQuery );
 11071 
 10811 
 11072 /*!
 10812 (function( $, undefined ) {
 11073  * jQuery UI Effects Fold 1.11.4
 10813 
 11074  * http://jqueryui.com
 10814 $.effects.effect.fold = function( o, done ) {
 11075  *
       
 11076  * Copyright jQuery Foundation and other contributors
       
 11077  * Released under the MIT license.
       
 11078  * http://jquery.org/license
       
 11079  *
       
 11080  * http://api.jqueryui.com/fold-effect/
       
 11081  */
       
 11082 
       
 11083 
       
 11084 var effectFold = $.effects.effect.fold = function( o, done ) {
 10815 
 11085 
 10816 	// Create element
 11086 	// Create element
 10817 	var el = $( this ),
 11087 	var el = $( this ),
 10818 		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
 11088 		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
 10819 		mode = $.effects.setMode( el, o.mode || "hide" ),
 11089 		mode = $.effects.setMode( el, o.mode || "hide" ),
 10869 			done();
 11139 			done();
 10870 		});
 11140 		});
 10871 
 11141 
 10872 };
 11142 };
 10873 
 11143 
 10874 })(jQuery);
 11144 
 10875 
 11145 /*!
 10876 (function( $, undefined ) {
 11146  * jQuery UI Effects Highlight 1.11.4
 10877 
 11147  * http://jqueryui.com
 10878 $.effects.effect.highlight = function( o, done ) {
 11148  *
       
 11149  * Copyright jQuery Foundation and other contributors
       
 11150  * Released under the MIT license.
       
 11151  * http://jquery.org/license
       
 11152  *
       
 11153  * http://api.jqueryui.com/highlight-effect/
       
 11154  */
       
 11155 
       
 11156 
       
 11157 var effectHighlight = $.effects.effect.highlight = function( o, done ) {
 10879 	var elem = $( this ),
 11158 	var elem = $( this ),
 10880 		props = [ "backgroundImage", "backgroundColor", "opacity" ],
 11159 		props = [ "backgroundImage", "backgroundColor", "opacity" ],
 10881 		mode = $.effects.setMode( elem, o.mode || "show" ),
 11160 		mode = $.effects.setMode( elem, o.mode || "show" ),
 10882 		animation = {
 11161 		animation = {
 10883 			backgroundColor: elem.css( "backgroundColor" )
 11162 			backgroundColor: elem.css( "backgroundColor" )
 10907 				done();
 11186 				done();
 10908 			}
 11187 			}
 10909 		});
 11188 		});
 10910 };
 11189 };
 10911 
 11190 
 10912 })(jQuery);
 11191 
 10913 
 11192 /*!
 10914 (function( $, undefined ) {
 11193  * jQuery UI Effects Size 1.11.4
 10915 
 11194  * http://jqueryui.com
 10916 $.effects.effect.pulsate = function( o, done ) {
 11195  *
 10917 	var elem = $( this ),
 11196  * Copyright jQuery Foundation and other contributors
 10918 		mode = $.effects.setMode( elem, o.mode || "show" ),
 11197  * Released under the MIT license.
 10919 		show = mode === "show",
 11198  * http://jquery.org/license
 10920 		hide = mode === "hide",
 11199  *
 10921 		showhide = ( show || mode === "hide" ),
 11200  * http://api.jqueryui.com/size-effect/
 10922 
 11201  */
 10923 		// showing or hiding leaves of the "last" animation
 11202 
 10924 		anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
 11203 
 10925 		duration = o.duration / anims,
 11204 var effectSize = $.effects.effect.size = function( o, done ) {
 10926 		animateTo = 0,
 11205 
 10927 		queue = elem.queue(),
 11206 	// Create element
 10928 		queuelen = queue.length,
 11207 	var original, baseline, factor,
 10929 		i;
 11208 		el = $( this ),
 10930 
 11209 		props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
 10931 	if ( show || !elem.is(":visible")) {
 11210 
 10932 		elem.css( "opacity", 0 ).show();
 11211 		// Always restore
 10933 		animateTo = 1;
 11212 		props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
       
 11213 
       
 11214 		// Copy for children
       
 11215 		props2 = [ "width", "height", "overflow" ],
       
 11216 		cProps = [ "fontSize" ],
       
 11217 		vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
       
 11218 		hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
       
 11219 
       
 11220 		// Set options
       
 11221 		mode = $.effects.setMode( el, o.mode || "effect" ),
       
 11222 		restore = o.restore || mode !== "effect",
       
 11223 		scale = o.scale || "both",
       
 11224 		origin = o.origin || [ "middle", "center" ],
       
 11225 		position = el.css( "position" ),
       
 11226 		props = restore ? props0 : props1,
       
 11227 		zero = {
       
 11228 			height: 0,
       
 11229 			width: 0,
       
 11230 			outerHeight: 0,
       
 11231 			outerWidth: 0
       
 11232 		};
       
 11233 
       
 11234 	if ( mode === "show" ) {
       
 11235 		el.show();
 10934 	}
 11236 	}
 10935 
 11237 	original = {
 10936 	// anims - 1 opacity "toggles"
 11238 		height: el.height(),
 10937 	for ( i = 1; i < anims; i++ ) {
 11239 		width: el.width(),
 10938 		elem.animate({
 11240 		outerHeight: el.outerHeight(),
 10939 			opacity: animateTo
 11241 		outerWidth: el.outerWidth()
 10940 		}, duration, o.easing );
 11242 	};
 10941 		animateTo = 1 - animateTo;
 11243 
       
 11244 	if ( o.mode === "toggle" && mode === "show" ) {
       
 11245 		el.from = o.to || zero;
       
 11246 		el.to = o.from || original;
       
 11247 	} else {
       
 11248 		el.from = o.from || ( mode === "show" ? zero : original );
       
 11249 		el.to = o.to || ( mode === "hide" ? zero : original );
 10942 	}
 11250 	}
 10943 
 11251 
 10944 	elem.animate({
 11252 	// Set scaling factor
 10945 		opacity: animateTo
 11253 	factor = {
 10946 	}, duration, o.easing);
 11254 		from: {
 10947 
 11255 			y: el.from.height / original.height,
 10948 	elem.queue(function() {
 11256 			x: el.from.width / original.width
 10949 		if ( hide ) {
 11257 		},
 10950 			elem.hide();
 11258 		to: {
 10951 		}
 11259 			y: el.to.height / original.height,
 10952 		done();
 11260 			x: el.to.width / original.width
       
 11261 		}
       
 11262 	};
       
 11263 
       
 11264 	// Scale the css box
       
 11265 	if ( scale === "box" || scale === "both" ) {
       
 11266 
       
 11267 		// Vertical props scaling
       
 11268 		if ( factor.from.y !== factor.to.y ) {
       
 11269 			props = props.concat( vProps );
       
 11270 			el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
       
 11271 			el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
       
 11272 		}
       
 11273 
       
 11274 		// Horizontal props scaling
       
 11275 		if ( factor.from.x !== factor.to.x ) {
       
 11276 			props = props.concat( hProps );
       
 11277 			el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
       
 11278 			el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
       
 11279 		}
       
 11280 	}
       
 11281 
       
 11282 	// Scale the content
       
 11283 	if ( scale === "content" || scale === "both" ) {
       
 11284 
       
 11285 		// Vertical props scaling
       
 11286 		if ( factor.from.y !== factor.to.y ) {
       
 11287 			props = props.concat( cProps ).concat( props2 );
       
 11288 			el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
       
 11289 			el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
       
 11290 		}
       
 11291 	}
       
 11292 
       
 11293 	$.effects.save( el, props );
       
 11294 	el.show();
       
 11295 	$.effects.createWrapper( el );
       
 11296 	el.css( "overflow", "hidden" ).css( el.from );
       
 11297 
       
 11298 	// Adjust
       
 11299 	if (origin) { // Calculate baseline shifts
       
 11300 		baseline = $.effects.getBaseline( origin, original );
       
 11301 		el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
       
 11302 		el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
       
 11303 		el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
       
 11304 		el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
       
 11305 	}
       
 11306 	el.css( el.from ); // set top & left
       
 11307 
       
 11308 	// Animate
       
 11309 	if ( scale === "content" || scale === "both" ) { // Scale the children
       
 11310 
       
 11311 		// Add margins/font-size
       
 11312 		vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
       
 11313 		hProps = hProps.concat([ "marginLeft", "marginRight" ]);
       
 11314 		props2 = props0.concat(vProps).concat(hProps);
       
 11315 
       
 11316 		el.find( "*[width]" ).each( function() {
       
 11317 			var child = $( this ),
       
 11318 				c_original = {
       
 11319 					height: child.height(),
       
 11320 					width: child.width(),
       
 11321 					outerHeight: child.outerHeight(),
       
 11322 					outerWidth: child.outerWidth()
       
 11323 				};
       
 11324 			if (restore) {
       
 11325 				$.effects.save(child, props2);
       
 11326 			}
       
 11327 
       
 11328 			child.from = {
       
 11329 				height: c_original.height * factor.from.y,
       
 11330 				width: c_original.width * factor.from.x,
       
 11331 				outerHeight: c_original.outerHeight * factor.from.y,
       
 11332 				outerWidth: c_original.outerWidth * factor.from.x
       
 11333 			};
       
 11334 			child.to = {
       
 11335 				height: c_original.height * factor.to.y,
       
 11336 				width: c_original.width * factor.to.x,
       
 11337 				outerHeight: c_original.height * factor.to.y,
       
 11338 				outerWidth: c_original.width * factor.to.x
       
 11339 			};
       
 11340 
       
 11341 			// Vertical props scaling
       
 11342 			if ( factor.from.y !== factor.to.y ) {
       
 11343 				child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
       
 11344 				child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
       
 11345 			}
       
 11346 
       
 11347 			// Horizontal props scaling
       
 11348 			if ( factor.from.x !== factor.to.x ) {
       
 11349 				child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
       
 11350 				child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
       
 11351 			}
       
 11352 
       
 11353 			// Animate children
       
 11354 			child.css( child.from );
       
 11355 			child.animate( child.to, o.duration, o.easing, function() {
       
 11356 
       
 11357 				// Restore children
       
 11358 				if ( restore ) {
       
 11359 					$.effects.restore( child, props2 );
       
 11360 				}
       
 11361 			});
       
 11362 		});
       
 11363 	}
       
 11364 
       
 11365 	// Animate
       
 11366 	el.animate( el.to, {
       
 11367 		queue: false,
       
 11368 		duration: o.duration,
       
 11369 		easing: o.easing,
       
 11370 		complete: function() {
       
 11371 			if ( el.to.opacity === 0 ) {
       
 11372 				el.css( "opacity", el.from.opacity );
       
 11373 			}
       
 11374 			if ( mode === "hide" ) {
       
 11375 				el.hide();
       
 11376 			}
       
 11377 			$.effects.restore( el, props );
       
 11378 			if ( !restore ) {
       
 11379 
       
 11380 				// we need to calculate our new positioning based on the scaling
       
 11381 				if ( position === "static" ) {
       
 11382 					el.css({
       
 11383 						position: "relative",
       
 11384 						top: el.to.top,
       
 11385 						left: el.to.left
       
 11386 					});
       
 11387 				} else {
       
 11388 					$.each([ "top", "left" ], function( idx, pos ) {
       
 11389 						el.css( pos, function( _, str ) {
       
 11390 							var val = parseInt( str, 10 ),
       
 11391 								toRef = idx ? el.to.left : el.to.top;
       
 11392 
       
 11393 							// if original was "auto", recalculate the new value from wrapper
       
 11394 							if ( str === "auto" ) {
       
 11395 								return toRef + "px";
       
 11396 							}
       
 11397 
       
 11398 							return val + toRef + "px";
       
 11399 						});
       
 11400 					});
       
 11401 				}
       
 11402 			}
       
 11403 
       
 11404 			$.effects.removeWrapper( el );
       
 11405 			done();
       
 11406 		}
 10953 	});
 11407 	});
 10954 
 11408 
 10955 	// We just queued up "anims" animations, we need to put them next in the queue
       
 10956 	if ( queuelen > 1 ) {
       
 10957 		queue.splice.apply( queue,
       
 10958 			[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
       
 10959 	}
       
 10960 	elem.dequeue();
       
 10961 };
 11409 };
 10962 
 11410 
 10963 })(jQuery);
 11411 
 10964 
 11412 /*!
 10965 (function( $, undefined ) {
 11413  * jQuery UI Effects Scale 1.11.4
 10966 
 11414  * http://jqueryui.com
 10967 $.effects.effect.puff = function( o, done ) {
 11415  *
 10968 	var elem = $( this ),
 11416  * Copyright jQuery Foundation and other contributors
 10969 		mode = $.effects.setMode( elem, o.mode || "hide" ),
 11417  * Released under the MIT license.
 10970 		hide = mode === "hide",
 11418  * http://jquery.org/license
 10971 		percent = parseInt( o.percent, 10 ) || 150,
 11419  *
 10972 		factor = percent / 100,
 11420  * http://api.jqueryui.com/scale-effect/
 10973 		original = {
 11421  */
 10974 			height: elem.height(),
 11422 
 10975 			width: elem.width(),
 11423 
 10976 			outerHeight: elem.outerHeight(),
 11424 var effectScale = $.effects.effect.scale = function( o, done ) {
 10977 			outerWidth: elem.outerWidth()
       
 10978 		};
       
 10979 
       
 10980 	$.extend( o, {
       
 10981 		effect: "scale",
       
 10982 		queue: false,
       
 10983 		fade: true,
       
 10984 		mode: mode,
       
 10985 		complete: done,
       
 10986 		percent: hide ? percent : 100,
       
 10987 		from: hide ?
       
 10988 			original :
       
 10989 			{
       
 10990 				height: original.height * factor,
       
 10991 				width: original.width * factor,
       
 10992 				outerHeight: original.outerHeight * factor,
       
 10993 				outerWidth: original.outerWidth * factor
       
 10994 			}
       
 10995 	});
       
 10996 
       
 10997 	elem.effect( o );
       
 10998 };
       
 10999 
       
 11000 $.effects.effect.scale = function( o, done ) {
       
 11001 
 11425 
 11002 	// Create element
 11426 	// Create element
 11003 	var el = $( this ),
 11427 	var el = $( this ),
 11004 		options = $.extend( true, {}, o ),
 11428 		options = $.extend( true, {}, o ),
 11005 		mode = $.effects.setMode( el, o.mode || "effect" ),
 11429 		mode = $.effects.setMode( el, o.mode || "effect" ),
 11023 	options.queue = false;
 11447 	options.queue = false;
 11024 	options.complete = done;
 11448 	options.complete = done;
 11025 
 11449 
 11026 	// Set default origin and restore for show/hide
 11450 	// Set default origin and restore for show/hide
 11027 	if ( mode !== "effect" ) {
 11451 	if ( mode !== "effect" ) {
 11028 		options.origin = origin || ["middle","center"];
 11452 		options.origin = origin || [ "middle", "center" ];
 11029 		options.restore = true;
 11453 		options.restore = true;
 11030 	}
 11454 	}
 11031 
 11455 
 11032 	options.from = o.from || ( mode === "show" ? {
 11456 	options.from = o.from || ( mode === "show" ? {
 11033 		height: 0,
 11457 		height: 0,
 11057 	// Animate
 11481 	// Animate
 11058 	el.effect( options );
 11482 	el.effect( options );
 11059 
 11483 
 11060 };
 11484 };
 11061 
 11485 
 11062 $.effects.effect.size = function( o, done ) {
 11486 
 11063 
 11487 /*!
 11064 	// Create element
 11488  * jQuery UI Effects Puff 1.11.4
 11065 	var original, baseline, factor,
 11489  * http://jqueryui.com
 11066 		el = $( this ),
 11490  *
 11067 		props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
 11491  * Copyright jQuery Foundation and other contributors
 11068 
 11492  * Released under the MIT license.
 11069 		// Always restore
 11493  * http://jquery.org/license
 11070 		props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
 11494  *
 11071 
 11495  * http://api.jqueryui.com/puff-effect/
 11072 		// Copy for children
 11496  */
 11073 		props2 = [ "width", "height", "overflow" ],
 11497 
 11074 		cProps = [ "fontSize" ],
 11498 
 11075 		vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
 11499 var effectPuff = $.effects.effect.puff = function( o, done ) {
 11076 		hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
 11500 	var elem = $( this ),
 11077 
 11501 		mode = $.effects.setMode( elem, o.mode || "hide" ),
 11078 		// Set options
 11502 		hide = mode === "hide",
 11079 		mode = $.effects.setMode( el, o.mode || "effect" ),
 11503 		percent = parseInt( o.percent, 10 ) || 150,
 11080 		restore = o.restore || mode !== "effect",
 11504 		factor = percent / 100,
 11081 		scale = o.scale || "both",
 11505 		original = {
 11082 		origin = o.origin || [ "middle", "center" ],
 11506 			height: elem.height(),
 11083 		position = el.css( "position" ),
 11507 			width: elem.width(),
 11084 		props = restore ? props0 : props1,
 11508 			outerHeight: elem.outerHeight(),
 11085 		zero = {
 11509 			outerWidth: elem.outerWidth()
 11086 			height: 0,
       
 11087 			width: 0,
       
 11088 			outerHeight: 0,
       
 11089 			outerWidth: 0
       
 11090 		};
 11510 		};
 11091 
 11511 
 11092 	if ( mode === "show" ) {
 11512 	$.extend( o, {
 11093 		el.show();
 11513 		effect: "scale",
       
 11514 		queue: false,
       
 11515 		fade: true,
       
 11516 		mode: mode,
       
 11517 		complete: done,
       
 11518 		percent: hide ? percent : 100,
       
 11519 		from: hide ?
       
 11520 			original :
       
 11521 			{
       
 11522 				height: original.height * factor,
       
 11523 				width: original.width * factor,
       
 11524 				outerHeight: original.outerHeight * factor,
       
 11525 				outerWidth: original.outerWidth * factor
       
 11526 			}
       
 11527 	});
       
 11528 
       
 11529 	elem.effect( o );
       
 11530 };
       
 11531 
       
 11532 
       
 11533 /*!
       
 11534  * jQuery UI Effects Pulsate 1.11.4
       
 11535  * http://jqueryui.com
       
 11536  *
       
 11537  * Copyright jQuery Foundation and other contributors
       
 11538  * Released under the MIT license.
       
 11539  * http://jquery.org/license
       
 11540  *
       
 11541  * http://api.jqueryui.com/pulsate-effect/
       
 11542  */
       
 11543 
       
 11544 
       
 11545 var effectPulsate = $.effects.effect.pulsate = function( o, done ) {
       
 11546 	var elem = $( this ),
       
 11547 		mode = $.effects.setMode( elem, o.mode || "show" ),
       
 11548 		show = mode === "show",
       
 11549 		hide = mode === "hide",
       
 11550 		showhide = ( show || mode === "hide" ),
       
 11551 
       
 11552 		// showing or hiding leaves of the "last" animation
       
 11553 		anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
       
 11554 		duration = o.duration / anims,
       
 11555 		animateTo = 0,
       
 11556 		queue = elem.queue(),
       
 11557 		queuelen = queue.length,
       
 11558 		i;
       
 11559 
       
 11560 	if ( show || !elem.is(":visible")) {
       
 11561 		elem.css( "opacity", 0 ).show();
       
 11562 		animateTo = 1;
 11094 	}
 11563 	}
 11095 	original = {
 11564 
 11096 		height: el.height(),
 11565 	// anims - 1 opacity "toggles"
 11097 		width: el.width(),
 11566 	for ( i = 1; i < anims; i++ ) {
 11098 		outerHeight: el.outerHeight(),
 11567 		elem.animate({
 11099 		outerWidth: el.outerWidth()
 11568 			opacity: animateTo
 11100 	};
 11569 		}, duration, o.easing );
 11101 
 11570 		animateTo = 1 - animateTo;
 11102 	if ( o.mode === "toggle" && mode === "show" ) {
       
 11103 		el.from = o.to || zero;
       
 11104 		el.to = o.from || original;
       
 11105 	} else {
       
 11106 		el.from = o.from || ( mode === "show" ? zero : original );
       
 11107 		el.to = o.to || ( mode === "hide" ? zero : original );
       
 11108 	}
 11571 	}
 11109 
 11572 
 11110 	// Set scaling factor
 11573 	elem.animate({
 11111 	factor = {
 11574 		opacity: animateTo
 11112 		from: {
 11575 	}, duration, o.easing);
 11113 			y: el.from.height / original.height,
 11576 
 11114 			x: el.from.width / original.width
 11577 	elem.queue(function() {
 11115 		},
 11578 		if ( hide ) {
 11116 		to: {
 11579 			elem.hide();
 11117 			y: el.to.height / original.height,
 11580 		}
 11118 			x: el.to.width / original.width
 11581 		done();
 11119 		}
 11582 	});
 11120 	};
 11583 
 11121 
 11584 	// We just queued up "anims" animations, we need to put them next in the queue
 11122 	// Scale the css box
 11585 	if ( queuelen > 1 ) {
 11123 	if ( scale === "box" || scale === "both" ) {
 11586 		queue.splice.apply( queue,
 11124 
 11587 			[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
 11125 		// Vertical props scaling
       
 11126 		if ( factor.from.y !== factor.to.y ) {
       
 11127 			props = props.concat( vProps );
       
 11128 			el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
       
 11129 			el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
       
 11130 		}
       
 11131 
       
 11132 		// Horizontal props scaling
       
 11133 		if ( factor.from.x !== factor.to.x ) {
       
 11134 			props = props.concat( hProps );
       
 11135 			el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
       
 11136 			el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
       
 11137 		}
       
 11138 	}
 11588 	}
 11139 
 11589 	elem.dequeue();
 11140 	// Scale the content
       
 11141 	if ( scale === "content" || scale === "both" ) {
       
 11142 
       
 11143 		// Vertical props scaling
       
 11144 		if ( factor.from.y !== factor.to.y ) {
       
 11145 			props = props.concat( cProps ).concat( props2 );
       
 11146 			el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
       
 11147 			el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
       
 11148 		}
       
 11149 	}
       
 11150 
       
 11151 	$.effects.save( el, props );
       
 11152 	el.show();
       
 11153 	$.effects.createWrapper( el );
       
 11154 	el.css( "overflow", "hidden" ).css( el.from );
       
 11155 
       
 11156 	// Adjust
       
 11157 	if (origin) { // Calculate baseline shifts
       
 11158 		baseline = $.effects.getBaseline( origin, original );
       
 11159 		el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
       
 11160 		el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
       
 11161 		el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
       
 11162 		el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
       
 11163 	}
       
 11164 	el.css( el.from ); // set top & left
       
 11165 
       
 11166 	// Animate
       
 11167 	if ( scale === "content" || scale === "both" ) { // Scale the children
       
 11168 
       
 11169 		// Add margins/font-size
       
 11170 		vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
       
 11171 		hProps = hProps.concat([ "marginLeft", "marginRight" ]);
       
 11172 		props2 = props0.concat(vProps).concat(hProps);
       
 11173 
       
 11174 		el.find( "*[width]" ).each( function(){
       
 11175 			var child = $( this ),
       
 11176 				c_original = {
       
 11177 					height: child.height(),
       
 11178 					width: child.width(),
       
 11179 					outerHeight: child.outerHeight(),
       
 11180 					outerWidth: child.outerWidth()
       
 11181 				};
       
 11182 			if (restore) {
       
 11183 				$.effects.save(child, props2);
       
 11184 			}
       
 11185 
       
 11186 			child.from = {
       
 11187 				height: c_original.height * factor.from.y,
       
 11188 				width: c_original.width * factor.from.x,
       
 11189 				outerHeight: c_original.outerHeight * factor.from.y,
       
 11190 				outerWidth: c_original.outerWidth * factor.from.x
       
 11191 			};
       
 11192 			child.to = {
       
 11193 				height: c_original.height * factor.to.y,
       
 11194 				width: c_original.width * factor.to.x,
       
 11195 				outerHeight: c_original.height * factor.to.y,
       
 11196 				outerWidth: c_original.width * factor.to.x
       
 11197 			};
       
 11198 
       
 11199 			// Vertical props scaling
       
 11200 			if ( factor.from.y !== factor.to.y ) {
       
 11201 				child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
       
 11202 				child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
       
 11203 			}
       
 11204 
       
 11205 			// Horizontal props scaling
       
 11206 			if ( factor.from.x !== factor.to.x ) {
       
 11207 				child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
       
 11208 				child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
       
 11209 			}
       
 11210 
       
 11211 			// Animate children
       
 11212 			child.css( child.from );
       
 11213 			child.animate( child.to, o.duration, o.easing, function() {
       
 11214 
       
 11215 				// Restore children
       
 11216 				if ( restore ) {
       
 11217 					$.effects.restore( child, props2 );
       
 11218 				}
       
 11219 			});
       
 11220 		});
       
 11221 	}
       
 11222 
       
 11223 	// Animate
       
 11224 	el.animate( el.to, {
       
 11225 		queue: false,
       
 11226 		duration: o.duration,
       
 11227 		easing: o.easing,
       
 11228 		complete: function() {
       
 11229 			if ( el.to.opacity === 0 ) {
       
 11230 				el.css( "opacity", el.from.opacity );
       
 11231 			}
       
 11232 			if( mode === "hide" ) {
       
 11233 				el.hide();
       
 11234 			}
       
 11235 			$.effects.restore( el, props );
       
 11236 			if ( !restore ) {
       
 11237 
       
 11238 				// we need to calculate our new positioning based on the scaling
       
 11239 				if ( position === "static" ) {
       
 11240 					el.css({
       
 11241 						position: "relative",
       
 11242 						top: el.to.top,
       
 11243 						left: el.to.left
       
 11244 					});
       
 11245 				} else {
       
 11246 					$.each([ "top", "left" ], function( idx, pos ) {
       
 11247 						el.css( pos, function( _, str ) {
       
 11248 							var val = parseInt( str, 10 ),
       
 11249 								toRef = idx ? el.to.left : el.to.top;
       
 11250 
       
 11251 							// if original was "auto", recalculate the new value from wrapper
       
 11252 							if ( str === "auto" ) {
       
 11253 								return toRef + "px";
       
 11254 							}
       
 11255 
       
 11256 							return val + toRef + "px";
       
 11257 						});
       
 11258 					});
       
 11259 				}
       
 11260 			}
       
 11261 
       
 11262 			$.effects.removeWrapper( el );
       
 11263 			done();
       
 11264 		}
       
 11265 	});
       
 11266 
       
 11267 };
 11590 };
 11268 
 11591 
 11269 })(jQuery);
 11592 
 11270 
 11593 /*!
 11271 (function( $, undefined ) {
 11594  * jQuery UI Effects Shake 1.11.4
 11272 
 11595  * http://jqueryui.com
 11273 $.effects.effect.shake = function( o, done ) {
 11596  *
       
 11597  * Copyright jQuery Foundation and other contributors
       
 11598  * Released under the MIT license.
       
 11599  * http://jquery.org/license
       
 11600  *
       
 11601  * http://api.jqueryui.com/shake-effect/
       
 11602  */
       
 11603 
       
 11604 
       
 11605 var effectShake = $.effects.effect.shake = function( o, done ) {
 11274 
 11606 
 11275 	var el = $( this ),
 11607 	var el = $( this ),
 11276 		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
 11608 		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
 11277 		mode = $.effects.setMode( el, o.mode || "effect" ),
 11609 		mode = $.effects.setMode( el, o.mode || "effect" ),
 11278 		direction = o.direction || "left",
 11610 		direction = o.direction || "left",
 11279 		distance = o.distance || 20,
 11611 		distance = o.distance || 20,
 11280 		times = o.times || 3,
 11612 		times = o.times || 3,
 11281 		anims = times * 2 + 1,
 11613 		anims = times * 2 + 1,
 11282 		speed = Math.round(o.duration/anims),
 11614 		speed = Math.round( o.duration / anims ),
 11283 		ref = (direction === "up" || direction === "down") ? "top" : "left",
 11615 		ref = (direction === "up" || direction === "down") ? "top" : "left",
 11284 		positiveMotion = (direction === "up" || direction === "left"),
 11616 		positiveMotion = (direction === "up" || direction === "left"),
 11285 		animation = {},
 11617 		animation = {},
 11286 		animation1 = {},
 11618 		animation1 = {},
 11287 		animation2 = {},
 11619 		animation2 = {},
 11326 	}
 11658 	}
 11327 	el.dequeue();
 11659 	el.dequeue();
 11328 
 11660 
 11329 };
 11661 };
 11330 
 11662 
 11331 })(jQuery);
 11663 
 11332 
 11664 /*!
 11333 (function( $, undefined ) {
 11665  * jQuery UI Effects Slide 1.11.4
 11334 
 11666  * http://jqueryui.com
 11335 $.effects.effect.slide = function( o, done ) {
 11667  *
       
 11668  * Copyright jQuery Foundation and other contributors
       
 11669  * Released under the MIT license.
       
 11670  * http://jquery.org/license
       
 11671  *
       
 11672  * http://api.jqueryui.com/slide-effect/
       
 11673  */
       
 11674 
       
 11675 
       
 11676 var effectSlide = $.effects.effect.slide = function( o, done ) {
 11336 
 11677 
 11337 	// Create element
 11678 	// Create element
 11338 	var el = $( this ),
 11679 	var el = $( this ),
 11339 		props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
 11680 		props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
 11340 		mode = $.effects.setMode( el, o.mode || "show" ),
 11681 		mode = $.effects.setMode( el, o.mode || "show" ),
 11378 			done();
 11719 			done();
 11379 		}
 11720 		}
 11380 	});
 11721 	});
 11381 };
 11722 };
 11382 
 11723 
 11383 })(jQuery);
 11724 
 11384 
 11725 /*!
 11385 (function( $, undefined ) {
 11726  * jQuery UI Effects Transfer 1.11.4
 11386 
 11727  * http://jqueryui.com
 11387 $.effects.effect.transfer = function( o, done ) {
 11728  *
       
 11729  * Copyright jQuery Foundation and other contributors
       
 11730  * Released under the MIT license.
       
 11731  * http://jquery.org/license
       
 11732  *
       
 11733  * http://api.jqueryui.com/transfer-effect/
       
 11734  */
       
 11735 
       
 11736 
       
 11737 var effectTransfer = $.effects.effect.transfer = function( o, done ) {
 11388 	var elem = $( this ),
 11738 	var elem = $( this ),
 11389 		target = $( o.to ),
 11739 		target = $( o.to ),
 11390 		targetFixed = target.css( "position" ) === "fixed",
 11740 		targetFixed = target.css( "position" ) === "fixed",
 11391 		body = $("body"),
 11741 		body = $("body"),
 11392 		fixTop = targetFixed ? body.scrollTop() : 0,
 11742 		fixTop = targetFixed ? body.scrollTop() : 0,
 11393 		fixLeft = targetFixed ? body.scrollLeft() : 0,
 11743 		fixLeft = targetFixed ? body.scrollLeft() : 0,
 11394 		endPosition = target.offset(),
 11744 		endPosition = target.offset(),
 11395 		animation = {
 11745 		animation = {
 11396 			top: endPosition.top - fixTop ,
 11746 			top: endPosition.top - fixTop,
 11397 			left: endPosition.left - fixLeft ,
 11747 			left: endPosition.left - fixLeft,
 11398 			height: target.innerHeight(),
 11748 			height: target.innerHeight(),
 11399 			width: target.innerWidth()
 11749 			width: target.innerWidth()
 11400 		},
 11750 		},
 11401 		startPosition = elem.offset(),
 11751 		startPosition = elem.offset(),
 11402 		transfer = $( "<div class='ui-effects-transfer'></div>" )
 11752 		transfer = $( "<div class='ui-effects-transfer'></div>" )
 11403 			.appendTo( document.body )
 11753 			.appendTo( document.body )
 11404 			.addClass( o.className )
 11754 			.addClass( o.className )
 11405 			.css({
 11755 			.css({
 11406 				top: startPosition.top - fixTop ,
 11756 				top: startPosition.top - fixTop,
 11407 				left: startPosition.left - fixLeft ,
 11757 				left: startPosition.left - fixLeft,
 11408 				height: elem.innerHeight(),
 11758 				height: elem.innerHeight(),
 11409 				width: elem.innerWidth(),
 11759 				width: elem.innerWidth(),
 11410 				position: targetFixed ? "fixed" : "absolute"
 11760 				position: targetFixed ? "fixed" : "absolute"
 11411 			})
 11761 			})
 11412 			.animate( animation, o.duration, o.easing, function() {
 11762 			.animate( animation, o.duration, o.easing, function() {
 11413 				transfer.remove();
 11763 				transfer.remove();
 11414 				done();
 11764 				done();
 11415 			});
 11765 			});
 11416 };
 11766 };
 11417 
 11767 
 11418 })(jQuery);
 11768 
 11419 
 11769 /*!
 11420 (function( $, undefined ) {
 11770  * jQuery UI Progressbar 1.11.4
 11421 
 11771  * http://jqueryui.com
 11422 $.widget( "ui.menu", {
 11772  *
 11423 	version: "1.10.3",
 11773  * Copyright jQuery Foundation and other contributors
 11424 	defaultElement: "<ul>",
 11774  * Released under the MIT license.
 11425 	delay: 300,
 11775  * http://jquery.org/license
 11426 	options: {
 11776  *
 11427 		icons: {
 11777  * http://api.jqueryui.com/progressbar/
 11428 			submenu: "ui-icon-carat-1-e"
 11778  */
 11429 		},
 11779 
 11430 		menus: "ul",
 11780 
 11431 		position: {
 11781 var progressbar = $.widget( "ui.progressbar", {
 11432 			my: "left top",
 11782 	version: "1.11.4",
 11433 			at: "right top"
       
 11434 		},
       
 11435 		role: "menu",
       
 11436 
       
 11437 		// callbacks
       
 11438 		blur: null,
       
 11439 		focus: null,
       
 11440 		select: null
       
 11441 	},
       
 11442 
       
 11443 	_create: function() {
       
 11444 		this.activeMenu = this.element;
       
 11445 		// flag used to prevent firing of the click handler
       
 11446 		// as the event bubbles up through nested menus
       
 11447 		this.mouseHandled = false;
       
 11448 		this.element
       
 11449 			.uniqueId()
       
 11450 			.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
       
 11451 			.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
       
 11452 			.attr({
       
 11453 				role: this.options.role,
       
 11454 				tabIndex: 0
       
 11455 			})
       
 11456 			// need to catch all clicks on disabled menu
       
 11457 			// not possible through _on
       
 11458 			.bind( "click" + this.eventNamespace, $.proxy(function( event ) {
       
 11459 				if ( this.options.disabled ) {
       
 11460 					event.preventDefault();
       
 11461 				}
       
 11462 			}, this ));
       
 11463 
       
 11464 		if ( this.options.disabled ) {
       
 11465 			this.element
       
 11466 				.addClass( "ui-state-disabled" )
       
 11467 				.attr( "aria-disabled", "true" );
       
 11468 		}
       
 11469 
       
 11470 		this._on({
       
 11471 			// Prevent focus from sticking to links inside menu after clicking
       
 11472 			// them (focus should always stay on UL during navigation).
       
 11473 			"mousedown .ui-menu-item > a": function( event ) {
       
 11474 				event.preventDefault();
       
 11475 			},
       
 11476 			"click .ui-state-disabled > a": function( event ) {
       
 11477 				event.preventDefault();
       
 11478 			},
       
 11479 			"click .ui-menu-item:has(a)": function( event ) {
       
 11480 				var target = $( event.target ).closest( ".ui-menu-item" );
       
 11481 				if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
       
 11482 					this.mouseHandled = true;
       
 11483 
       
 11484 					this.select( event );
       
 11485 					// Open submenu on click
       
 11486 					if ( target.has( ".ui-menu" ).length ) {
       
 11487 						this.expand( event );
       
 11488 					} else if ( !this.element.is( ":focus" ) ) {
       
 11489 						// Redirect focus to the menu
       
 11490 						this.element.trigger( "focus", [ true ] );
       
 11491 
       
 11492 						// If the active item is on the top level, let it stay active.
       
 11493 						// Otherwise, blur the active item since it is no longer visible.
       
 11494 						if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
       
 11495 							clearTimeout( this.timer );
       
 11496 						}
       
 11497 					}
       
 11498 				}
       
 11499 			},
       
 11500 			"mouseenter .ui-menu-item": function( event ) {
       
 11501 				var target = $( event.currentTarget );
       
 11502 				// Remove ui-state-active class from siblings of the newly focused menu item
       
 11503 				// to avoid a jump caused by adjacent elements both having a class with a border
       
 11504 				target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
       
 11505 				this.focus( event, target );
       
 11506 			},
       
 11507 			mouseleave: "collapseAll",
       
 11508 			"mouseleave .ui-menu": "collapseAll",
       
 11509 			focus: function( event, keepActiveItem ) {
       
 11510 				// If there's already an active item, keep it active
       
 11511 				// If not, activate the first item
       
 11512 				var item = this.active || this.element.children( ".ui-menu-item" ).eq( 0 );
       
 11513 
       
 11514 				if ( !keepActiveItem ) {
       
 11515 					this.focus( event, item );
       
 11516 				}
       
 11517 			},
       
 11518 			blur: function( event ) {
       
 11519 				this._delay(function() {
       
 11520 					if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
       
 11521 						this.collapseAll( event );
       
 11522 					}
       
 11523 				});
       
 11524 			},
       
 11525 			keydown: "_keydown"
       
 11526 		});
       
 11527 
       
 11528 		this.refresh();
       
 11529 
       
 11530 		// Clicks outside of a menu collapse any open menus
       
 11531 		this._on( this.document, {
       
 11532 			click: function( event ) {
       
 11533 				if ( !$( event.target ).closest( ".ui-menu" ).length ) {
       
 11534 					this.collapseAll( event );
       
 11535 				}
       
 11536 
       
 11537 				// Reset the mouseHandled flag
       
 11538 				this.mouseHandled = false;
       
 11539 			}
       
 11540 		});
       
 11541 	},
       
 11542 
       
 11543 	_destroy: function() {
       
 11544 		// Destroy (sub)menus
       
 11545 		this.element
       
 11546 			.removeAttr( "aria-activedescendant" )
       
 11547 			.find( ".ui-menu" ).addBack()
       
 11548 				.removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )
       
 11549 				.removeAttr( "role" )
       
 11550 				.removeAttr( "tabIndex" )
       
 11551 				.removeAttr( "aria-labelledby" )
       
 11552 				.removeAttr( "aria-expanded" )
       
 11553 				.removeAttr( "aria-hidden" )
       
 11554 				.removeAttr( "aria-disabled" )
       
 11555 				.removeUniqueId()
       
 11556 				.show();
       
 11557 
       
 11558 		// Destroy menu items
       
 11559 		this.element.find( ".ui-menu-item" )
       
 11560 			.removeClass( "ui-menu-item" )
       
 11561 			.removeAttr( "role" )
       
 11562 			.removeAttr( "aria-disabled" )
       
 11563 			.children( "a" )
       
 11564 				.removeUniqueId()
       
 11565 				.removeClass( "ui-corner-all ui-state-hover" )
       
 11566 				.removeAttr( "tabIndex" )
       
 11567 				.removeAttr( "role" )
       
 11568 				.removeAttr( "aria-haspopup" )
       
 11569 				.children().each( function() {
       
 11570 					var elem = $( this );
       
 11571 					if ( elem.data( "ui-menu-submenu-carat" ) ) {
       
 11572 						elem.remove();
       
 11573 					}
       
 11574 				});
       
 11575 
       
 11576 		// Destroy menu dividers
       
 11577 		this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
       
 11578 	},
       
 11579 
       
 11580 	_keydown: function( event ) {
       
 11581 		/*jshint maxcomplexity:20*/
       
 11582 		var match, prev, character, skip, regex,
       
 11583 			preventDefault = true;
       
 11584 
       
 11585 		function escape( value ) {
       
 11586 			return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
       
 11587 		}
       
 11588 
       
 11589 		switch ( event.keyCode ) {
       
 11590 		case $.ui.keyCode.PAGE_UP:
       
 11591 			this.previousPage( event );
       
 11592 			break;
       
 11593 		case $.ui.keyCode.PAGE_DOWN:
       
 11594 			this.nextPage( event );
       
 11595 			break;
       
 11596 		case $.ui.keyCode.HOME:
       
 11597 			this._move( "first", "first", event );
       
 11598 			break;
       
 11599 		case $.ui.keyCode.END:
       
 11600 			this._move( "last", "last", event );
       
 11601 			break;
       
 11602 		case $.ui.keyCode.UP:
       
 11603 			this.previous( event );
       
 11604 			break;
       
 11605 		case $.ui.keyCode.DOWN:
       
 11606 			this.next( event );
       
 11607 			break;
       
 11608 		case $.ui.keyCode.LEFT:
       
 11609 			this.collapse( event );
       
 11610 			break;
       
 11611 		case $.ui.keyCode.RIGHT:
       
 11612 			if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
       
 11613 				this.expand( event );
       
 11614 			}
       
 11615 			break;
       
 11616 		case $.ui.keyCode.ENTER:
       
 11617 		case $.ui.keyCode.SPACE:
       
 11618 			this._activate( event );
       
 11619 			break;
       
 11620 		case $.ui.keyCode.ESCAPE:
       
 11621 			this.collapse( event );
       
 11622 			break;
       
 11623 		default:
       
 11624 			preventDefault = false;
       
 11625 			prev = this.previousFilter || "";
       
 11626 			character = String.fromCharCode( event.keyCode );
       
 11627 			skip = false;
       
 11628 
       
 11629 			clearTimeout( this.filterTimer );
       
 11630 
       
 11631 			if ( character === prev ) {
       
 11632 				skip = true;
       
 11633 			} else {
       
 11634 				character = prev + character;
       
 11635 			}
       
 11636 
       
 11637 			regex = new RegExp( "^" + escape( character ), "i" );
       
 11638 			match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
       
 11639 				return regex.test( $( this ).children( "a" ).text() );
       
 11640 			});
       
 11641 			match = skip && match.index( this.active.next() ) !== -1 ?
       
 11642 				this.active.nextAll( ".ui-menu-item" ) :
       
 11643 				match;
       
 11644 
       
 11645 			// If no matches on the current filter, reset to the last character pressed
       
 11646 			// to move down the menu to the first item that starts with that character
       
 11647 			if ( !match.length ) {
       
 11648 				character = String.fromCharCode( event.keyCode );
       
 11649 				regex = new RegExp( "^" + escape( character ), "i" );
       
 11650 				match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
       
 11651 					return regex.test( $( this ).children( "a" ).text() );
       
 11652 				});
       
 11653 			}
       
 11654 
       
 11655 			if ( match.length ) {
       
 11656 				this.focus( event, match );
       
 11657 				if ( match.length > 1 ) {
       
 11658 					this.previousFilter = character;
       
 11659 					this.filterTimer = this._delay(function() {
       
 11660 						delete this.previousFilter;
       
 11661 					}, 1000 );
       
 11662 				} else {
       
 11663 					delete this.previousFilter;
       
 11664 				}
       
 11665 			} else {
       
 11666 				delete this.previousFilter;
       
 11667 			}
       
 11668 		}
       
 11669 
       
 11670 		if ( preventDefault ) {
       
 11671 			event.preventDefault();
       
 11672 		}
       
 11673 	},
       
 11674 
       
 11675 	_activate: function( event ) {
       
 11676 		if ( !this.active.is( ".ui-state-disabled" ) ) {
       
 11677 			if ( this.active.children( "a[aria-haspopup='true']" ).length ) {
       
 11678 				this.expand( event );
       
 11679 			} else {
       
 11680 				this.select( event );
       
 11681 			}
       
 11682 		}
       
 11683 	},
       
 11684 
       
 11685 	refresh: function() {
       
 11686 		var menus,
       
 11687 			icon = this.options.icons.submenu,
       
 11688 			submenus = this.element.find( this.options.menus );
       
 11689 
       
 11690 		// Initialize nested menus
       
 11691 		submenus.filter( ":not(.ui-menu)" )
       
 11692 			.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
       
 11693 			.hide()
       
 11694 			.attr({
       
 11695 				role: this.options.role,
       
 11696 				"aria-hidden": "true",
       
 11697 				"aria-expanded": "false"
       
 11698 			})
       
 11699 			.each(function() {
       
 11700 				var menu = $( this ),
       
 11701 					item = menu.prev( "a" ),
       
 11702 					submenuCarat = $( "<span>" )
       
 11703 						.addClass( "ui-menu-icon ui-icon " + icon )
       
 11704 						.data( "ui-menu-submenu-carat", true );
       
 11705 
       
 11706 				item
       
 11707 					.attr( "aria-haspopup", "true" )
       
 11708 					.prepend( submenuCarat );
       
 11709 				menu.attr( "aria-labelledby", item.attr( "id" ) );
       
 11710 			});
       
 11711 
       
 11712 		menus = submenus.add( this.element );
       
 11713 
       
 11714 		// Don't refresh list items that are already adapted
       
 11715 		menus.children( ":not(.ui-menu-item):has(a)" )
       
 11716 			.addClass( "ui-menu-item" )
       
 11717 			.attr( "role", "presentation" )
       
 11718 			.children( "a" )
       
 11719 				.uniqueId()
       
 11720 				.addClass( "ui-corner-all" )
       
 11721 				.attr({
       
 11722 					tabIndex: -1,
       
 11723 					role: this._itemRole()
       
 11724 				});
       
 11725 
       
 11726 		// Initialize unlinked menu-items containing spaces and/or dashes only as dividers
       
 11727 		menus.children( ":not(.ui-menu-item)" ).each(function() {
       
 11728 			var item = $( this );
       
 11729 			// hyphen, em dash, en dash
       
 11730 			if ( !/[^\-\u2014\u2013\s]/.test( item.text() ) ) {
       
 11731 				item.addClass( "ui-widget-content ui-menu-divider" );
       
 11732 			}
       
 11733 		});
       
 11734 
       
 11735 		// Add aria-disabled attribute to any disabled menu item
       
 11736 		menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
       
 11737 
       
 11738 		// If the active item has been removed, blur the menu
       
 11739 		if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
       
 11740 			this.blur();
       
 11741 		}
       
 11742 	},
       
 11743 
       
 11744 	_itemRole: function() {
       
 11745 		return {
       
 11746 			menu: "menuitem",
       
 11747 			listbox: "option"
       
 11748 		}[ this.options.role ];
       
 11749 	},
       
 11750 
       
 11751 	_setOption: function( key, value ) {
       
 11752 		if ( key === "icons" ) {
       
 11753 			this.element.find( ".ui-menu-icon" )
       
 11754 				.removeClass( this.options.icons.submenu )
       
 11755 				.addClass( value.submenu );
       
 11756 		}
       
 11757 		this._super( key, value );
       
 11758 	},
       
 11759 
       
 11760 	focus: function( event, item ) {
       
 11761 		var nested, focused;
       
 11762 		this.blur( event, event && event.type === "focus" );
       
 11763 
       
 11764 		this._scrollIntoView( item );
       
 11765 
       
 11766 		this.active = item.first();
       
 11767 		focused = this.active.children( "a" ).addClass( "ui-state-focus" );
       
 11768 		// Only update aria-activedescendant if there's a role
       
 11769 		// otherwise we assume focus is managed elsewhere
       
 11770 		if ( this.options.role ) {
       
 11771 			this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
       
 11772 		}
       
 11773 
       
 11774 		// Highlight active parent menu item, if any
       
 11775 		this.active
       
 11776 			.parent()
       
 11777 			.closest( ".ui-menu-item" )
       
 11778 			.children( "a:first" )
       
 11779 			.addClass( "ui-state-active" );
       
 11780 
       
 11781 		if ( event && event.type === "keydown" ) {
       
 11782 			this._close();
       
 11783 		} else {
       
 11784 			this.timer = this._delay(function() {
       
 11785 				this._close();
       
 11786 			}, this.delay );
       
 11787 		}
       
 11788 
       
 11789 		nested = item.children( ".ui-menu" );
       
 11790 		if ( nested.length && ( /^mouse/.test( event.type ) ) ) {
       
 11791 			this._startOpening(nested);
       
 11792 		}
       
 11793 		this.activeMenu = item.parent();
       
 11794 
       
 11795 		this._trigger( "focus", event, { item: item } );
       
 11796 	},
       
 11797 
       
 11798 	_scrollIntoView: function( item ) {
       
 11799 		var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
       
 11800 		if ( this._hasScroll() ) {
       
 11801 			borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
       
 11802 			paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
       
 11803 			offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
       
 11804 			scroll = this.activeMenu.scrollTop();
       
 11805 			elementHeight = this.activeMenu.height();
       
 11806 			itemHeight = item.height();
       
 11807 
       
 11808 			if ( offset < 0 ) {
       
 11809 				this.activeMenu.scrollTop( scroll + offset );
       
 11810 			} else if ( offset + itemHeight > elementHeight ) {
       
 11811 				this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
       
 11812 			}
       
 11813 		}
       
 11814 	},
       
 11815 
       
 11816 	blur: function( event, fromFocus ) {
       
 11817 		if ( !fromFocus ) {
       
 11818 			clearTimeout( this.timer );
       
 11819 		}
       
 11820 
       
 11821 		if ( !this.active ) {
       
 11822 			return;
       
 11823 		}
       
 11824 
       
 11825 		this.active.children( "a" ).removeClass( "ui-state-focus" );
       
 11826 		this.active = null;
       
 11827 
       
 11828 		this._trigger( "blur", event, { item: this.active } );
       
 11829 	},
       
 11830 
       
 11831 	_startOpening: function( submenu ) {
       
 11832 		clearTimeout( this.timer );
       
 11833 
       
 11834 		// Don't open if already open fixes a Firefox bug that caused a .5 pixel
       
 11835 		// shift in the submenu position when mousing over the carat icon
       
 11836 		if ( submenu.attr( "aria-hidden" ) !== "true" ) {
       
 11837 			return;
       
 11838 		}
       
 11839 
       
 11840 		this.timer = this._delay(function() {
       
 11841 			this._close();
       
 11842 			this._open( submenu );
       
 11843 		}, this.delay );
       
 11844 	},
       
 11845 
       
 11846 	_open: function( submenu ) {
       
 11847 		var position = $.extend({
       
 11848 			of: this.active
       
 11849 		}, this.options.position );
       
 11850 
       
 11851 		clearTimeout( this.timer );
       
 11852 		this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
       
 11853 			.hide()
       
 11854 			.attr( "aria-hidden", "true" );
       
 11855 
       
 11856 		submenu
       
 11857 			.show()
       
 11858 			.removeAttr( "aria-hidden" )
       
 11859 			.attr( "aria-expanded", "true" )
       
 11860 			.position( position );
       
 11861 	},
       
 11862 
       
 11863 	collapseAll: function( event, all ) {
       
 11864 		clearTimeout( this.timer );
       
 11865 		this.timer = this._delay(function() {
       
 11866 			// If we were passed an event, look for the submenu that contains the event
       
 11867 			var currentMenu = all ? this.element :
       
 11868 				$( event && event.target ).closest( this.element.find( ".ui-menu" ) );
       
 11869 
       
 11870 			// If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
       
 11871 			if ( !currentMenu.length ) {
       
 11872 				currentMenu = this.element;
       
 11873 			}
       
 11874 
       
 11875 			this._close( currentMenu );
       
 11876 
       
 11877 			this.blur( event );
       
 11878 			this.activeMenu = currentMenu;
       
 11879 		}, this.delay );
       
 11880 	},
       
 11881 
       
 11882 	// With no arguments, closes the currently active menu - if nothing is active
       
 11883 	// it closes all menus.  If passed an argument, it will search for menus BELOW
       
 11884 	_close: function( startMenu ) {
       
 11885 		if ( !startMenu ) {
       
 11886 			startMenu = this.active ? this.active.parent() : this.element;
       
 11887 		}
       
 11888 
       
 11889 		startMenu
       
 11890 			.find( ".ui-menu" )
       
 11891 				.hide()
       
 11892 				.attr( "aria-hidden", "true" )
       
 11893 				.attr( "aria-expanded", "false" )
       
 11894 			.end()
       
 11895 			.find( "a.ui-state-active" )
       
 11896 				.removeClass( "ui-state-active" );
       
 11897 	},
       
 11898 
       
 11899 	collapse: function( event ) {
       
 11900 		var newItem = this.active &&
       
 11901 			this.active.parent().closest( ".ui-menu-item", this.element );
       
 11902 		if ( newItem && newItem.length ) {
       
 11903 			this._close();
       
 11904 			this.focus( event, newItem );
       
 11905 		}
       
 11906 	},
       
 11907 
       
 11908 	expand: function( event ) {
       
 11909 		var newItem = this.active &&
       
 11910 			this.active
       
 11911 				.children( ".ui-menu " )
       
 11912 				.children( ".ui-menu-item" )
       
 11913 				.first();
       
 11914 
       
 11915 		if ( newItem && newItem.length ) {
       
 11916 			this._open( newItem.parent() );
       
 11917 
       
 11918 			// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
       
 11919 			this._delay(function() {
       
 11920 				this.focus( event, newItem );
       
 11921 			});
       
 11922 		}
       
 11923 	},
       
 11924 
       
 11925 	next: function( event ) {
       
 11926 		this._move( "next", "first", event );
       
 11927 	},
       
 11928 
       
 11929 	previous: function( event ) {
       
 11930 		this._move( "prev", "last", event );
       
 11931 	},
       
 11932 
       
 11933 	isFirstItem: function() {
       
 11934 		return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
       
 11935 	},
       
 11936 
       
 11937 	isLastItem: function() {
       
 11938 		return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
       
 11939 	},
       
 11940 
       
 11941 	_move: function( direction, filter, event ) {
       
 11942 		var next;
       
 11943 		if ( this.active ) {
       
 11944 			if ( direction === "first" || direction === "last" ) {
       
 11945 				next = this.active
       
 11946 					[ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
       
 11947 					.eq( -1 );
       
 11948 			} else {
       
 11949 				next = this.active
       
 11950 					[ direction + "All" ]( ".ui-menu-item" )
       
 11951 					.eq( 0 );
       
 11952 			}
       
 11953 		}
       
 11954 		if ( !next || !next.length || !this.active ) {
       
 11955 			next = this.activeMenu.children( ".ui-menu-item" )[ filter ]();
       
 11956 		}
       
 11957 
       
 11958 		this.focus( event, next );
       
 11959 	},
       
 11960 
       
 11961 	nextPage: function( event ) {
       
 11962 		var item, base, height;
       
 11963 
       
 11964 		if ( !this.active ) {
       
 11965 			this.next( event );
       
 11966 			return;
       
 11967 		}
       
 11968 		if ( this.isLastItem() ) {
       
 11969 			return;
       
 11970 		}
       
 11971 		if ( this._hasScroll() ) {
       
 11972 			base = this.active.offset().top;
       
 11973 			height = this.element.height();
       
 11974 			this.active.nextAll( ".ui-menu-item" ).each(function() {
       
 11975 				item = $( this );
       
 11976 				return item.offset().top - base - height < 0;
       
 11977 			});
       
 11978 
       
 11979 			this.focus( event, item );
       
 11980 		} else {
       
 11981 			this.focus( event, this.activeMenu.children( ".ui-menu-item" )
       
 11982 				[ !this.active ? "first" : "last" ]() );
       
 11983 		}
       
 11984 	},
       
 11985 
       
 11986 	previousPage: function( event ) {
       
 11987 		var item, base, height;
       
 11988 		if ( !this.active ) {
       
 11989 			this.next( event );
       
 11990 			return;
       
 11991 		}
       
 11992 		if ( this.isFirstItem() ) {
       
 11993 			return;
       
 11994 		}
       
 11995 		if ( this._hasScroll() ) {
       
 11996 			base = this.active.offset().top;
       
 11997 			height = this.element.height();
       
 11998 			this.active.prevAll( ".ui-menu-item" ).each(function() {
       
 11999 				item = $( this );
       
 12000 				return item.offset().top - base + height > 0;
       
 12001 			});
       
 12002 
       
 12003 			this.focus( event, item );
       
 12004 		} else {
       
 12005 			this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
       
 12006 		}
       
 12007 	},
       
 12008 
       
 12009 	_hasScroll: function() {
       
 12010 		return this.element.outerHeight() < this.element.prop( "scrollHeight" );
       
 12011 	},
       
 12012 
       
 12013 	select: function( event ) {
       
 12014 		// TODO: It should never be possible to not have an active item at this
       
 12015 		// point, but the tests don't trigger mouseenter before click.
       
 12016 		this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
       
 12017 		var ui = { item: this.active };
       
 12018 		if ( !this.active.has( ".ui-menu" ).length ) {
       
 12019 			this.collapseAll( event, true );
       
 12020 		}
       
 12021 		this._trigger( "select", event, ui );
       
 12022 	}
       
 12023 });
       
 12024 
       
 12025 }( jQuery ));
       
 12026 
       
 12027 (function( $, undefined ) {
       
 12028 
       
 12029 $.ui = $.ui || {};
       
 12030 
       
 12031 var cachedScrollbarWidth,
       
 12032 	max = Math.max,
       
 12033 	abs = Math.abs,
       
 12034 	round = Math.round,
       
 12035 	rhorizontal = /left|center|right/,
       
 12036 	rvertical = /top|center|bottom/,
       
 12037 	roffset = /[\+\-]\d+(\.[\d]+)?%?/,
       
 12038 	rposition = /^\w+/,
       
 12039 	rpercent = /%$/,
       
 12040 	_position = $.fn.position;
       
 12041 
       
 12042 function getOffsets( offsets, width, height ) {
       
 12043 	return [
       
 12044 		parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
       
 12045 		parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
       
 12046 	];
       
 12047 }
       
 12048 
       
 12049 function parseCss( element, property ) {
       
 12050 	return parseInt( $.css( element, property ), 10 ) || 0;
       
 12051 }
       
 12052 
       
 12053 function getDimensions( elem ) {
       
 12054 	var raw = elem[0];
       
 12055 	if ( raw.nodeType === 9 ) {
       
 12056 		return {
       
 12057 			width: elem.width(),
       
 12058 			height: elem.height(),
       
 12059 			offset: { top: 0, left: 0 }
       
 12060 		};
       
 12061 	}
       
 12062 	if ( $.isWindow( raw ) ) {
       
 12063 		return {
       
 12064 			width: elem.width(),
       
 12065 			height: elem.height(),
       
 12066 			offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
       
 12067 		};
       
 12068 	}
       
 12069 	if ( raw.preventDefault ) {
       
 12070 		return {
       
 12071 			width: 0,
       
 12072 			height: 0,
       
 12073 			offset: { top: raw.pageY, left: raw.pageX }
       
 12074 		};
       
 12075 	}
       
 12076 	return {
       
 12077 		width: elem.outerWidth(),
       
 12078 		height: elem.outerHeight(),
       
 12079 		offset: elem.offset()
       
 12080 	};
       
 12081 }
       
 12082 
       
 12083 $.position = {
       
 12084 	scrollbarWidth: function() {
       
 12085 		if ( cachedScrollbarWidth !== undefined ) {
       
 12086 			return cachedScrollbarWidth;
       
 12087 		}
       
 12088 		var w1, w2,
       
 12089 			div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
       
 12090 			innerDiv = div.children()[0];
       
 12091 
       
 12092 		$( "body" ).append( div );
       
 12093 		w1 = innerDiv.offsetWidth;
       
 12094 		div.css( "overflow", "scroll" );
       
 12095 
       
 12096 		w2 = innerDiv.offsetWidth;
       
 12097 
       
 12098 		if ( w1 === w2 ) {
       
 12099 			w2 = div[0].clientWidth;
       
 12100 		}
       
 12101 
       
 12102 		div.remove();
       
 12103 
       
 12104 		return (cachedScrollbarWidth = w1 - w2);
       
 12105 	},
       
 12106 	getScrollInfo: function( within ) {
       
 12107 		var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ),
       
 12108 			overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ),
       
 12109 			hasOverflowX = overflowX === "scroll" ||
       
 12110 				( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
       
 12111 			hasOverflowY = overflowY === "scroll" ||
       
 12112 				( overflowY === "auto" && within.height < within.element[0].scrollHeight );
       
 12113 		return {
       
 12114 			width: hasOverflowY ? $.position.scrollbarWidth() : 0,
       
 12115 			height: hasOverflowX ? $.position.scrollbarWidth() : 0
       
 12116 		};
       
 12117 	},
       
 12118 	getWithinInfo: function( element ) {
       
 12119 		var withinElement = $( element || window ),
       
 12120 			isWindow = $.isWindow( withinElement[0] );
       
 12121 		return {
       
 12122 			element: withinElement,
       
 12123 			isWindow: isWindow,
       
 12124 			offset: withinElement.offset() || { left: 0, top: 0 },
       
 12125 			scrollLeft: withinElement.scrollLeft(),
       
 12126 			scrollTop: withinElement.scrollTop(),
       
 12127 			width: isWindow ? withinElement.width() : withinElement.outerWidth(),
       
 12128 			height: isWindow ? withinElement.height() : withinElement.outerHeight()
       
 12129 		};
       
 12130 	}
       
 12131 };
       
 12132 
       
 12133 $.fn.position = function( options ) {
       
 12134 	if ( !options || !options.of ) {
       
 12135 		return _position.apply( this, arguments );
       
 12136 	}
       
 12137 
       
 12138 	// make a copy, we don't want to modify arguments
       
 12139 	options = $.extend( {}, options );
       
 12140 
       
 12141 	var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
       
 12142 		target = $( options.of ),
       
 12143 		within = $.position.getWithinInfo( options.within ),
       
 12144 		scrollInfo = $.position.getScrollInfo( within ),
       
 12145 		collision = ( options.collision || "flip" ).split( " " ),
       
 12146 		offsets = {};
       
 12147 
       
 12148 	dimensions = getDimensions( target );
       
 12149 	if ( target[0].preventDefault ) {
       
 12150 		// force left top to allow flipping
       
 12151 		options.at = "left top";
       
 12152 	}
       
 12153 	targetWidth = dimensions.width;
       
 12154 	targetHeight = dimensions.height;
       
 12155 	targetOffset = dimensions.offset;
       
 12156 	// clone to reuse original targetOffset later
       
 12157 	basePosition = $.extend( {}, targetOffset );
       
 12158 
       
 12159 	// force my and at to have valid horizontal and vertical positions
       
 12160 	// if a value is missing or invalid, it will be converted to center
       
 12161 	$.each( [ "my", "at" ], function() {
       
 12162 		var pos = ( options[ this ] || "" ).split( " " ),
       
 12163 			horizontalOffset,
       
 12164 			verticalOffset;
       
 12165 
       
 12166 		if ( pos.length === 1) {
       
 12167 			pos = rhorizontal.test( pos[ 0 ] ) ?
       
 12168 				pos.concat( [ "center" ] ) :
       
 12169 				rvertical.test( pos[ 0 ] ) ?
       
 12170 					[ "center" ].concat( pos ) :
       
 12171 					[ "center", "center" ];
       
 12172 		}
       
 12173 		pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
       
 12174 		pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
       
 12175 
       
 12176 		// calculate offsets
       
 12177 		horizontalOffset = roffset.exec( pos[ 0 ] );
       
 12178 		verticalOffset = roffset.exec( pos[ 1 ] );
       
 12179 		offsets[ this ] = [
       
 12180 			horizontalOffset ? horizontalOffset[ 0 ] : 0,
       
 12181 			verticalOffset ? verticalOffset[ 0 ] : 0
       
 12182 		];
       
 12183 
       
 12184 		// reduce to just the positions without the offsets
       
 12185 		options[ this ] = [
       
 12186 			rposition.exec( pos[ 0 ] )[ 0 ],
       
 12187 			rposition.exec( pos[ 1 ] )[ 0 ]
       
 12188 		];
       
 12189 	});
       
 12190 
       
 12191 	// normalize collision option
       
 12192 	if ( collision.length === 1 ) {
       
 12193 		collision[ 1 ] = collision[ 0 ];
       
 12194 	}
       
 12195 
       
 12196 	if ( options.at[ 0 ] === "right" ) {
       
 12197 		basePosition.left += targetWidth;
       
 12198 	} else if ( options.at[ 0 ] === "center" ) {
       
 12199 		basePosition.left += targetWidth / 2;
       
 12200 	}
       
 12201 
       
 12202 	if ( options.at[ 1 ] === "bottom" ) {
       
 12203 		basePosition.top += targetHeight;
       
 12204 	} else if ( options.at[ 1 ] === "center" ) {
       
 12205 		basePosition.top += targetHeight / 2;
       
 12206 	}
       
 12207 
       
 12208 	atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
       
 12209 	basePosition.left += atOffset[ 0 ];
       
 12210 	basePosition.top += atOffset[ 1 ];
       
 12211 
       
 12212 	return this.each(function() {
       
 12213 		var collisionPosition, using,
       
 12214 			elem = $( this ),
       
 12215 			elemWidth = elem.outerWidth(),
       
 12216 			elemHeight = elem.outerHeight(),
       
 12217 			marginLeft = parseCss( this, "marginLeft" ),
       
 12218 			marginTop = parseCss( this, "marginTop" ),
       
 12219 			collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
       
 12220 			collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
       
 12221 			position = $.extend( {}, basePosition ),
       
 12222 			myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
       
 12223 
       
 12224 		if ( options.my[ 0 ] === "right" ) {
       
 12225 			position.left -= elemWidth;
       
 12226 		} else if ( options.my[ 0 ] === "center" ) {
       
 12227 			position.left -= elemWidth / 2;
       
 12228 		}
       
 12229 
       
 12230 		if ( options.my[ 1 ] === "bottom" ) {
       
 12231 			position.top -= elemHeight;
       
 12232 		} else if ( options.my[ 1 ] === "center" ) {
       
 12233 			position.top -= elemHeight / 2;
       
 12234 		}
       
 12235 
       
 12236 		position.left += myOffset[ 0 ];
       
 12237 		position.top += myOffset[ 1 ];
       
 12238 
       
 12239 		// if the browser doesn't support fractions, then round for consistent results
       
 12240 		if ( !$.support.offsetFractions ) {
       
 12241 			position.left = round( position.left );
       
 12242 			position.top = round( position.top );
       
 12243 		}
       
 12244 
       
 12245 		collisionPosition = {
       
 12246 			marginLeft: marginLeft,
       
 12247 			marginTop: marginTop
       
 12248 		};
       
 12249 
       
 12250 		$.each( [ "left", "top" ], function( i, dir ) {
       
 12251 			if ( $.ui.position[ collision[ i ] ] ) {
       
 12252 				$.ui.position[ collision[ i ] ][ dir ]( position, {
       
 12253 					targetWidth: targetWidth,
       
 12254 					targetHeight: targetHeight,
       
 12255 					elemWidth: elemWidth,
       
 12256 					elemHeight: elemHeight,
       
 12257 					collisionPosition: collisionPosition,
       
 12258 					collisionWidth: collisionWidth,
       
 12259 					collisionHeight: collisionHeight,
       
 12260 					offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
       
 12261 					my: options.my,
       
 12262 					at: options.at,
       
 12263 					within: within,
       
 12264 					elem : elem
       
 12265 				});
       
 12266 			}
       
 12267 		});
       
 12268 
       
 12269 		if ( options.using ) {
       
 12270 			// adds feedback as second argument to using callback, if present
       
 12271 			using = function( props ) {
       
 12272 				var left = targetOffset.left - position.left,
       
 12273 					right = left + targetWidth - elemWidth,
       
 12274 					top = targetOffset.top - position.top,
       
 12275 					bottom = top + targetHeight - elemHeight,
       
 12276 					feedback = {
       
 12277 						target: {
       
 12278 							element: target,
       
 12279 							left: targetOffset.left,
       
 12280 							top: targetOffset.top,
       
 12281 							width: targetWidth,
       
 12282 							height: targetHeight
       
 12283 						},
       
 12284 						element: {
       
 12285 							element: elem,
       
 12286 							left: position.left,
       
 12287 							top: position.top,
       
 12288 							width: elemWidth,
       
 12289 							height: elemHeight
       
 12290 						},
       
 12291 						horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
       
 12292 						vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
       
 12293 					};
       
 12294 				if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
       
 12295 					feedback.horizontal = "center";
       
 12296 				}
       
 12297 				if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
       
 12298 					feedback.vertical = "middle";
       
 12299 				}
       
 12300 				if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
       
 12301 					feedback.important = "horizontal";
       
 12302 				} else {
       
 12303 					feedback.important = "vertical";
       
 12304 				}
       
 12305 				options.using.call( this, props, feedback );
       
 12306 			};
       
 12307 		}
       
 12308 
       
 12309 		elem.offset( $.extend( position, { using: using } ) );
       
 12310 	});
       
 12311 };
       
 12312 
       
 12313 $.ui.position = {
       
 12314 	fit: {
       
 12315 		left: function( position, data ) {
       
 12316 			var within = data.within,
       
 12317 				withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
       
 12318 				outerWidth = within.width,
       
 12319 				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
       
 12320 				overLeft = withinOffset - collisionPosLeft,
       
 12321 				overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
       
 12322 				newOverRight;
       
 12323 
       
 12324 			// element is wider than within
       
 12325 			if ( data.collisionWidth > outerWidth ) {
       
 12326 				// element is initially over the left side of within
       
 12327 				if ( overLeft > 0 && overRight <= 0 ) {
       
 12328 					newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
       
 12329 					position.left += overLeft - newOverRight;
       
 12330 				// element is initially over right side of within
       
 12331 				} else if ( overRight > 0 && overLeft <= 0 ) {
       
 12332 					position.left = withinOffset;
       
 12333 				// element is initially over both left and right sides of within
       
 12334 				} else {
       
 12335 					if ( overLeft > overRight ) {
       
 12336 						position.left = withinOffset + outerWidth - data.collisionWidth;
       
 12337 					} else {
       
 12338 						position.left = withinOffset;
       
 12339 					}
       
 12340 				}
       
 12341 			// too far left -> align with left edge
       
 12342 			} else if ( overLeft > 0 ) {
       
 12343 				position.left += overLeft;
       
 12344 			// too far right -> align with right edge
       
 12345 			} else if ( overRight > 0 ) {
       
 12346 				position.left -= overRight;
       
 12347 			// adjust based on position and margin
       
 12348 			} else {
       
 12349 				position.left = max( position.left - collisionPosLeft, position.left );
       
 12350 			}
       
 12351 		},
       
 12352 		top: function( position, data ) {
       
 12353 			var within = data.within,
       
 12354 				withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
       
 12355 				outerHeight = data.within.height,
       
 12356 				collisionPosTop = position.top - data.collisionPosition.marginTop,
       
 12357 				overTop = withinOffset - collisionPosTop,
       
 12358 				overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
       
 12359 				newOverBottom;
       
 12360 
       
 12361 			// element is taller than within
       
 12362 			if ( data.collisionHeight > outerHeight ) {
       
 12363 				// element is initially over the top of within
       
 12364 				if ( overTop > 0 && overBottom <= 0 ) {
       
 12365 					newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
       
 12366 					position.top += overTop - newOverBottom;
       
 12367 				// element is initially over bottom of within
       
 12368 				} else if ( overBottom > 0 && overTop <= 0 ) {
       
 12369 					position.top = withinOffset;
       
 12370 				// element is initially over both top and bottom of within
       
 12371 				} else {
       
 12372 					if ( overTop > overBottom ) {
       
 12373 						position.top = withinOffset + outerHeight - data.collisionHeight;
       
 12374 					} else {
       
 12375 						position.top = withinOffset;
       
 12376 					}
       
 12377 				}
       
 12378 			// too far up -> align with top
       
 12379 			} else if ( overTop > 0 ) {
       
 12380 				position.top += overTop;
       
 12381 			// too far down -> align with bottom edge
       
 12382 			} else if ( overBottom > 0 ) {
       
 12383 				position.top -= overBottom;
       
 12384 			// adjust based on position and margin
       
 12385 			} else {
       
 12386 				position.top = max( position.top - collisionPosTop, position.top );
       
 12387 			}
       
 12388 		}
       
 12389 	},
       
 12390 	flip: {
       
 12391 		left: function( position, data ) {
       
 12392 			var within = data.within,
       
 12393 				withinOffset = within.offset.left + within.scrollLeft,
       
 12394 				outerWidth = within.width,
       
 12395 				offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
       
 12396 				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
       
 12397 				overLeft = collisionPosLeft - offsetLeft,
       
 12398 				overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
       
 12399 				myOffset = data.my[ 0 ] === "left" ?
       
 12400 					-data.elemWidth :
       
 12401 					data.my[ 0 ] === "right" ?
       
 12402 						data.elemWidth :
       
 12403 						0,
       
 12404 				atOffset = data.at[ 0 ] === "left" ?
       
 12405 					data.targetWidth :
       
 12406 					data.at[ 0 ] === "right" ?
       
 12407 						-data.targetWidth :
       
 12408 						0,
       
 12409 				offset = -2 * data.offset[ 0 ],
       
 12410 				newOverRight,
       
 12411 				newOverLeft;
       
 12412 
       
 12413 			if ( overLeft < 0 ) {
       
 12414 				newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
       
 12415 				if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
       
 12416 					position.left += myOffset + atOffset + offset;
       
 12417 				}
       
 12418 			}
       
 12419 			else if ( overRight > 0 ) {
       
 12420 				newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
       
 12421 				if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
       
 12422 					position.left += myOffset + atOffset + offset;
       
 12423 				}
       
 12424 			}
       
 12425 		},
       
 12426 		top: function( position, data ) {
       
 12427 			var within = data.within,
       
 12428 				withinOffset = within.offset.top + within.scrollTop,
       
 12429 				outerHeight = within.height,
       
 12430 				offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
       
 12431 				collisionPosTop = position.top - data.collisionPosition.marginTop,
       
 12432 				overTop = collisionPosTop - offsetTop,
       
 12433 				overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
       
 12434 				top = data.my[ 1 ] === "top",
       
 12435 				myOffset = top ?
       
 12436 					-data.elemHeight :
       
 12437 					data.my[ 1 ] === "bottom" ?
       
 12438 						data.elemHeight :
       
 12439 						0,
       
 12440 				atOffset = data.at[ 1 ] === "top" ?
       
 12441 					data.targetHeight :
       
 12442 					data.at[ 1 ] === "bottom" ?
       
 12443 						-data.targetHeight :
       
 12444 						0,
       
 12445 				offset = -2 * data.offset[ 1 ],
       
 12446 				newOverTop,
       
 12447 				newOverBottom;
       
 12448 			if ( overTop < 0 ) {
       
 12449 				newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
       
 12450 				if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
       
 12451 					position.top += myOffset + atOffset + offset;
       
 12452 				}
       
 12453 			}
       
 12454 			else if ( overBottom > 0 ) {
       
 12455 				newOverTop = position.top -  data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
       
 12456 				if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
       
 12457 					position.top += myOffset + atOffset + offset;
       
 12458 				}
       
 12459 			}
       
 12460 		}
       
 12461 	},
       
 12462 	flipfit: {
       
 12463 		left: function() {
       
 12464 			$.ui.position.flip.left.apply( this, arguments );
       
 12465 			$.ui.position.fit.left.apply( this, arguments );
       
 12466 		},
       
 12467 		top: function() {
       
 12468 			$.ui.position.flip.top.apply( this, arguments );
       
 12469 			$.ui.position.fit.top.apply( this, arguments );
       
 12470 		}
       
 12471 	}
       
 12472 };
       
 12473 
       
 12474 // fraction support test
       
 12475 (function () {
       
 12476 	var testElement, testElementParent, testElementStyle, offsetLeft, i,
       
 12477 		body = document.getElementsByTagName( "body" )[ 0 ],
       
 12478 		div = document.createElement( "div" );
       
 12479 
       
 12480 	//Create a "fake body" for testing based on method used in jQuery.support
       
 12481 	testElement = document.createElement( body ? "div" : "body" );
       
 12482 	testElementStyle = {
       
 12483 		visibility: "hidden",
       
 12484 		width: 0,
       
 12485 		height: 0,
       
 12486 		border: 0,
       
 12487 		margin: 0,
       
 12488 		background: "none"
       
 12489 	};
       
 12490 	if ( body ) {
       
 12491 		$.extend( testElementStyle, {
       
 12492 			position: "absolute",
       
 12493 			left: "-1000px",
       
 12494 			top: "-1000px"
       
 12495 		});
       
 12496 	}
       
 12497 	for ( i in testElementStyle ) {
       
 12498 		testElement.style[ i ] = testElementStyle[ i ];
       
 12499 	}
       
 12500 	testElement.appendChild( div );
       
 12501 	testElementParent = body || document.documentElement;
       
 12502 	testElementParent.insertBefore( testElement, testElementParent.firstChild );
       
 12503 
       
 12504 	div.style.cssText = "position: absolute; left: 10.7432222px;";
       
 12505 
       
 12506 	offsetLeft = $( div ).offset().left;
       
 12507 	$.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11;
       
 12508 
       
 12509 	testElement.innerHTML = "";
       
 12510 	testElementParent.removeChild( testElement );
       
 12511 })();
       
 12512 
       
 12513 }( jQuery ) );
       
 12514 
       
 12515 (function( $, undefined ) {
       
 12516 
       
 12517 $.widget( "ui.progressbar", {
       
 12518 	version: "1.10.3",
       
 12519 	options: {
 11783 	options: {
 12520 		max: 100,
 11784 		max: 100,
 12521 		value: 0,
 11785 		value: 0,
 12522 
 11786 
 12523 		change: null,
 11787 		change: null,
 12595 	_setOption: function( key, value ) {
 11859 	_setOption: function( key, value ) {
 12596 		if ( key === "max" ) {
 11860 		if ( key === "max" ) {
 12597 			// Don't allow a max less than min
 11861 			// Don't allow a max less than min
 12598 			value = Math.max( this.min, value );
 11862 			value = Math.max( this.min, value );
 12599 		}
 11863 		}
 12600 
 11864 		if ( key === "disabled" ) {
       
 11865 			this.element
       
 11866 				.toggleClass( "ui-state-disabled", !!value )
       
 11867 				.attr( "aria-disabled", value );
       
 11868 		}
 12601 		this._super( key, value );
 11869 		this._super( key, value );
 12602 	},
 11870 	},
 12603 
 11871 
 12604 	_percentage: function() {
 11872 	_percentage: function() {
 12605 		return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
 11873 		return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
 12640 			this._trigger( "complete" );
 11908 			this._trigger( "complete" );
 12641 		}
 11909 		}
 12642 	}
 11910 	}
 12643 });
 11911 });
 12644 
 11912 
 12645 })( jQuery );
 11913 
 12646 
 11914 /*!
 12647 (function( $, undefined ) {
 11915  * jQuery UI Selectable 1.11.4
 12648 
 11916  * http://jqueryui.com
 12649 // number of pages in a slider
 11917  *
 12650 // (how many times can you page up/down to go through the whole range)
 11918  * Copyright jQuery Foundation and other contributors
 12651 var numPages = 5;
 11919  * Released under the MIT license.
 12652 
 11920  * http://jquery.org/license
 12653 $.widget( "ui.slider", $.ui.mouse, {
 11921  *
 12654 	version: "1.10.3",
 11922  * http://api.jqueryui.com/selectable/
       
 11923  */
       
 11924 
       
 11925 
       
 11926 var selectable = $.widget("ui.selectable", $.ui.mouse, {
       
 11927 	version: "1.11.4",
       
 11928 	options: {
       
 11929 		appendTo: "body",
       
 11930 		autoRefresh: true,
       
 11931 		distance: 0,
       
 11932 		filter: "*",
       
 11933 		tolerance: "touch",
       
 11934 
       
 11935 		// callbacks
       
 11936 		selected: null,
       
 11937 		selecting: null,
       
 11938 		start: null,
       
 11939 		stop: null,
       
 11940 		unselected: null,
       
 11941 		unselecting: null
       
 11942 	},
       
 11943 	_create: function() {
       
 11944 		var selectees,
       
 11945 			that = this;
       
 11946 
       
 11947 		this.element.addClass("ui-selectable");
       
 11948 
       
 11949 		this.dragged = false;
       
 11950 
       
 11951 		// cache selectee children based on filter
       
 11952 		this.refresh = function() {
       
 11953 			selectees = $(that.options.filter, that.element[0]);
       
 11954 			selectees.addClass("ui-selectee");
       
 11955 			selectees.each(function() {
       
 11956 				var $this = $(this),
       
 11957 					pos = $this.offset();
       
 11958 				$.data(this, "selectable-item", {
       
 11959 					element: this,
       
 11960 					$element: $this,
       
 11961 					left: pos.left,
       
 11962 					top: pos.top,
       
 11963 					right: pos.left + $this.outerWidth(),
       
 11964 					bottom: pos.top + $this.outerHeight(),
       
 11965 					startselected: false,
       
 11966 					selected: $this.hasClass("ui-selected"),
       
 11967 					selecting: $this.hasClass("ui-selecting"),
       
 11968 					unselecting: $this.hasClass("ui-unselecting")
       
 11969 				});
       
 11970 			});
       
 11971 		};
       
 11972 		this.refresh();
       
 11973 
       
 11974 		this.selectees = selectees.addClass("ui-selectee");
       
 11975 
       
 11976 		this._mouseInit();
       
 11977 
       
 11978 		this.helper = $("<div class='ui-selectable-helper'></div>");
       
 11979 	},
       
 11980 
       
 11981 	_destroy: function() {
       
 11982 		this.selectees
       
 11983 			.removeClass("ui-selectee")
       
 11984 			.removeData("selectable-item");
       
 11985 		this.element
       
 11986 			.removeClass("ui-selectable ui-selectable-disabled");
       
 11987 		this._mouseDestroy();
       
 11988 	},
       
 11989 
       
 11990 	_mouseStart: function(event) {
       
 11991 		var that = this,
       
 11992 			options = this.options;
       
 11993 
       
 11994 		this.opos = [ event.pageX, event.pageY ];
       
 11995 
       
 11996 		if (this.options.disabled) {
       
 11997 			return;
       
 11998 		}
       
 11999 
       
 12000 		this.selectees = $(options.filter, this.element[0]);
       
 12001 
       
 12002 		this._trigger("start", event);
       
 12003 
       
 12004 		$(options.appendTo).append(this.helper);
       
 12005 		// position helper (lasso)
       
 12006 		this.helper.css({
       
 12007 			"left": event.pageX,
       
 12008 			"top": event.pageY,
       
 12009 			"width": 0,
       
 12010 			"height": 0
       
 12011 		});
       
 12012 
       
 12013 		if (options.autoRefresh) {
       
 12014 			this.refresh();
       
 12015 		}
       
 12016 
       
 12017 		this.selectees.filter(".ui-selected").each(function() {
       
 12018 			var selectee = $.data(this, "selectable-item");
       
 12019 			selectee.startselected = true;
       
 12020 			if (!event.metaKey && !event.ctrlKey) {
       
 12021 				selectee.$element.removeClass("ui-selected");
       
 12022 				selectee.selected = false;
       
 12023 				selectee.$element.addClass("ui-unselecting");
       
 12024 				selectee.unselecting = true;
       
 12025 				// selectable UNSELECTING callback
       
 12026 				that._trigger("unselecting", event, {
       
 12027 					unselecting: selectee.element
       
 12028 				});
       
 12029 			}
       
 12030 		});
       
 12031 
       
 12032 		$(event.target).parents().addBack().each(function() {
       
 12033 			var doSelect,
       
 12034 				selectee = $.data(this, "selectable-item");
       
 12035 			if (selectee) {
       
 12036 				doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected");
       
 12037 				selectee.$element
       
 12038 					.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
       
 12039 					.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
       
 12040 				selectee.unselecting = !doSelect;
       
 12041 				selectee.selecting = doSelect;
       
 12042 				selectee.selected = doSelect;
       
 12043 				// selectable (UN)SELECTING callback
       
 12044 				if (doSelect) {
       
 12045 					that._trigger("selecting", event, {
       
 12046 						selecting: selectee.element
       
 12047 					});
       
 12048 				} else {
       
 12049 					that._trigger("unselecting", event, {
       
 12050 						unselecting: selectee.element
       
 12051 					});
       
 12052 				}
       
 12053 				return false;
       
 12054 			}
       
 12055 		});
       
 12056 
       
 12057 	},
       
 12058 
       
 12059 	_mouseDrag: function(event) {
       
 12060 
       
 12061 		this.dragged = true;
       
 12062 
       
 12063 		if (this.options.disabled) {
       
 12064 			return;
       
 12065 		}
       
 12066 
       
 12067 		var tmp,
       
 12068 			that = this,
       
 12069 			options = this.options,
       
 12070 			x1 = this.opos[0],
       
 12071 			y1 = this.opos[1],
       
 12072 			x2 = event.pageX,
       
 12073 			y2 = event.pageY;
       
 12074 
       
 12075 		if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; }
       
 12076 		if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; }
       
 12077 		this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 });
       
 12078 
       
 12079 		this.selectees.each(function() {
       
 12080 			var selectee = $.data(this, "selectable-item"),
       
 12081 				hit = false;
       
 12082 
       
 12083 			//prevent helper from being selected if appendTo: selectable
       
 12084 			if (!selectee || selectee.element === that.element[0]) {
       
 12085 				return;
       
 12086 			}
       
 12087 
       
 12088 			if (options.tolerance === "touch") {
       
 12089 				hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
       
 12090 			} else if (options.tolerance === "fit") {
       
 12091 				hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
       
 12092 			}
       
 12093 
       
 12094 			if (hit) {
       
 12095 				// SELECT
       
 12096 				if (selectee.selected) {
       
 12097 					selectee.$element.removeClass("ui-selected");
       
 12098 					selectee.selected = false;
       
 12099 				}
       
 12100 				if (selectee.unselecting) {
       
 12101 					selectee.$element.removeClass("ui-unselecting");
       
 12102 					selectee.unselecting = false;
       
 12103 				}
       
 12104 				if (!selectee.selecting) {
       
 12105 					selectee.$element.addClass("ui-selecting");
       
 12106 					selectee.selecting = true;
       
 12107 					// selectable SELECTING callback
       
 12108 					that._trigger("selecting", event, {
       
 12109 						selecting: selectee.element
       
 12110 					});
       
 12111 				}
       
 12112 			} else {
       
 12113 				// UNSELECT
       
 12114 				if (selectee.selecting) {
       
 12115 					if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
       
 12116 						selectee.$element.removeClass("ui-selecting");
       
 12117 						selectee.selecting = false;
       
 12118 						selectee.$element.addClass("ui-selected");
       
 12119 						selectee.selected = true;
       
 12120 					} else {
       
 12121 						selectee.$element.removeClass("ui-selecting");
       
 12122 						selectee.selecting = false;
       
 12123 						if (selectee.startselected) {
       
 12124 							selectee.$element.addClass("ui-unselecting");
       
 12125 							selectee.unselecting = true;
       
 12126 						}
       
 12127 						// selectable UNSELECTING callback
       
 12128 						that._trigger("unselecting", event, {
       
 12129 							unselecting: selectee.element
       
 12130 						});
       
 12131 					}
       
 12132 				}
       
 12133 				if (selectee.selected) {
       
 12134 					if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
       
 12135 						selectee.$element.removeClass("ui-selected");
       
 12136 						selectee.selected = false;
       
 12137 
       
 12138 						selectee.$element.addClass("ui-unselecting");
       
 12139 						selectee.unselecting = true;
       
 12140 						// selectable UNSELECTING callback
       
 12141 						that._trigger("unselecting", event, {
       
 12142 							unselecting: selectee.element
       
 12143 						});
       
 12144 					}
       
 12145 				}
       
 12146 			}
       
 12147 		});
       
 12148 
       
 12149 		return false;
       
 12150 	},
       
 12151 
       
 12152 	_mouseStop: function(event) {
       
 12153 		var that = this;
       
 12154 
       
 12155 		this.dragged = false;
       
 12156 
       
 12157 		$(".ui-unselecting", this.element[0]).each(function() {
       
 12158 			var selectee = $.data(this, "selectable-item");
       
 12159 			selectee.$element.removeClass("ui-unselecting");
       
 12160 			selectee.unselecting = false;
       
 12161 			selectee.startselected = false;
       
 12162 			that._trigger("unselected", event, {
       
 12163 				unselected: selectee.element
       
 12164 			});
       
 12165 		});
       
 12166 		$(".ui-selecting", this.element[0]).each(function() {
       
 12167 			var selectee = $.data(this, "selectable-item");
       
 12168 			selectee.$element.removeClass("ui-selecting").addClass("ui-selected");
       
 12169 			selectee.selecting = false;
       
 12170 			selectee.selected = true;
       
 12171 			selectee.startselected = true;
       
 12172 			that._trigger("selected", event, {
       
 12173 				selected: selectee.element
       
 12174 			});
       
 12175 		});
       
 12176 		this._trigger("stop", event);
       
 12177 
       
 12178 		this.helper.remove();
       
 12179 
       
 12180 		return false;
       
 12181 	}
       
 12182 
       
 12183 });
       
 12184 
       
 12185 
       
 12186 /*!
       
 12187  * jQuery UI Selectmenu 1.11.4
       
 12188  * http://jqueryui.com
       
 12189  *
       
 12190  * Copyright jQuery Foundation and other contributors
       
 12191  * Released under the MIT license.
       
 12192  * http://jquery.org/license
       
 12193  *
       
 12194  * http://api.jqueryui.com/selectmenu
       
 12195  */
       
 12196 
       
 12197 
       
 12198 var selectmenu = $.widget( "ui.selectmenu", {
       
 12199 	version: "1.11.4",
       
 12200 	defaultElement: "<select>",
       
 12201 	options: {
       
 12202 		appendTo: null,
       
 12203 		disabled: null,
       
 12204 		icons: {
       
 12205 			button: "ui-icon-triangle-1-s"
       
 12206 		},
       
 12207 		position: {
       
 12208 			my: "left top",
       
 12209 			at: "left bottom",
       
 12210 			collision: "none"
       
 12211 		},
       
 12212 		width: null,
       
 12213 
       
 12214 		// callbacks
       
 12215 		change: null,
       
 12216 		close: null,
       
 12217 		focus: null,
       
 12218 		open: null,
       
 12219 		select: null
       
 12220 	},
       
 12221 
       
 12222 	_create: function() {
       
 12223 		var selectmenuId = this.element.uniqueId().attr( "id" );
       
 12224 		this.ids = {
       
 12225 			element: selectmenuId,
       
 12226 			button: selectmenuId + "-button",
       
 12227 			menu: selectmenuId + "-menu"
       
 12228 		};
       
 12229 
       
 12230 		this._drawButton();
       
 12231 		this._drawMenu();
       
 12232 
       
 12233 		if ( this.options.disabled ) {
       
 12234 			this.disable();
       
 12235 		}
       
 12236 	},
       
 12237 
       
 12238 	_drawButton: function() {
       
 12239 		var that = this;
       
 12240 
       
 12241 		// Associate existing label with the new button
       
 12242 		this.label = $( "label[for='" + this.ids.element + "']" ).attr( "for", this.ids.button );
       
 12243 		this._on( this.label, {
       
 12244 			click: function( event ) {
       
 12245 				this.button.focus();
       
 12246 				event.preventDefault();
       
 12247 			}
       
 12248 		});
       
 12249 
       
 12250 		// Hide original select element
       
 12251 		this.element.hide();
       
 12252 
       
 12253 		// Create button
       
 12254 		this.button = $( "<span>", {
       
 12255 			"class": "ui-selectmenu-button ui-widget ui-state-default ui-corner-all",
       
 12256 			tabindex: this.options.disabled ? -1 : 0,
       
 12257 			id: this.ids.button,
       
 12258 			role: "combobox",
       
 12259 			"aria-expanded": "false",
       
 12260 			"aria-autocomplete": "list",
       
 12261 			"aria-owns": this.ids.menu,
       
 12262 			"aria-haspopup": "true"
       
 12263 		})
       
 12264 			.insertAfter( this.element );
       
 12265 
       
 12266 		$( "<span>", {
       
 12267 			"class": "ui-icon " + this.options.icons.button
       
 12268 		})
       
 12269 			.prependTo( this.button );
       
 12270 
       
 12271 		this.buttonText = $( "<span>", {
       
 12272 			"class": "ui-selectmenu-text"
       
 12273 		})
       
 12274 			.appendTo( this.button );
       
 12275 
       
 12276 		this._setText( this.buttonText, this.element.find( "option:selected" ).text() );
       
 12277 		this._resizeButton();
       
 12278 
       
 12279 		this._on( this.button, this._buttonEvents );
       
 12280 		this.button.one( "focusin", function() {
       
 12281 
       
 12282 			// Delay rendering the menu items until the button receives focus.
       
 12283 			// The menu may have already been rendered via a programmatic open.
       
 12284 			if ( !that.menuItems ) {
       
 12285 				that._refreshMenu();
       
 12286 			}
       
 12287 		});
       
 12288 		this._hoverable( this.button );
       
 12289 		this._focusable( this.button );
       
 12290 	},
       
 12291 
       
 12292 	_drawMenu: function() {
       
 12293 		var that = this;
       
 12294 
       
 12295 		// Create menu
       
 12296 		this.menu = $( "<ul>", {
       
 12297 			"aria-hidden": "true",
       
 12298 			"aria-labelledby": this.ids.button,
       
 12299 			id: this.ids.menu
       
 12300 		});
       
 12301 
       
 12302 		// Wrap menu
       
 12303 		this.menuWrap = $( "<div>", {
       
 12304 			"class": "ui-selectmenu-menu ui-front"
       
 12305 		})
       
 12306 			.append( this.menu )
       
 12307 			.appendTo( this._appendTo() );
       
 12308 
       
 12309 		// Initialize menu widget
       
 12310 		this.menuInstance = this.menu
       
 12311 			.menu({
       
 12312 				role: "listbox",
       
 12313 				select: function( event, ui ) {
       
 12314 					event.preventDefault();
       
 12315 
       
 12316 					// support: IE8
       
 12317 					// If the item was selected via a click, the text selection
       
 12318 					// will be destroyed in IE
       
 12319 					that._setSelection();
       
 12320 
       
 12321 					that._select( ui.item.data( "ui-selectmenu-item" ), event );
       
 12322 				},
       
 12323 				focus: function( event, ui ) {
       
 12324 					var item = ui.item.data( "ui-selectmenu-item" );
       
 12325 
       
 12326 					// Prevent inital focus from firing and check if its a newly focused item
       
 12327 					if ( that.focusIndex != null && item.index !== that.focusIndex ) {
       
 12328 						that._trigger( "focus", event, { item: item } );
       
 12329 						if ( !that.isOpen ) {
       
 12330 							that._select( item, event );
       
 12331 						}
       
 12332 					}
       
 12333 					that.focusIndex = item.index;
       
 12334 
       
 12335 					that.button.attr( "aria-activedescendant",
       
 12336 						that.menuItems.eq( item.index ).attr( "id" ) );
       
 12337 				}
       
 12338 			})
       
 12339 			.menu( "instance" );
       
 12340 
       
 12341 		// Adjust menu styles to dropdown
       
 12342 		this.menu
       
 12343 			.addClass( "ui-corner-bottom" )
       
 12344 			.removeClass( "ui-corner-all" );
       
 12345 
       
 12346 		// Don't close the menu on mouseleave
       
 12347 		this.menuInstance._off( this.menu, "mouseleave" );
       
 12348 
       
 12349 		// Cancel the menu's collapseAll on document click
       
 12350 		this.menuInstance._closeOnDocumentClick = function() {
       
 12351 			return false;
       
 12352 		};
       
 12353 
       
 12354 		// Selects often contain empty items, but never contain dividers
       
 12355 		this.menuInstance._isDivider = function() {
       
 12356 			return false;
       
 12357 		};
       
 12358 	},
       
 12359 
       
 12360 	refresh: function() {
       
 12361 		this._refreshMenu();
       
 12362 		this._setText( this.buttonText, this._getSelectedItem().text() );
       
 12363 		if ( !this.options.width ) {
       
 12364 			this._resizeButton();
       
 12365 		}
       
 12366 	},
       
 12367 
       
 12368 	_refreshMenu: function() {
       
 12369 		this.menu.empty();
       
 12370 
       
 12371 		var item,
       
 12372 			options = this.element.find( "option" );
       
 12373 
       
 12374 		if ( !options.length ) {
       
 12375 			return;
       
 12376 		}
       
 12377 
       
 12378 		this._parseOptions( options );
       
 12379 		this._renderMenu( this.menu, this.items );
       
 12380 
       
 12381 		this.menuInstance.refresh();
       
 12382 		this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" );
       
 12383 
       
 12384 		item = this._getSelectedItem();
       
 12385 
       
 12386 		// Update the menu to have the correct item focused
       
 12387 		this.menuInstance.focus( null, item );
       
 12388 		this._setAria( item.data( "ui-selectmenu-item" ) );
       
 12389 
       
 12390 		// Set disabled state
       
 12391 		this._setOption( "disabled", this.element.prop( "disabled" ) );
       
 12392 	},
       
 12393 
       
 12394 	open: function( event ) {
       
 12395 		if ( this.options.disabled ) {
       
 12396 			return;
       
 12397 		}
       
 12398 
       
 12399 		// If this is the first time the menu is being opened, render the items
       
 12400 		if ( !this.menuItems ) {
       
 12401 			this._refreshMenu();
       
 12402 		} else {
       
 12403 
       
 12404 			// Menu clears focus on close, reset focus to selected item
       
 12405 			this.menu.find( ".ui-state-focus" ).removeClass( "ui-state-focus" );
       
 12406 			this.menuInstance.focus( null, this._getSelectedItem() );
       
 12407 		}
       
 12408 
       
 12409 		this.isOpen = true;
       
 12410 		this._toggleAttr();
       
 12411 		this._resizeMenu();
       
 12412 		this._position();
       
 12413 
       
 12414 		this._on( this.document, this._documentClick );
       
 12415 
       
 12416 		this._trigger( "open", event );
       
 12417 	},
       
 12418 
       
 12419 	_position: function() {
       
 12420 		this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
       
 12421 	},
       
 12422 
       
 12423 	close: function( event ) {
       
 12424 		if ( !this.isOpen ) {
       
 12425 			return;
       
 12426 		}
       
 12427 
       
 12428 		this.isOpen = false;
       
 12429 		this._toggleAttr();
       
 12430 
       
 12431 		this.range = null;
       
 12432 		this._off( this.document );
       
 12433 
       
 12434 		this._trigger( "close", event );
       
 12435 	},
       
 12436 
       
 12437 	widget: function() {
       
 12438 		return this.button;
       
 12439 	},
       
 12440 
       
 12441 	menuWidget: function() {
       
 12442 		return this.menu;
       
 12443 	},
       
 12444 
       
 12445 	_renderMenu: function( ul, items ) {
       
 12446 		var that = this,
       
 12447 			currentOptgroup = "";
       
 12448 
       
 12449 		$.each( items, function( index, item ) {
       
 12450 			if ( item.optgroup !== currentOptgroup ) {
       
 12451 				$( "<li>", {
       
 12452 					"class": "ui-selectmenu-optgroup ui-menu-divider" +
       
 12453 						( item.element.parent( "optgroup" ).prop( "disabled" ) ?
       
 12454 							" ui-state-disabled" :
       
 12455 							"" ),
       
 12456 					text: item.optgroup
       
 12457 				})
       
 12458 					.appendTo( ul );
       
 12459 
       
 12460 				currentOptgroup = item.optgroup;
       
 12461 			}
       
 12462 
       
 12463 			that._renderItemData( ul, item );
       
 12464 		});
       
 12465 	},
       
 12466 
       
 12467 	_renderItemData: function( ul, item ) {
       
 12468 		return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
       
 12469 	},
       
 12470 
       
 12471 	_renderItem: function( ul, item ) {
       
 12472 		var li = $( "<li>" );
       
 12473 
       
 12474 		if ( item.disabled ) {
       
 12475 			li.addClass( "ui-state-disabled" );
       
 12476 		}
       
 12477 		this._setText( li, item.label );
       
 12478 
       
 12479 		return li.appendTo( ul );
       
 12480 	},
       
 12481 
       
 12482 	_setText: function( element, value ) {
       
 12483 		if ( value ) {
       
 12484 			element.text( value );
       
 12485 		} else {
       
 12486 			element.html( "&#160;" );
       
 12487 		}
       
 12488 	},
       
 12489 
       
 12490 	_move: function( direction, event ) {
       
 12491 		var item, next,
       
 12492 			filter = ".ui-menu-item";
       
 12493 
       
 12494 		if ( this.isOpen ) {
       
 12495 			item = this.menuItems.eq( this.focusIndex );
       
 12496 		} else {
       
 12497 			item = this.menuItems.eq( this.element[ 0 ].selectedIndex );
       
 12498 			filter += ":not(.ui-state-disabled)";
       
 12499 		}
       
 12500 
       
 12501 		if ( direction === "first" || direction === "last" ) {
       
 12502 			next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
       
 12503 		} else {
       
 12504 			next = item[ direction + "All" ]( filter ).eq( 0 );
       
 12505 		}
       
 12506 
       
 12507 		if ( next.length ) {
       
 12508 			this.menuInstance.focus( event, next );
       
 12509 		}
       
 12510 	},
       
 12511 
       
 12512 	_getSelectedItem: function() {
       
 12513 		return this.menuItems.eq( this.element[ 0 ].selectedIndex );
       
 12514 	},
       
 12515 
       
 12516 	_toggle: function( event ) {
       
 12517 		this[ this.isOpen ? "close" : "open" ]( event );
       
 12518 	},
       
 12519 
       
 12520 	_setSelection: function() {
       
 12521 		var selection;
       
 12522 
       
 12523 		if ( !this.range ) {
       
 12524 			return;
       
 12525 		}
       
 12526 
       
 12527 		if ( window.getSelection ) {
       
 12528 			selection = window.getSelection();
       
 12529 			selection.removeAllRanges();
       
 12530 			selection.addRange( this.range );
       
 12531 
       
 12532 		// support: IE8
       
 12533 		} else {
       
 12534 			this.range.select();
       
 12535 		}
       
 12536 
       
 12537 		// support: IE
       
 12538 		// Setting the text selection kills the button focus in IE, but
       
 12539 		// restoring the focus doesn't kill the selection.
       
 12540 		this.button.focus();
       
 12541 	},
       
 12542 
       
 12543 	_documentClick: {
       
 12544 		mousedown: function( event ) {
       
 12545 			if ( !this.isOpen ) {
       
 12546 				return;
       
 12547 			}
       
 12548 
       
 12549 			if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + this.ids.button ).length ) {
       
 12550 				this.close( event );
       
 12551 			}
       
 12552 		}
       
 12553 	},
       
 12554 
       
 12555 	_buttonEvents: {
       
 12556 
       
 12557 		// Prevent text selection from being reset when interacting with the selectmenu (#10144)
       
 12558 		mousedown: function() {
       
 12559 			var selection;
       
 12560 
       
 12561 			if ( window.getSelection ) {
       
 12562 				selection = window.getSelection();
       
 12563 				if ( selection.rangeCount ) {
       
 12564 					this.range = selection.getRangeAt( 0 );
       
 12565 				}
       
 12566 
       
 12567 			// support: IE8
       
 12568 			} else {
       
 12569 				this.range = document.selection.createRange();
       
 12570 			}
       
 12571 		},
       
 12572 
       
 12573 		click: function( event ) {
       
 12574 			this._setSelection();
       
 12575 			this._toggle( event );
       
 12576 		},
       
 12577 
       
 12578 		keydown: function( event ) {
       
 12579 			var preventDefault = true;
       
 12580 			switch ( event.keyCode ) {
       
 12581 				case $.ui.keyCode.TAB:
       
 12582 				case $.ui.keyCode.ESCAPE:
       
 12583 					this.close( event );
       
 12584 					preventDefault = false;
       
 12585 					break;
       
 12586 				case $.ui.keyCode.ENTER:
       
 12587 					if ( this.isOpen ) {
       
 12588 						this._selectFocusedItem( event );
       
 12589 					}
       
 12590 					break;
       
 12591 				case $.ui.keyCode.UP:
       
 12592 					if ( event.altKey ) {
       
 12593 						this._toggle( event );
       
 12594 					} else {
       
 12595 						this._move( "prev", event );
       
 12596 					}
       
 12597 					break;
       
 12598 				case $.ui.keyCode.DOWN:
       
 12599 					if ( event.altKey ) {
       
 12600 						this._toggle( event );
       
 12601 					} else {
       
 12602 						this._move( "next", event );
       
 12603 					}
       
 12604 					break;
       
 12605 				case $.ui.keyCode.SPACE:
       
 12606 					if ( this.isOpen ) {
       
 12607 						this._selectFocusedItem( event );
       
 12608 					} else {
       
 12609 						this._toggle( event );
       
 12610 					}
       
 12611 					break;
       
 12612 				case $.ui.keyCode.LEFT:
       
 12613 					this._move( "prev", event );
       
 12614 					break;
       
 12615 				case $.ui.keyCode.RIGHT:
       
 12616 					this._move( "next", event );
       
 12617 					break;
       
 12618 				case $.ui.keyCode.HOME:
       
 12619 				case $.ui.keyCode.PAGE_UP:
       
 12620 					this._move( "first", event );
       
 12621 					break;
       
 12622 				case $.ui.keyCode.END:
       
 12623 				case $.ui.keyCode.PAGE_DOWN:
       
 12624 					this._move( "last", event );
       
 12625 					break;
       
 12626 				default:
       
 12627 					this.menu.trigger( event );
       
 12628 					preventDefault = false;
       
 12629 			}
       
 12630 
       
 12631 			if ( preventDefault ) {
       
 12632 				event.preventDefault();
       
 12633 			}
       
 12634 		}
       
 12635 	},
       
 12636 
       
 12637 	_selectFocusedItem: function( event ) {
       
 12638 		var item = this.menuItems.eq( this.focusIndex );
       
 12639 		if ( !item.hasClass( "ui-state-disabled" ) ) {
       
 12640 			this._select( item.data( "ui-selectmenu-item" ), event );
       
 12641 		}
       
 12642 	},
       
 12643 
       
 12644 	_select: function( item, event ) {
       
 12645 		var oldIndex = this.element[ 0 ].selectedIndex;
       
 12646 
       
 12647 		// Change native select element
       
 12648 		this.element[ 0 ].selectedIndex = item.index;
       
 12649 		this._setText( this.buttonText, item.label );
       
 12650 		this._setAria( item );
       
 12651 		this._trigger( "select", event, { item: item } );
       
 12652 
       
 12653 		if ( item.index !== oldIndex ) {
       
 12654 			this._trigger( "change", event, { item: item } );
       
 12655 		}
       
 12656 
       
 12657 		this.close( event );
       
 12658 	},
       
 12659 
       
 12660 	_setAria: function( item ) {
       
 12661 		var id = this.menuItems.eq( item.index ).attr( "id" );
       
 12662 
       
 12663 		this.button.attr({
       
 12664 			"aria-labelledby": id,
       
 12665 			"aria-activedescendant": id
       
 12666 		});
       
 12667 		this.menu.attr( "aria-activedescendant", id );
       
 12668 	},
       
 12669 
       
 12670 	_setOption: function( key, value ) {
       
 12671 		if ( key === "icons" ) {
       
 12672 			this.button.find( "span.ui-icon" )
       
 12673 				.removeClass( this.options.icons.button )
       
 12674 				.addClass( value.button );
       
 12675 		}
       
 12676 
       
 12677 		this._super( key, value );
       
 12678 
       
 12679 		if ( key === "appendTo" ) {
       
 12680 			this.menuWrap.appendTo( this._appendTo() );
       
 12681 		}
       
 12682 
       
 12683 		if ( key === "disabled" ) {
       
 12684 			this.menuInstance.option( "disabled", value );
       
 12685 			this.button
       
 12686 				.toggleClass( "ui-state-disabled", value )
       
 12687 				.attr( "aria-disabled", value );
       
 12688 
       
 12689 			this.element.prop( "disabled", value );
       
 12690 			if ( value ) {
       
 12691 				this.button.attr( "tabindex", -1 );
       
 12692 				this.close();
       
 12693 			} else {
       
 12694 				this.button.attr( "tabindex", 0 );
       
 12695 			}
       
 12696 		}
       
 12697 
       
 12698 		if ( key === "width" ) {
       
 12699 			this._resizeButton();
       
 12700 		}
       
 12701 	},
       
 12702 
       
 12703 	_appendTo: function() {
       
 12704 		var element = this.options.appendTo;
       
 12705 
       
 12706 		if ( element ) {
       
 12707 			element = element.jquery || element.nodeType ?
       
 12708 				$( element ) :
       
 12709 				this.document.find( element ).eq( 0 );
       
 12710 		}
       
 12711 
       
 12712 		if ( !element || !element[ 0 ] ) {
       
 12713 			element = this.element.closest( ".ui-front" );
       
 12714 		}
       
 12715 
       
 12716 		if ( !element.length ) {
       
 12717 			element = this.document[ 0 ].body;
       
 12718 		}
       
 12719 
       
 12720 		return element;
       
 12721 	},
       
 12722 
       
 12723 	_toggleAttr: function() {
       
 12724 		this.button
       
 12725 			.toggleClass( "ui-corner-top", this.isOpen )
       
 12726 			.toggleClass( "ui-corner-all", !this.isOpen )
       
 12727 			.attr( "aria-expanded", this.isOpen );
       
 12728 		this.menuWrap.toggleClass( "ui-selectmenu-open", this.isOpen );
       
 12729 		this.menu.attr( "aria-hidden", !this.isOpen );
       
 12730 	},
       
 12731 
       
 12732 	_resizeButton: function() {
       
 12733 		var width = this.options.width;
       
 12734 
       
 12735 		if ( !width ) {
       
 12736 			width = this.element.show().outerWidth();
       
 12737 			this.element.hide();
       
 12738 		}
       
 12739 
       
 12740 		this.button.outerWidth( width );
       
 12741 	},
       
 12742 
       
 12743 	_resizeMenu: function() {
       
 12744 		this.menu.outerWidth( Math.max(
       
 12745 			this.button.outerWidth(),
       
 12746 
       
 12747 			// support: IE10
       
 12748 			// IE10 wraps long text (possibly a rounding bug)
       
 12749 			// so we add 1px to avoid the wrapping
       
 12750 			this.menu.width( "" ).outerWidth() + 1
       
 12751 		) );
       
 12752 	},
       
 12753 
       
 12754 	_getCreateOptions: function() {
       
 12755 		return { disabled: this.element.prop( "disabled" ) };
       
 12756 	},
       
 12757 
       
 12758 	_parseOptions: function( options ) {
       
 12759 		var data = [];
       
 12760 		options.each(function( index, item ) {
       
 12761 			var option = $( item ),
       
 12762 				optgroup = option.parent( "optgroup" );
       
 12763 			data.push({
       
 12764 				element: option,
       
 12765 				index: index,
       
 12766 				value: option.val(),
       
 12767 				label: option.text(),
       
 12768 				optgroup: optgroup.attr( "label" ) || "",
       
 12769 				disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
       
 12770 			});
       
 12771 		});
       
 12772 		this.items = data;
       
 12773 	},
       
 12774 
       
 12775 	_destroy: function() {
       
 12776 		this.menuWrap.remove();
       
 12777 		this.button.remove();
       
 12778 		this.element.show();
       
 12779 		this.element.removeUniqueId();
       
 12780 		this.label.attr( "for", this.ids.element );
       
 12781 	}
       
 12782 });
       
 12783 
       
 12784 
       
 12785 /*!
       
 12786  * jQuery UI Slider 1.11.4
       
 12787  * http://jqueryui.com
       
 12788  *
       
 12789  * Copyright jQuery Foundation and other contributors
       
 12790  * Released under the MIT license.
       
 12791  * http://jquery.org/license
       
 12792  *
       
 12793  * http://api.jqueryui.com/slider/
       
 12794  */
       
 12795 
       
 12796 
       
 12797 var slider = $.widget( "ui.slider", $.ui.mouse, {
       
 12798 	version: "1.11.4",
 12655 	widgetEventPrefix: "slide",
 12799 	widgetEventPrefix: "slide",
 12656 
 12800 
 12657 	options: {
 12801 	options: {
 12658 		animate: false,
 12802 		animate: false,
 12659 		distance: 0,
 12803 		distance: 0,
 12670 		slide: null,
 12814 		slide: null,
 12671 		start: null,
 12815 		start: null,
 12672 		stop: null
 12816 		stop: null
 12673 	},
 12817 	},
 12674 
 12818 
       
 12819 	// number of pages in a slider
       
 12820 	// (how many times can you page up/down to go through the whole range)
       
 12821 	numPages: 5,
       
 12822 
 12675 	_create: function() {
 12823 	_create: function() {
 12676 		this._keySliding = false;
 12824 		this._keySliding = false;
 12677 		this._mouseSliding = false;
 12825 		this._mouseSliding = false;
 12678 		this._animateOff = true;
 12826 		this._animateOff = true;
 12679 		this._handleIndex = null;
 12827 		this._handleIndex = null;
 12680 		this._detectOrientation();
 12828 		this._detectOrientation();
 12681 		this._mouseInit();
 12829 		this._mouseInit();
       
 12830 		this._calculateNewMax();
 12682 
 12831 
 12683 		this.element
 12832 		this.element
 12684 			.addClass( "ui-slider" +
 12833 			.addClass( "ui-slider" +
 12685 				" ui-slider-" + this.orientation +
 12834 				" ui-slider-" + this.orientation +
 12686 				" ui-widget" +
 12835 				" ui-widget" +
 12702 
 12851 
 12703 	_createHandles: function() {
 12852 	_createHandles: function() {
 12704 		var i, handleCount,
 12853 		var i, handleCount,
 12705 			options = this.options,
 12854 			options = this.options,
 12706 			existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
 12855 			existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
 12707 			handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
 12856 			handle = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",
 12708 			handles = [];
 12857 			handles = [];
 12709 
 12858 
 12710 		handleCount = ( options.values && options.values.length ) || 1;
 12859 		handleCount = ( options.values && options.values.length ) || 1;
 12711 
 12860 
 12712 		if ( existingHandles.length > handleCount ) {
 12861 		if ( existingHandles.length > handleCount ) {
 12760 			}
 12909 			}
 12761 
 12910 
 12762 			this.range.addClass( classes +
 12911 			this.range.addClass( classes +
 12763 				( ( options.range === "min" || options.range === "max" ) ? " ui-slider-range-" + options.range : "" ) );
 12912 				( ( options.range === "min" || options.range === "max" ) ? " ui-slider-range-" + options.range : "" ) );
 12764 		} else {
 12913 		} else {
 12765 			this.range = $([]);
 12914 			if ( this.range ) {
       
 12915 				this.range.remove();
       
 12916 			}
       
 12917 			this.range = null;
 12766 		}
 12918 		}
 12767 	},
 12919 	},
 12768 
 12920 
 12769 	_setupEvents: function() {
 12921 	_setupEvents: function() {
 12770 		var elements = this.handles.add( this.range ).filter( "a" );
 12922 		this._off( this.handles );
 12771 		this._off( elements );
 12923 		this._on( this.handles, this._handleEvents );
 12772 		this._on( elements, this._handleEvents );
 12924 		this._hoverable( this.handles );
 12773 		this._hoverable( elements );
 12925 		this._focusable( this.handles );
 12774 		this._focusable( elements );
       
 12775 	},
 12926 	},
 12776 
 12927 
 12777 	_destroy: function() {
 12928 	_destroy: function() {
 12778 		this.handles.remove();
 12929 		this.handles.remove();
 12779 		this.range.remove();
 12930 		if ( this.range ) {
       
 12931 			this.range.remove();
       
 12932 		}
 12780 
 12933 
 12781 		this.element
 12934 		this.element
 12782 			.removeClass( "ui-slider" +
 12935 			.removeClass( "ui-slider" +
 12783 				" ui-slider-horizontal" +
 12936 				" ui-slider-horizontal" +
 12784 				" ui-slider-vertical" +
 12937 				" ui-slider-vertical" +
 12946 					value: newVal,
 13099 					value: newVal,
 12947 					values: newValues
 13100 					values: newValues
 12948 				} );
 13101 				} );
 12949 				otherVal = this.values( index ? 0 : 1 );
 13102 				otherVal = this.values( index ? 0 : 1 );
 12950 				if ( allowed !== false ) {
 13103 				if ( allowed !== false ) {
 12951 					this.values( index, newVal, true );
 13104 					this.values( index, newVal );
 12952 				}
 13105 				}
 12953 			}
 13106 			}
 12954 		} else {
 13107 		} else {
 12955 			if ( newVal !== this.value() ) {
 13108 			if ( newVal !== this.value() ) {
 12956 				// A slide can be canceled by returning false from the slide callback
 13109 				// A slide can be canceled by returning false from the slide callback
 13047 		if ( key === "range" && this.options.range === true ) {
 13200 		if ( key === "range" && this.options.range === true ) {
 13048 			if ( value === "min" ) {
 13201 			if ( value === "min" ) {
 13049 				this.options.value = this._values( 0 );
 13202 				this.options.value = this._values( 0 );
 13050 				this.options.values = null;
 13203 				this.options.values = null;
 13051 			} else if ( value === "max" ) {
 13204 			} else if ( value === "max" ) {
 13052 				this.options.value = this._values( this.options.values.length-1 );
 13205 				this.options.value = this._values( this.options.values.length - 1 );
 13053 				this.options.values = null;
 13206 				this.options.values = null;
 13054 			}
 13207 			}
 13055 		}
 13208 		}
 13056 
 13209 
 13057 		if ( $.isArray( this.options.values ) ) {
 13210 		if ( $.isArray( this.options.values ) ) {
 13058 			valsLength = this.options.values.length;
 13211 			valsLength = this.options.values.length;
 13059 		}
 13212 		}
 13060 
 13213 
 13061 		$.Widget.prototype._setOption.apply( this, arguments );
 13214 		if ( key === "disabled" ) {
       
 13215 			this.element.toggleClass( "ui-state-disabled", !!value );
       
 13216 		}
       
 13217 
       
 13218 		this._super( key, value );
 13062 
 13219 
 13063 		switch ( key ) {
 13220 		switch ( key ) {
 13064 			case "orientation":
 13221 			case "orientation":
 13065 				this._detectOrientation();
 13222 				this._detectOrientation();
 13066 				this.element
 13223 				this.element
 13067 					.removeClass( "ui-slider-horizontal ui-slider-vertical" )
 13224 					.removeClass( "ui-slider-horizontal ui-slider-vertical" )
 13068 					.addClass( "ui-slider-" + this.orientation );
 13225 					.addClass( "ui-slider-" + this.orientation );
 13069 				this._refreshValue();
 13226 				this._refreshValue();
       
 13227 
       
 13228 				// Reset positioning from previous orientation
       
 13229 				this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
 13070 				break;
 13230 				break;
 13071 			case "value":
 13231 			case "value":
 13072 				this._animateOff = true;
 13232 				this._animateOff = true;
 13073 				this._refreshValue();
 13233 				this._refreshValue();
 13074 				this._change( null, 0 );
 13234 				this._change( null, 0 );
 13080 				for ( i = 0; i < valsLength; i += 1 ) {
 13240 				for ( i = 0; i < valsLength; i += 1 ) {
 13081 					this._change( null, i );
 13241 					this._change( null, i );
 13082 				}
 13242 				}
 13083 				this._animateOff = false;
 13243 				this._animateOff = false;
 13084 				break;
 13244 				break;
       
 13245 			case "step":
 13085 			case "min":
 13246 			case "min":
 13086 			case "max":
 13247 			case "max":
 13087 				this._animateOff = true;
 13248 				this._animateOff = true;
       
 13249 				this._calculateNewMax();
 13088 				this._refreshValue();
 13250 				this._refreshValue();
 13089 				this._animateOff = false;
 13251 				this._animateOff = false;
 13090 				break;
 13252 				break;
 13091 			case "range":
 13253 			case "range":
 13092 				this._animateOff = true;
 13254 				this._animateOff = true;
 13120 			return val;
 13282 			return val;
 13121 		} else if ( this.options.values && this.options.values.length ) {
 13283 		} else if ( this.options.values && this.options.values.length ) {
 13122 			// .slice() creates a copy of the array
 13284 			// .slice() creates a copy of the array
 13123 			// this copy gets trimmed by min and max and then returned
 13285 			// this copy gets trimmed by min and max and then returned
 13124 			vals = this.options.values.slice();
 13286 			vals = this.options.values.slice();
 13125 			for ( i = 0; i < vals.length; i+= 1) {
 13287 			for ( i = 0; i < vals.length; i += 1) {
 13126 				vals[ i ] = this._trimAlignValue( vals[ i ] );
 13288 				vals[ i ] = this._trimAlignValue( vals[ i ] );
 13127 			}
 13289 			}
 13128 
 13290 
 13129 			return vals;
 13291 			return vals;
 13130 		} else {
 13292 		} else {
 13151 		// Since JavaScript has problems with large floats, round
 13313 		// Since JavaScript has problems with large floats, round
 13152 		// the final value to 5 digits after the decimal point (see #4124)
 13314 		// the final value to 5 digits after the decimal point (see #4124)
 13153 		return parseFloat( alignValue.toFixed(5) );
 13315 		return parseFloat( alignValue.toFixed(5) );
 13154 	},
 13316 	},
 13155 
 13317 
       
 13318 	_calculateNewMax: function() {
       
 13319 		var max = this.options.max,
       
 13320 			min = this._valueMin(),
       
 13321 			step = this.options.step,
       
 13322 			aboveMin = Math.floor( ( +( max - min ).toFixed( this._precision() ) ) / step ) * step;
       
 13323 		max = aboveMin + min;
       
 13324 		this.max = parseFloat( max.toFixed( this._precision() ) );
       
 13325 	},
       
 13326 
       
 13327 	_precision: function() {
       
 13328 		var precision = this._precisionOf( this.options.step );
       
 13329 		if ( this.options.min !== null ) {
       
 13330 			precision = Math.max( precision, this._precisionOf( this.options.min ) );
       
 13331 		}
       
 13332 		return precision;
       
 13333 	},
       
 13334 
       
 13335 	_precisionOf: function( num ) {
       
 13336 		var str = num.toString(),
       
 13337 			decimal = str.indexOf( "." );
       
 13338 		return decimal === -1 ? 0 : str.length - decimal - 1;
       
 13339 	},
       
 13340 
 13156 	_valueMin: function() {
 13341 	_valueMin: function() {
 13157 		return this.options.min;
 13342 		return this.options.min;
 13158 	},
 13343 	},
 13159 
 13344 
 13160 	_valueMax: function() {
 13345 	_valueMax: function() {
 13161 		return this.options.max;
 13346 		return this.max;
 13162 	},
 13347 	},
 13163 
 13348 
 13164 	_refreshValue: function() {
 13349 	_refreshValue: function() {
 13165 		var lastValPercent, valPercent, value, valueMin, valueMax,
 13350 		var lastValPercent, valPercent, value, valueMin, valueMax,
 13166 			oRange = this.options.range,
 13351 			oRange = this.options.range,
 13218 		}
 13403 		}
 13219 	},
 13404 	},
 13220 
 13405 
 13221 	_handleEvents: {
 13406 	_handleEvents: {
 13222 		keydown: function( event ) {
 13407 		keydown: function( event ) {
 13223 			/*jshint maxcomplexity:25*/
       
 13224 			var allowed, curVal, newVal, step,
 13408 			var allowed, curVal, newVal, step,
 13225 				index = $( event.target ).data( "ui-slider-handle-index" );
 13409 				index = $( event.target ).data( "ui-slider-handle-index" );
 13226 
 13410 
 13227 			switch ( event.keyCode ) {
 13411 			switch ( event.keyCode ) {
 13228 				case $.ui.keyCode.HOME:
 13412 				case $.ui.keyCode.HOME:
 13258 					break;
 13442 					break;
 13259 				case $.ui.keyCode.END:
 13443 				case $.ui.keyCode.END:
 13260 					newVal = this._valueMax();
 13444 					newVal = this._valueMax();
 13261 					break;
 13445 					break;
 13262 				case $.ui.keyCode.PAGE_UP:
 13446 				case $.ui.keyCode.PAGE_UP:
 13263 					newVal = this._trimAlignValue( curVal + ( (this._valueMax() - this._valueMin()) / numPages ) );
 13447 					newVal = this._trimAlignValue(
       
 13448 						curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
       
 13449 					);
 13264 					break;
 13450 					break;
 13265 				case $.ui.keyCode.PAGE_DOWN:
 13451 				case $.ui.keyCode.PAGE_DOWN:
 13266 					newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) );
 13452 					newVal = this._trimAlignValue(
       
 13453 						curVal - ( (this._valueMax() - this._valueMin()) / this.numPages ) );
 13267 					break;
 13454 					break;
 13268 				case $.ui.keyCode.UP:
 13455 				case $.ui.keyCode.UP:
 13269 				case $.ui.keyCode.RIGHT:
 13456 				case $.ui.keyCode.RIGHT:
 13270 					if ( curVal === this._valueMax() ) {
 13457 					if ( curVal === this._valueMax() ) {
 13271 						return;
 13458 						return;
 13281 					break;
 13468 					break;
 13282 			}
 13469 			}
 13283 
 13470 
 13284 			this._slide( event, index, newVal );
 13471 			this._slide( event, index, newVal );
 13285 		},
 13472 		},
 13286 		click: function( event ) {
       
 13287 			event.preventDefault();
       
 13288 		},
       
 13289 		keyup: function( event ) {
 13473 		keyup: function( event ) {
 13290 			var index = $( event.target ).data( "ui-slider-handle-index" );
 13474 			var index = $( event.target ).data( "ui-slider-handle-index" );
 13291 
 13475 
 13292 			if ( this._keySliding ) {
 13476 			if ( this._keySliding ) {
 13293 				this._keySliding = false;
 13477 				this._keySliding = false;
 13295 				this._change( event, index );
 13479 				this._change( event, index );
 13296 				$( event.target ).removeClass( "ui-state-active" );
 13480 				$( event.target ).removeClass( "ui-state-active" );
 13297 			}
 13481 			}
 13298 		}
 13482 		}
 13299 	}
 13483 	}
 13300 
       
 13301 });
 13484 });
 13302 
 13485 
 13303 }(jQuery));
 13486 
 13304 
 13487 /*!
 13305 (function( $ ) {
 13488  * jQuery UI Sortable 1.11.4
 13306 
 13489  * http://jqueryui.com
 13307 function modifier( fn ) {
 13490  *
       
 13491  * Copyright jQuery Foundation and other contributors
       
 13492  * Released under the MIT license.
       
 13493  * http://jquery.org/license
       
 13494  *
       
 13495  * http://api.jqueryui.com/sortable/
       
 13496  */
       
 13497 
       
 13498 
       
 13499 var sortable = $.widget("ui.sortable", $.ui.mouse, {
       
 13500 	version: "1.11.4",
       
 13501 	widgetEventPrefix: "sort",
       
 13502 	ready: false,
       
 13503 	options: {
       
 13504 		appendTo: "parent",
       
 13505 		axis: false,
       
 13506 		connectWith: false,
       
 13507 		containment: false,
       
 13508 		cursor: "auto",
       
 13509 		cursorAt: false,
       
 13510 		dropOnEmpty: true,
       
 13511 		forcePlaceholderSize: false,
       
 13512 		forceHelperSize: false,
       
 13513 		grid: false,
       
 13514 		handle: false,
       
 13515 		helper: "original",
       
 13516 		items: "> *",
       
 13517 		opacity: false,
       
 13518 		placeholder: false,
       
 13519 		revert: false,
       
 13520 		scroll: true,
       
 13521 		scrollSensitivity: 20,
       
 13522 		scrollSpeed: 20,
       
 13523 		scope: "default",
       
 13524 		tolerance: "intersect",
       
 13525 		zIndex: 1000,
       
 13526 
       
 13527 		// callbacks
       
 13528 		activate: null,
       
 13529 		beforeStop: null,
       
 13530 		change: null,
       
 13531 		deactivate: null,
       
 13532 		out: null,
       
 13533 		over: null,
       
 13534 		receive: null,
       
 13535 		remove: null,
       
 13536 		sort: null,
       
 13537 		start: null,
       
 13538 		stop: null,
       
 13539 		update: null
       
 13540 	},
       
 13541 
       
 13542 	_isOverAxis: function( x, reference, size ) {
       
 13543 		return ( x >= reference ) && ( x < ( reference + size ) );
       
 13544 	},
       
 13545 
       
 13546 	_isFloating: function( item ) {
       
 13547 		return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
       
 13548 	},
       
 13549 
       
 13550 	_create: function() {
       
 13551 		this.containerCache = {};
       
 13552 		this.element.addClass("ui-sortable");
       
 13553 
       
 13554 		//Get the items
       
 13555 		this.refresh();
       
 13556 
       
 13557 		//Let's determine the parent's offset
       
 13558 		this.offset = this.element.offset();
       
 13559 
       
 13560 		//Initialize mouse events for interaction
       
 13561 		this._mouseInit();
       
 13562 
       
 13563 		this._setHandleClassName();
       
 13564 
       
 13565 		//We're ready to go
       
 13566 		this.ready = true;
       
 13567 
       
 13568 	},
       
 13569 
       
 13570 	_setOption: function( key, value ) {
       
 13571 		this._super( key, value );
       
 13572 
       
 13573 		if ( key === "handle" ) {
       
 13574 			this._setHandleClassName();
       
 13575 		}
       
 13576 	},
       
 13577 
       
 13578 	_setHandleClassName: function() {
       
 13579 		this.element.find( ".ui-sortable-handle" ).removeClass( "ui-sortable-handle" );
       
 13580 		$.each( this.items, function() {
       
 13581 			( this.instance.options.handle ?
       
 13582 				this.item.find( this.instance.options.handle ) : this.item )
       
 13583 				.addClass( "ui-sortable-handle" );
       
 13584 		});
       
 13585 	},
       
 13586 
       
 13587 	_destroy: function() {
       
 13588 		this.element
       
 13589 			.removeClass( "ui-sortable ui-sortable-disabled" )
       
 13590 			.find( ".ui-sortable-handle" )
       
 13591 				.removeClass( "ui-sortable-handle" );
       
 13592 		this._mouseDestroy();
       
 13593 
       
 13594 		for ( var i = this.items.length - 1; i >= 0; i-- ) {
       
 13595 			this.items[i].item.removeData(this.widgetName + "-item");
       
 13596 		}
       
 13597 
       
 13598 		return this;
       
 13599 	},
       
 13600 
       
 13601 	_mouseCapture: function(event, overrideHandle) {
       
 13602 		var currentItem = null,
       
 13603 			validHandle = false,
       
 13604 			that = this;
       
 13605 
       
 13606 		if (this.reverting) {
       
 13607 			return false;
       
 13608 		}
       
 13609 
       
 13610 		if(this.options.disabled || this.options.type === "static") {
       
 13611 			return false;
       
 13612 		}
       
 13613 
       
 13614 		//We have to refresh the items data once first
       
 13615 		this._refreshItems(event);
       
 13616 
       
 13617 		//Find out if the clicked node (or one of its parents) is a actual item in this.items
       
 13618 		$(event.target).parents().each(function() {
       
 13619 			if($.data(this, that.widgetName + "-item") === that) {
       
 13620 				currentItem = $(this);
       
 13621 				return false;
       
 13622 			}
       
 13623 		});
       
 13624 		if($.data(event.target, that.widgetName + "-item") === that) {
       
 13625 			currentItem = $(event.target);
       
 13626 		}
       
 13627 
       
 13628 		if(!currentItem) {
       
 13629 			return false;
       
 13630 		}
       
 13631 		if(this.options.handle && !overrideHandle) {
       
 13632 			$(this.options.handle, currentItem).find("*").addBack().each(function() {
       
 13633 				if(this === event.target) {
       
 13634 					validHandle = true;
       
 13635 				}
       
 13636 			});
       
 13637 			if(!validHandle) {
       
 13638 				return false;
       
 13639 			}
       
 13640 		}
       
 13641 
       
 13642 		this.currentItem = currentItem;
       
 13643 		this._removeCurrentsFromItems();
       
 13644 		return true;
       
 13645 
       
 13646 	},
       
 13647 
       
 13648 	_mouseStart: function(event, overrideHandle, noActivation) {
       
 13649 
       
 13650 		var i, body,
       
 13651 			o = this.options;
       
 13652 
       
 13653 		this.currentContainer = this;
       
 13654 
       
 13655 		//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
       
 13656 		this.refreshPositions();
       
 13657 
       
 13658 		//Create and append the visible helper
       
 13659 		this.helper = this._createHelper(event);
       
 13660 
       
 13661 		//Cache the helper size
       
 13662 		this._cacheHelperProportions();
       
 13663 
       
 13664 		/*
       
 13665 		 * - Position generation -
       
 13666 		 * This block generates everything position related - it's the core of draggables.
       
 13667 		 */
       
 13668 
       
 13669 		//Cache the margins of the original element
       
 13670 		this._cacheMargins();
       
 13671 
       
 13672 		//Get the next scrolling parent
       
 13673 		this.scrollParent = this.helper.scrollParent();
       
 13674 
       
 13675 		//The element's absolute position on the page minus margins
       
 13676 		this.offset = this.currentItem.offset();
       
 13677 		this.offset = {
       
 13678 			top: this.offset.top - this.margins.top,
       
 13679 			left: this.offset.left - this.margins.left
       
 13680 		};
       
 13681 
       
 13682 		$.extend(this.offset, {
       
 13683 			click: { //Where the click happened, relative to the element
       
 13684 				left: event.pageX - this.offset.left,
       
 13685 				top: event.pageY - this.offset.top
       
 13686 			},
       
 13687 			parent: this._getParentOffset(),
       
 13688 			relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
       
 13689 		});
       
 13690 
       
 13691 		// Only after we got the offset, we can change the helper's position to absolute
       
 13692 		// TODO: Still need to figure out a way to make relative sorting possible
       
 13693 		this.helper.css("position", "absolute");
       
 13694 		this.cssPosition = this.helper.css("position");
       
 13695 
       
 13696 		//Generate the original position
       
 13697 		this.originalPosition = this._generatePosition(event);
       
 13698 		this.originalPageX = event.pageX;
       
 13699 		this.originalPageY = event.pageY;
       
 13700 
       
 13701 		//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
       
 13702 		(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
       
 13703 
       
 13704 		//Cache the former DOM position
       
 13705 		this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
       
 13706 
       
 13707 		//If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
       
 13708 		if(this.helper[0] !== this.currentItem[0]) {
       
 13709 			this.currentItem.hide();
       
 13710 		}
       
 13711 
       
 13712 		//Create the placeholder
       
 13713 		this._createPlaceholder();
       
 13714 
       
 13715 		//Set a containment if given in the options
       
 13716 		if(o.containment) {
       
 13717 			this._setContainment();
       
 13718 		}
       
 13719 
       
 13720 		if( o.cursor && o.cursor !== "auto" ) { // cursor option
       
 13721 			body = this.document.find( "body" );
       
 13722 
       
 13723 			// support: IE
       
 13724 			this.storedCursor = body.css( "cursor" );
       
 13725 			body.css( "cursor", o.cursor );
       
 13726 
       
 13727 			this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
       
 13728 		}
       
 13729 
       
 13730 		if(o.opacity) { // opacity option
       
 13731 			if (this.helper.css("opacity")) {
       
 13732 				this._storedOpacity = this.helper.css("opacity");
       
 13733 			}
       
 13734 			this.helper.css("opacity", o.opacity);
       
 13735 		}
       
 13736 
       
 13737 		if(o.zIndex) { // zIndex option
       
 13738 			if (this.helper.css("zIndex")) {
       
 13739 				this._storedZIndex = this.helper.css("zIndex");
       
 13740 			}
       
 13741 			this.helper.css("zIndex", o.zIndex);
       
 13742 		}
       
 13743 
       
 13744 		//Prepare scrolling
       
 13745 		if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
       
 13746 			this.overflowOffset = this.scrollParent.offset();
       
 13747 		}
       
 13748 
       
 13749 		//Call callbacks
       
 13750 		this._trigger("start", event, this._uiHash());
       
 13751 
       
 13752 		//Recache the helper size
       
 13753 		if(!this._preserveHelperProportions) {
       
 13754 			this._cacheHelperProportions();
       
 13755 		}
       
 13756 
       
 13757 
       
 13758 		//Post "activate" events to possible containers
       
 13759 		if( !noActivation ) {
       
 13760 			for ( i = this.containers.length - 1; i >= 0; i-- ) {
       
 13761 				this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
       
 13762 			}
       
 13763 		}
       
 13764 
       
 13765 		//Prepare possible droppables
       
 13766 		if($.ui.ddmanager) {
       
 13767 			$.ui.ddmanager.current = this;
       
 13768 		}
       
 13769 
       
 13770 		if ($.ui.ddmanager && !o.dropBehaviour) {
       
 13771 			$.ui.ddmanager.prepareOffsets(this, event);
       
 13772 		}
       
 13773 
       
 13774 		this.dragging = true;
       
 13775 
       
 13776 		this.helper.addClass("ui-sortable-helper");
       
 13777 		this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
       
 13778 		return true;
       
 13779 
       
 13780 	},
       
 13781 
       
 13782 	_mouseDrag: function(event) {
       
 13783 		var i, item, itemElement, intersection,
       
 13784 			o = this.options,
       
 13785 			scrolled = false;
       
 13786 
       
 13787 		//Compute the helpers position
       
 13788 		this.position = this._generatePosition(event);
       
 13789 		this.positionAbs = this._convertPositionTo("absolute");
       
 13790 
       
 13791 		if (!this.lastPositionAbs) {
       
 13792 			this.lastPositionAbs = this.positionAbs;
       
 13793 		}
       
 13794 
       
 13795 		//Do scrolling
       
 13796 		if(this.options.scroll) {
       
 13797 			if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
       
 13798 
       
 13799 				if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
       
 13800 					this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
       
 13801 				} else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
       
 13802 					this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
       
 13803 				}
       
 13804 
       
 13805 				if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
       
 13806 					this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
       
 13807 				} else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
       
 13808 					this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
       
 13809 				}
       
 13810 
       
 13811 			} else {
       
 13812 
       
 13813 				if(event.pageY - this.document.scrollTop() < o.scrollSensitivity) {
       
 13814 					scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
       
 13815 				} else if(this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {
       
 13816 					scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
       
 13817 				}
       
 13818 
       
 13819 				if(event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {
       
 13820 					scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);
       
 13821 				} else if(this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {
       
 13822 					scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);
       
 13823 				}
       
 13824 
       
 13825 			}
       
 13826 
       
 13827 			if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
       
 13828 				$.ui.ddmanager.prepareOffsets(this, event);
       
 13829 			}
       
 13830 		}
       
 13831 
       
 13832 		//Regenerate the absolute position used for position checks
       
 13833 		this.positionAbs = this._convertPositionTo("absolute");
       
 13834 
       
 13835 		//Set the helper position
       
 13836 		if(!this.options.axis || this.options.axis !== "y") {
       
 13837 			this.helper[0].style.left = this.position.left+"px";
       
 13838 		}
       
 13839 		if(!this.options.axis || this.options.axis !== "x") {
       
 13840 			this.helper[0].style.top = this.position.top+"px";
       
 13841 		}
       
 13842 
       
 13843 		//Rearrange
       
 13844 		for (i = this.items.length - 1; i >= 0; i--) {
       
 13845 
       
 13846 			//Cache variables and intersection, continue if no intersection
       
 13847 			item = this.items[i];
       
 13848 			itemElement = item.item[0];
       
 13849 			intersection = this._intersectsWithPointer(item);
       
 13850 			if (!intersection) {
       
 13851 				continue;
       
 13852 			}
       
 13853 
       
 13854 			// Only put the placeholder inside the current Container, skip all
       
 13855 			// items from other containers. This works because when moving
       
 13856 			// an item from one container to another the
       
 13857 			// currentContainer is switched before the placeholder is moved.
       
 13858 			//
       
 13859 			// Without this, moving items in "sub-sortables" can cause
       
 13860 			// the placeholder to jitter between the outer and inner container.
       
 13861 			if (item.instance !== this.currentContainer) {
       
 13862 				continue;
       
 13863 			}
       
 13864 
       
 13865 			// cannot intersect with itself
       
 13866 			// no useless actions that have been done before
       
 13867 			// no action if the item moved is the parent of the item checked
       
 13868 			if (itemElement !== this.currentItem[0] &&
       
 13869 				this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
       
 13870 				!$.contains(this.placeholder[0], itemElement) &&
       
 13871 				(this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
       
 13872 			) {
       
 13873 
       
 13874 				this.direction = intersection === 1 ? "down" : "up";
       
 13875 
       
 13876 				if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
       
 13877 					this._rearrange(event, item);
       
 13878 				} else {
       
 13879 					break;
       
 13880 				}
       
 13881 
       
 13882 				this._trigger("change", event, this._uiHash());
       
 13883 				break;
       
 13884 			}
       
 13885 		}
       
 13886 
       
 13887 		//Post events to containers
       
 13888 		this._contactContainers(event);
       
 13889 
       
 13890 		//Interconnect with droppables
       
 13891 		if($.ui.ddmanager) {
       
 13892 			$.ui.ddmanager.drag(this, event);
       
 13893 		}
       
 13894 
       
 13895 		//Call callbacks
       
 13896 		this._trigger("sort", event, this._uiHash());
       
 13897 
       
 13898 		this.lastPositionAbs = this.positionAbs;
       
 13899 		return false;
       
 13900 
       
 13901 	},
       
 13902 
       
 13903 	_mouseStop: function(event, noPropagation) {
       
 13904 
       
 13905 		if(!event) {
       
 13906 			return;
       
 13907 		}
       
 13908 
       
 13909 		//If we are using droppables, inform the manager about the drop
       
 13910 		if ($.ui.ddmanager && !this.options.dropBehaviour) {
       
 13911 			$.ui.ddmanager.drop(this, event);
       
 13912 		}
       
 13913 
       
 13914 		if(this.options.revert) {
       
 13915 			var that = this,
       
 13916 				cur = this.placeholder.offset(),
       
 13917 				axis = this.options.axis,
       
 13918 				animation = {};
       
 13919 
       
 13920 			if ( !axis || axis === "x" ) {
       
 13921 				animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft);
       
 13922 			}
       
 13923 			if ( !axis || axis === "y" ) {
       
 13924 				animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop);
       
 13925 			}
       
 13926 			this.reverting = true;
       
 13927 			$(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
       
 13928 				that._clear(event);
       
 13929 			});
       
 13930 		} else {
       
 13931 			this._clear(event, noPropagation);
       
 13932 		}
       
 13933 
       
 13934 		return false;
       
 13935 
       
 13936 	},
       
 13937 
       
 13938 	cancel: function() {
       
 13939 
       
 13940 		if(this.dragging) {
       
 13941 
       
 13942 			this._mouseUp({ target: null });
       
 13943 
       
 13944 			if(this.options.helper === "original") {
       
 13945 				this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
       
 13946 			} else {
       
 13947 				this.currentItem.show();
       
 13948 			}
       
 13949 
       
 13950 			//Post deactivating events to containers
       
 13951 			for (var i = this.containers.length - 1; i >= 0; i--){
       
 13952 				this.containers[i]._trigger("deactivate", null, this._uiHash(this));
       
 13953 				if(this.containers[i].containerCache.over) {
       
 13954 					this.containers[i]._trigger("out", null, this._uiHash(this));
       
 13955 					this.containers[i].containerCache.over = 0;
       
 13956 				}
       
 13957 			}
       
 13958 
       
 13959 		}
       
 13960 
       
 13961 		if (this.placeholder) {
       
 13962 			//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
       
 13963 			if(this.placeholder[0].parentNode) {
       
 13964 				this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
       
 13965 			}
       
 13966 			if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
       
 13967 				this.helper.remove();
       
 13968 			}
       
 13969 
       
 13970 			$.extend(this, {
       
 13971 				helper: null,
       
 13972 				dragging: false,
       
 13973 				reverting: false,
       
 13974 				_noFinalSort: null
       
 13975 			});
       
 13976 
       
 13977 			if(this.domPosition.prev) {
       
 13978 				$(this.domPosition.prev).after(this.currentItem);
       
 13979 			} else {
       
 13980 				$(this.domPosition.parent).prepend(this.currentItem);
       
 13981 			}
       
 13982 		}
       
 13983 
       
 13984 		return this;
       
 13985 
       
 13986 	},
       
 13987 
       
 13988 	serialize: function(o) {
       
 13989 
       
 13990 		var items = this._getItemsAsjQuery(o && o.connected),
       
 13991 			str = [];
       
 13992 		o = o || {};
       
 13993 
       
 13994 		$(items).each(function() {
       
 13995 			var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
       
 13996 			if (res) {
       
 13997 				str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2]));
       
 13998 			}
       
 13999 		});
       
 14000 
       
 14001 		if(!str.length && o.key) {
       
 14002 			str.push(o.key + "=");
       
 14003 		}
       
 14004 
       
 14005 		return str.join("&");
       
 14006 
       
 14007 	},
       
 14008 
       
 14009 	toArray: function(o) {
       
 14010 
       
 14011 		var items = this._getItemsAsjQuery(o && o.connected),
       
 14012 			ret = [];
       
 14013 
       
 14014 		o = o || {};
       
 14015 
       
 14016 		items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
       
 14017 		return ret;
       
 14018 
       
 14019 	},
       
 14020 
       
 14021 	/* Be careful with the following core functions */
       
 14022 	_intersectsWith: function(item) {
       
 14023 
       
 14024 		var x1 = this.positionAbs.left,
       
 14025 			x2 = x1 + this.helperProportions.width,
       
 14026 			y1 = this.positionAbs.top,
       
 14027 			y2 = y1 + this.helperProportions.height,
       
 14028 			l = item.left,
       
 14029 			r = l + item.width,
       
 14030 			t = item.top,
       
 14031 			b = t + item.height,
       
 14032 			dyClick = this.offset.click.top,
       
 14033 			dxClick = this.offset.click.left,
       
 14034 			isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
       
 14035 			isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
       
 14036 			isOverElement = isOverElementHeight && isOverElementWidth;
       
 14037 
       
 14038 		if ( this.options.tolerance === "pointer" ||
       
 14039 			this.options.forcePointerForContainers ||
       
 14040 			(this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
       
 14041 		) {
       
 14042 			return isOverElement;
       
 14043 		} else {
       
 14044 
       
 14045 			return (l < x1 + (this.helperProportions.width / 2) && // Right Half
       
 14046 				x2 - (this.helperProportions.width / 2) < r && // Left Half
       
 14047 				t < y1 + (this.helperProportions.height / 2) && // Bottom Half
       
 14048 				y2 - (this.helperProportions.height / 2) < b ); // Top Half
       
 14049 
       
 14050 		}
       
 14051 	},
       
 14052 
       
 14053 	_intersectsWithPointer: function(item) {
       
 14054 
       
 14055 		var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
       
 14056 			isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
       
 14057 			isOverElement = isOverElementHeight && isOverElementWidth,
       
 14058 			verticalDirection = this._getDragVerticalDirection(),
       
 14059 			horizontalDirection = this._getDragHorizontalDirection();
       
 14060 
       
 14061 		if (!isOverElement) {
       
 14062 			return false;
       
 14063 		}
       
 14064 
       
 14065 		return this.floating ?
       
 14066 			( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
       
 14067 			: ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
       
 14068 
       
 14069 	},
       
 14070 
       
 14071 	_intersectsWithSides: function(item) {
       
 14072 
       
 14073 		var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
       
 14074 			isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
       
 14075 			verticalDirection = this._getDragVerticalDirection(),
       
 14076 			horizontalDirection = this._getDragHorizontalDirection();
       
 14077 
       
 14078 		if (this.floating && horizontalDirection) {
       
 14079 			return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
       
 14080 		} else {
       
 14081 			return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
       
 14082 		}
       
 14083 
       
 14084 	},
       
 14085 
       
 14086 	_getDragVerticalDirection: function() {
       
 14087 		var delta = this.positionAbs.top - this.lastPositionAbs.top;
       
 14088 		return delta !== 0 && (delta > 0 ? "down" : "up");
       
 14089 	},
       
 14090 
       
 14091 	_getDragHorizontalDirection: function() {
       
 14092 		var delta = this.positionAbs.left - this.lastPositionAbs.left;
       
 14093 		return delta !== 0 && (delta > 0 ? "right" : "left");
       
 14094 	},
       
 14095 
       
 14096 	refresh: function(event) {
       
 14097 		this._refreshItems(event);
       
 14098 		this._setHandleClassName();
       
 14099 		this.refreshPositions();
       
 14100 		return this;
       
 14101 	},
       
 14102 
       
 14103 	_connectWith: function() {
       
 14104 		var options = this.options;
       
 14105 		return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
       
 14106 	},
       
 14107 
       
 14108 	_getItemsAsjQuery: function(connected) {
       
 14109 
       
 14110 		var i, j, cur, inst,
       
 14111 			items = [],
       
 14112 			queries = [],
       
 14113 			connectWith = this._connectWith();
       
 14114 
       
 14115 		if(connectWith && connected) {
       
 14116 			for (i = connectWith.length - 1; i >= 0; i--){
       
 14117 				cur = $(connectWith[i], this.document[0]);
       
 14118 				for ( j = cur.length - 1; j >= 0; j--){
       
 14119 					inst = $.data(cur[j], this.widgetFullName);
       
 14120 					if(inst && inst !== this && !inst.options.disabled) {
       
 14121 						queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
       
 14122 					}
       
 14123 				}
       
 14124 			}
       
 14125 		}
       
 14126 
       
 14127 		queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
       
 14128 
       
 14129 		function addItems() {
       
 14130 			items.push( this );
       
 14131 		}
       
 14132 		for (i = queries.length - 1; i >= 0; i--){
       
 14133 			queries[i][0].each( addItems );
       
 14134 		}
       
 14135 
       
 14136 		return $(items);
       
 14137 
       
 14138 	},
       
 14139 
       
 14140 	_removeCurrentsFromItems: function() {
       
 14141 
       
 14142 		var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
       
 14143 
       
 14144 		this.items = $.grep(this.items, function (item) {
       
 14145 			for (var j=0; j < list.length; j++) {
       
 14146 				if(list[j] === item.item[0]) {
       
 14147 					return false;
       
 14148 				}
       
 14149 			}
       
 14150 			return true;
       
 14151 		});
       
 14152 
       
 14153 	},
       
 14154 
       
 14155 	_refreshItems: function(event) {
       
 14156 
       
 14157 		this.items = [];
       
 14158 		this.containers = [this];
       
 14159 
       
 14160 		var i, j, cur, inst, targetData, _queries, item, queriesLength,
       
 14161 			items = this.items,
       
 14162 			queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
       
 14163 			connectWith = this._connectWith();
       
 14164 
       
 14165 		if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
       
 14166 			for (i = connectWith.length - 1; i >= 0; i--){
       
 14167 				cur = $(connectWith[i], this.document[0]);
       
 14168 				for (j = cur.length - 1; j >= 0; j--){
       
 14169 					inst = $.data(cur[j], this.widgetFullName);
       
 14170 					if(inst && inst !== this && !inst.options.disabled) {
       
 14171 						queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
       
 14172 						this.containers.push(inst);
       
 14173 					}
       
 14174 				}
       
 14175 			}
       
 14176 		}
       
 14177 
       
 14178 		for (i = queries.length - 1; i >= 0; i--) {
       
 14179 			targetData = queries[i][1];
       
 14180 			_queries = queries[i][0];
       
 14181 
       
 14182 			for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
       
 14183 				item = $(_queries[j]);
       
 14184 
       
 14185 				item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
       
 14186 
       
 14187 				items.push({
       
 14188 					item: item,
       
 14189 					instance: targetData,
       
 14190 					width: 0, height: 0,
       
 14191 					left: 0, top: 0
       
 14192 				});
       
 14193 			}
       
 14194 		}
       
 14195 
       
 14196 	},
       
 14197 
       
 14198 	refreshPositions: function(fast) {
       
 14199 
       
 14200 		// Determine whether items are being displayed horizontally
       
 14201 		this.floating = this.items.length ?
       
 14202 			this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
       
 14203 			false;
       
 14204 
       
 14205 		//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
       
 14206 		if(this.offsetParent && this.helper) {
       
 14207 			this.offset.parent = this._getParentOffset();
       
 14208 		}
       
 14209 
       
 14210 		var i, item, t, p;
       
 14211 
       
 14212 		for (i = this.items.length - 1; i >= 0; i--){
       
 14213 			item = this.items[i];
       
 14214 
       
 14215 			//We ignore calculating positions of all connected containers when we're not over them
       
 14216 			if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
       
 14217 				continue;
       
 14218 			}
       
 14219 
       
 14220 			t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
       
 14221 
       
 14222 			if (!fast) {
       
 14223 				item.width = t.outerWidth();
       
 14224 				item.height = t.outerHeight();
       
 14225 			}
       
 14226 
       
 14227 			p = t.offset();
       
 14228 			item.left = p.left;
       
 14229 			item.top = p.top;
       
 14230 		}
       
 14231 
       
 14232 		if(this.options.custom && this.options.custom.refreshContainers) {
       
 14233 			this.options.custom.refreshContainers.call(this);
       
 14234 		} else {
       
 14235 			for (i = this.containers.length - 1; i >= 0; i--){
       
 14236 				p = this.containers[i].element.offset();
       
 14237 				this.containers[i].containerCache.left = p.left;
       
 14238 				this.containers[i].containerCache.top = p.top;
       
 14239 				this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
       
 14240 				this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
       
 14241 			}
       
 14242 		}
       
 14243 
       
 14244 		return this;
       
 14245 	},
       
 14246 
       
 14247 	_createPlaceholder: function(that) {
       
 14248 		that = that || this;
       
 14249 		var className,
       
 14250 			o = that.options;
       
 14251 
       
 14252 		if(!o.placeholder || o.placeholder.constructor === String) {
       
 14253 			className = o.placeholder;
       
 14254 			o.placeholder = {
       
 14255 				element: function() {
       
 14256 
       
 14257 					var nodeName = that.currentItem[0].nodeName.toLowerCase(),
       
 14258 						element = $( "<" + nodeName + ">", that.document[0] )
       
 14259 							.addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
       
 14260 							.removeClass("ui-sortable-helper");
       
 14261 
       
 14262 					if ( nodeName === "tbody" ) {
       
 14263 						that._createTrPlaceholder(
       
 14264 							that.currentItem.find( "tr" ).eq( 0 ),
       
 14265 							$( "<tr>", that.document[ 0 ] ).appendTo( element )
       
 14266 						);
       
 14267 					} else if ( nodeName === "tr" ) {
       
 14268 						that._createTrPlaceholder( that.currentItem, element );
       
 14269 					} else if ( nodeName === "img" ) {
       
 14270 						element.attr( "src", that.currentItem.attr( "src" ) );
       
 14271 					}
       
 14272 
       
 14273 					if ( !className ) {
       
 14274 						element.css( "visibility", "hidden" );
       
 14275 					}
       
 14276 
       
 14277 					return element;
       
 14278 				},
       
 14279 				update: function(container, p) {
       
 14280 
       
 14281 					// 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
       
 14282 					// 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
       
 14283 					if(className && !o.forcePlaceholderSize) {
       
 14284 						return;
       
 14285 					}
       
 14286 
       
 14287 					//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
       
 14288 					if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
       
 14289 					if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
       
 14290 				}
       
 14291 			};
       
 14292 		}
       
 14293 
       
 14294 		//Create the placeholder
       
 14295 		that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
       
 14296 
       
 14297 		//Append it after the actual current item
       
 14298 		that.currentItem.after(that.placeholder);
       
 14299 
       
 14300 		//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
       
 14301 		o.placeholder.update(that, that.placeholder);
       
 14302 
       
 14303 	},
       
 14304 
       
 14305 	_createTrPlaceholder: function( sourceTr, targetTr ) {
       
 14306 		var that = this;
       
 14307 
       
 14308 		sourceTr.children().each(function() {
       
 14309 			$( "<td>&#160;</td>", that.document[ 0 ] )
       
 14310 				.attr( "colspan", $( this ).attr( "colspan" ) || 1 )
       
 14311 				.appendTo( targetTr );
       
 14312 		});
       
 14313 	},
       
 14314 
       
 14315 	_contactContainers: function(event) {
       
 14316 		var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
       
 14317 			innermostContainer = null,
       
 14318 			innermostIndex = null;
       
 14319 
       
 14320 		// get innermost container that intersects with item
       
 14321 		for (i = this.containers.length - 1; i >= 0; i--) {
       
 14322 
       
 14323 			// never consider a container that's located within the item itself
       
 14324 			if($.contains(this.currentItem[0], this.containers[i].element[0])) {
       
 14325 				continue;
       
 14326 			}
       
 14327 
       
 14328 			if(this._intersectsWith(this.containers[i].containerCache)) {
       
 14329 
       
 14330 				// if we've already found a container and it's more "inner" than this, then continue
       
 14331 				if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
       
 14332 					continue;
       
 14333 				}
       
 14334 
       
 14335 				innermostContainer = this.containers[i];
       
 14336 				innermostIndex = i;
       
 14337 
       
 14338 			} else {
       
 14339 				// container doesn't intersect. trigger "out" event if necessary
       
 14340 				if(this.containers[i].containerCache.over) {
       
 14341 					this.containers[i]._trigger("out", event, this._uiHash(this));
       
 14342 					this.containers[i].containerCache.over = 0;
       
 14343 				}
       
 14344 			}
       
 14345 
       
 14346 		}
       
 14347 
       
 14348 		// if no intersecting containers found, return
       
 14349 		if(!innermostContainer) {
       
 14350 			return;
       
 14351 		}
       
 14352 
       
 14353 		// move the item into the container if it's not there already
       
 14354 		if(this.containers.length === 1) {
       
 14355 			if (!this.containers[innermostIndex].containerCache.over) {
       
 14356 				this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
       
 14357 				this.containers[innermostIndex].containerCache.over = 1;
       
 14358 			}
       
 14359 		} else {
       
 14360 
       
 14361 			//When entering a new container, we will find the item with the least distance and append our item near it
       
 14362 			dist = 10000;
       
 14363 			itemWithLeastDistance = null;
       
 14364 			floating = innermostContainer.floating || this._isFloating(this.currentItem);
       
 14365 			posProperty = floating ? "left" : "top";
       
 14366 			sizeProperty = floating ? "width" : "height";
       
 14367 			axis = floating ? "clientX" : "clientY";
       
 14368 
       
 14369 			for (j = this.items.length - 1; j >= 0; j--) {
       
 14370 				if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
       
 14371 					continue;
       
 14372 				}
       
 14373 				if(this.items[j].item[0] === this.currentItem[0]) {
       
 14374 					continue;
       
 14375 				}
       
 14376 
       
 14377 				cur = this.items[j].item.offset()[posProperty];
       
 14378 				nearBottom = false;
       
 14379 				if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
       
 14380 					nearBottom = true;
       
 14381 				}
       
 14382 
       
 14383 				if ( Math.abs( event[ axis ] - cur ) < dist ) {
       
 14384 					dist = Math.abs( event[ axis ] - cur );
       
 14385 					itemWithLeastDistance = this.items[ j ];
       
 14386 					this.direction = nearBottom ? "up": "down";
       
 14387 				}
       
 14388 			}
       
 14389 
       
 14390 			//Check if dropOnEmpty is enabled
       
 14391 			if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
       
 14392 				return;
       
 14393 			}
       
 14394 
       
 14395 			if(this.currentContainer === this.containers[innermostIndex]) {
       
 14396 				if ( !this.currentContainer.containerCache.over ) {
       
 14397 					this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
       
 14398 					this.currentContainer.containerCache.over = 1;
       
 14399 				}
       
 14400 				return;
       
 14401 			}
       
 14402 
       
 14403 			itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
       
 14404 			this._trigger("change", event, this._uiHash());
       
 14405 			this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
       
 14406 			this.currentContainer = this.containers[innermostIndex];
       
 14407 
       
 14408 			//Update the placeholder
       
 14409 			this.options.placeholder.update(this.currentContainer, this.placeholder);
       
 14410 
       
 14411 			this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
       
 14412 			this.containers[innermostIndex].containerCache.over = 1;
       
 14413 		}
       
 14414 
       
 14415 
       
 14416 	},
       
 14417 
       
 14418 	_createHelper: function(event) {
       
 14419 
       
 14420 		var o = this.options,
       
 14421 			helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
       
 14422 
       
 14423 		//Add the helper to the DOM if that didn't happen already
       
 14424 		if(!helper.parents("body").length) {
       
 14425 			$(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
       
 14426 		}
       
 14427 
       
 14428 		if(helper[0] === this.currentItem[0]) {
       
 14429 			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") };
       
 14430 		}
       
 14431 
       
 14432 		if(!helper[0].style.width || o.forceHelperSize) {
       
 14433 			helper.width(this.currentItem.width());
       
 14434 		}
       
 14435 		if(!helper[0].style.height || o.forceHelperSize) {
       
 14436 			helper.height(this.currentItem.height());
       
 14437 		}
       
 14438 
       
 14439 		return helper;
       
 14440 
       
 14441 	},
       
 14442 
       
 14443 	_adjustOffsetFromHelper: function(obj) {
       
 14444 		if (typeof obj === "string") {
       
 14445 			obj = obj.split(" ");
       
 14446 		}
       
 14447 		if ($.isArray(obj)) {
       
 14448 			obj = {left: +obj[0], top: +obj[1] || 0};
       
 14449 		}
       
 14450 		if ("left" in obj) {
       
 14451 			this.offset.click.left = obj.left + this.margins.left;
       
 14452 		}
       
 14453 		if ("right" in obj) {
       
 14454 			this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
       
 14455 		}
       
 14456 		if ("top" in obj) {
       
 14457 			this.offset.click.top = obj.top + this.margins.top;
       
 14458 		}
       
 14459 		if ("bottom" in obj) {
       
 14460 			this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
       
 14461 		}
       
 14462 	},
       
 14463 
       
 14464 	_getParentOffset: function() {
       
 14465 
       
 14466 
       
 14467 		//Get the offsetParent and cache its position
       
 14468 		this.offsetParent = this.helper.offsetParent();
       
 14469 		var po = this.offsetParent.offset();
       
 14470 
       
 14471 		// This is a special case where we need to modify a offset calculated on start, since the following happened:
       
 14472 		// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
       
 14473 		// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
       
 14474 		//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
       
 14475 		if(this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {
       
 14476 			po.left += this.scrollParent.scrollLeft();
       
 14477 			po.top += this.scrollParent.scrollTop();
       
 14478 		}
       
 14479 
       
 14480 		// This needs to be actually done for all browsers, since pageX/pageY includes this information
       
 14481 		// with an ugly IE fix
       
 14482 		if( this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
       
 14483 			po = { top: 0, left: 0 };
       
 14484 		}
       
 14485 
       
 14486 		return {
       
 14487 			top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
       
 14488 			left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
       
 14489 		};
       
 14490 
       
 14491 	},
       
 14492 
       
 14493 	_getRelativeOffset: function() {
       
 14494 
       
 14495 		if(this.cssPosition === "relative") {
       
 14496 			var p = this.currentItem.position();
       
 14497 			return {
       
 14498 				top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
       
 14499 				left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
       
 14500 			};
       
 14501 		} else {
       
 14502 			return { top: 0, left: 0 };
       
 14503 		}
       
 14504 
       
 14505 	},
       
 14506 
       
 14507 	_cacheMargins: function() {
       
 14508 		this.margins = {
       
 14509 			left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
       
 14510 			top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
       
 14511 		};
       
 14512 	},
       
 14513 
       
 14514 	_cacheHelperProportions: function() {
       
 14515 		this.helperProportions = {
       
 14516 			width: this.helper.outerWidth(),
       
 14517 			height: this.helper.outerHeight()
       
 14518 		};
       
 14519 	},
       
 14520 
       
 14521 	_setContainment: function() {
       
 14522 
       
 14523 		var ce, co, over,
       
 14524 			o = this.options;
       
 14525 		if(o.containment === "parent") {
       
 14526 			o.containment = this.helper[0].parentNode;
       
 14527 		}
       
 14528 		if(o.containment === "document" || o.containment === "window") {
       
 14529 			this.containment = [
       
 14530 				0 - this.offset.relative.left - this.offset.parent.left,
       
 14531 				0 - this.offset.relative.top - this.offset.parent.top,
       
 14532 				o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left,
       
 14533 				(o.containment === "document" ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
       
 14534 			];
       
 14535 		}
       
 14536 
       
 14537 		if(!(/^(document|window|parent)$/).test(o.containment)) {
       
 14538 			ce = $(o.containment)[0];
       
 14539 			co = $(o.containment).offset();
       
 14540 			over = ($(ce).css("overflow") !== "hidden");
       
 14541 
       
 14542 			this.containment = [
       
 14543 				co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
       
 14544 				co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
       
 14545 				co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
       
 14546 				co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
       
 14547 			];
       
 14548 		}
       
 14549 
       
 14550 	},
       
 14551 
       
 14552 	_convertPositionTo: function(d, pos) {
       
 14553 
       
 14554 		if(!pos) {
       
 14555 			pos = this.position;
       
 14556 		}
       
 14557 		var mod = d === "absolute" ? 1 : -1,
       
 14558 			scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
       
 14559 			scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
       
 14560 
       
 14561 		return {
       
 14562 			top: (
       
 14563 				pos.top	+																// The absolute mouse position
       
 14564 				this.offset.relative.top * mod +										// Only for relative positioned nodes: Relative offset from element to offset parent
       
 14565 				this.offset.parent.top * mod -											// The offsetParent's offset without borders (offset + border)
       
 14566 				( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
       
 14567 			),
       
 14568 			left: (
       
 14569 				pos.left +																// The absolute mouse position
       
 14570 				this.offset.relative.left * mod +										// Only for relative positioned nodes: Relative offset from element to offset parent
       
 14571 				this.offset.parent.left * mod	-										// The offsetParent's offset without borders (offset + border)
       
 14572 				( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
       
 14573 			)
       
 14574 		};
       
 14575 
       
 14576 	},
       
 14577 
       
 14578 	_generatePosition: function(event) {
       
 14579 
       
 14580 		var top, left,
       
 14581 			o = this.options,
       
 14582 			pageX = event.pageX,
       
 14583 			pageY = event.pageY,
       
 14584 			scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
       
 14585 
       
 14586 		// This is another very weird special case that only happens for relative elements:
       
 14587 		// 1. If the css position is relative
       
 14588 		// 2. and the scroll parent is the document or similar to the offset parent
       
 14589 		// we have to refresh the relative offset during the scroll so there are no jumps
       
 14590 		if(this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) {
       
 14591 			this.offset.relative = this._getRelativeOffset();
       
 14592 		}
       
 14593 
       
 14594 		/*
       
 14595 		 * - Position constraining -
       
 14596 		 * Constrain the position to a mix of grid, containment.
       
 14597 		 */
       
 14598 
       
 14599 		if(this.originalPosition) { //If we are not dragging yet, we won't check for options
       
 14600 
       
 14601 			if(this.containment) {
       
 14602 				if(event.pageX - this.offset.click.left < this.containment[0]) {
       
 14603 					pageX = this.containment[0] + this.offset.click.left;
       
 14604 				}
       
 14605 				if(event.pageY - this.offset.click.top < this.containment[1]) {
       
 14606 					pageY = this.containment[1] + this.offset.click.top;
       
 14607 				}
       
 14608 				if(event.pageX - this.offset.click.left > this.containment[2]) {
       
 14609 					pageX = this.containment[2] + this.offset.click.left;
       
 14610 				}
       
 14611 				if(event.pageY - this.offset.click.top > this.containment[3]) {
       
 14612 					pageY = this.containment[3] + this.offset.click.top;
       
 14613 				}
       
 14614 			}
       
 14615 
       
 14616 			if(o.grid) {
       
 14617 				top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
       
 14618 				pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
       
 14619 
       
 14620 				left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
       
 14621 				pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
       
 14622 			}
       
 14623 
       
 14624 		}
       
 14625 
       
 14626 		return {
       
 14627 			top: (
       
 14628 				pageY -																// The absolute mouse position
       
 14629 				this.offset.click.top -													// Click offset (relative to the element)
       
 14630 				this.offset.relative.top	-											// Only for relative positioned nodes: Relative offset from element to offset parent
       
 14631 				this.offset.parent.top +												// The offsetParent's offset without borders (offset + border)
       
 14632 				( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
       
 14633 			),
       
 14634 			left: (
       
 14635 				pageX -																// The absolute mouse position
       
 14636 				this.offset.click.left -												// Click offset (relative to the element)
       
 14637 				this.offset.relative.left	-											// Only for relative positioned nodes: Relative offset from element to offset parent
       
 14638 				this.offset.parent.left +												// The offsetParent's offset without borders (offset + border)
       
 14639 				( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
       
 14640 			)
       
 14641 		};
       
 14642 
       
 14643 	},
       
 14644 
       
 14645 	_rearrange: function(event, i, a, hardRefresh) {
       
 14646 
       
 14647 		a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
       
 14648 
       
 14649 		//Various things done here to improve the performance:
       
 14650 		// 1. we create a setTimeout, that calls refreshPositions
       
 14651 		// 2. on the instance, we have a counter variable, that get's higher after every append
       
 14652 		// 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
       
 14653 		// 4. this lets only the last addition to the timeout stack through
       
 14654 		this.counter = this.counter ? ++this.counter : 1;
       
 14655 		var counter = this.counter;
       
 14656 
       
 14657 		this._delay(function() {
       
 14658 			if(counter === this.counter) {
       
 14659 				this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
       
 14660 			}
       
 14661 		});
       
 14662 
       
 14663 	},
       
 14664 
       
 14665 	_clear: function(event, noPropagation) {
       
 14666 
       
 14667 		this.reverting = false;
       
 14668 		// We delay all events that have to be triggered to after the point where the placeholder has been removed and
       
 14669 		// everything else normalized again
       
 14670 		var i,
       
 14671 			delayedTriggers = [];
       
 14672 
       
 14673 		// We first have to update the dom position of the actual currentItem
       
 14674 		// Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
       
 14675 		if(!this._noFinalSort && this.currentItem.parent().length) {
       
 14676 			this.placeholder.before(this.currentItem);
       
 14677 		}
       
 14678 		this._noFinalSort = null;
       
 14679 
       
 14680 		if(this.helper[0] === this.currentItem[0]) {
       
 14681 			for(i in this._storedCSS) {
       
 14682 				if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
       
 14683 					this._storedCSS[i] = "";
       
 14684 				}
       
 14685 			}
       
 14686 			this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
       
 14687 		} else {
       
 14688 			this.currentItem.show();
       
 14689 		}
       
 14690 
       
 14691 		if(this.fromOutside && !noPropagation) {
       
 14692 			delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
       
 14693 		}
       
 14694 		if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
       
 14695 			delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
       
 14696 		}
       
 14697 
       
 14698 		// Check if the items Container has Changed and trigger appropriate
       
 14699 		// events.
       
 14700 		if (this !== this.currentContainer) {
       
 14701 			if(!noPropagation) {
       
 14702 				delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
       
 14703 				delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); };  }).call(this, this.currentContainer));
       
 14704 				delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this));  }; }).call(this, this.currentContainer));
       
 14705 			}
       
 14706 		}
       
 14707 
       
 14708 
       
 14709 		//Post events to containers
       
 14710 		function delayEvent( type, instance, container ) {
       
 14711 			return function( event ) {
       
 14712 				container._trigger( type, event, instance._uiHash( instance ) );
       
 14713 			};
       
 14714 		}
       
 14715 		for (i = this.containers.length - 1; i >= 0; i--){
       
 14716 			if (!noPropagation) {
       
 14717 				delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
       
 14718 			}
       
 14719 			if(this.containers[i].containerCache.over) {
       
 14720 				delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
       
 14721 				this.containers[i].containerCache.over = 0;
       
 14722 			}
       
 14723 		}
       
 14724 
       
 14725 		//Do what was originally in plugins
       
 14726 		if ( this.storedCursor ) {
       
 14727 			this.document.find( "body" ).css( "cursor", this.storedCursor );
       
 14728 			this.storedStylesheet.remove();
       
 14729 		}
       
 14730 		if(this._storedOpacity) {
       
 14731 			this.helper.css("opacity", this._storedOpacity);
       
 14732 		}
       
 14733 		if(this._storedZIndex) {
       
 14734 			this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
       
 14735 		}
       
 14736 
       
 14737 		this.dragging = false;
       
 14738 
       
 14739 		if(!noPropagation) {
       
 14740 			this._trigger("beforeStop", event, this._uiHash());
       
 14741 		}
       
 14742 
       
 14743 		//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
       
 14744 		this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
       
 14745 
       
 14746 		if ( !this.cancelHelperRemoval ) {
       
 14747 			if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
       
 14748 				this.helper.remove();
       
 14749 			}
       
 14750 			this.helper = null;
       
 14751 		}
       
 14752 
       
 14753 		if(!noPropagation) {
       
 14754 			for (i=0; i < delayedTriggers.length; i++) {
       
 14755 				delayedTriggers[i].call(this, event);
       
 14756 			} //Trigger all delayed events
       
 14757 			this._trigger("stop", event, this._uiHash());
       
 14758 		}
       
 14759 
       
 14760 		this.fromOutside = false;
       
 14761 		return !this.cancelHelperRemoval;
       
 14762 
       
 14763 	},
       
 14764 
       
 14765 	_trigger: function() {
       
 14766 		if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
       
 14767 			this.cancel();
       
 14768 		}
       
 14769 	},
       
 14770 
       
 14771 	_uiHash: function(_inst) {
       
 14772 		var inst = _inst || this;
       
 14773 		return {
       
 14774 			helper: inst.helper,
       
 14775 			placeholder: inst.placeholder || $([]),
       
 14776 			position: inst.position,
       
 14777 			originalPosition: inst.originalPosition,
       
 14778 			offset: inst.positionAbs,
       
 14779 			item: inst.currentItem,
       
 14780 			sender: _inst ? _inst.element : null
       
 14781 		};
       
 14782 	}
       
 14783 
       
 14784 });
       
 14785 
       
 14786 
       
 14787 /*!
       
 14788  * jQuery UI Spinner 1.11.4
       
 14789  * http://jqueryui.com
       
 14790  *
       
 14791  * Copyright jQuery Foundation and other contributors
       
 14792  * Released under the MIT license.
       
 14793  * http://jquery.org/license
       
 14794  *
       
 14795  * http://api.jqueryui.com/spinner/
       
 14796  */
       
 14797 
       
 14798 
       
 14799 function spinner_modifier( fn ) {
 13308 	return function() {
 14800 	return function() {
 13309 		var previous = this.element.val();
 14801 		var previous = this.element.val();
 13310 		fn.apply( this, arguments );
 14802 		fn.apply( this, arguments );
 13311 		this._refresh();
 14803 		this._refresh();
 13312 		if ( previous !== this.element.val() ) {
 14804 		if ( previous !== this.element.val() ) {
 13313 			this._trigger( "change" );
 14805 			this._trigger( "change" );
 13314 		}
 14806 		}
 13315 	};
 14807 	};
 13316 }
 14808 }
 13317 
 14809 
 13318 $.widget( "ui.spinner", {
 14810 var spinner = $.widget( "ui.spinner", {
 13319 	version: "1.10.3",
 14811 	version: "1.11.4",
 13320 	defaultElement: "<input>",
 14812 	defaultElement: "<input>",
 13321 	widgetEventPrefix: "spin",
 14813 	widgetEventPrefix: "spin",
 13322 	options: {
 14814 	options: {
 13323 		culture: null,
 14815 		culture: null,
 13324 		icons: {
 14816 		icons: {
 13342 		// handle string values that need to be parsed
 14834 		// handle string values that need to be parsed
 13343 		this._setOption( "max", this.options.max );
 14835 		this._setOption( "max", this.options.max );
 13344 		this._setOption( "min", this.options.min );
 14836 		this._setOption( "min", this.options.min );
 13345 		this._setOption( "step", this.options.step );
 14837 		this._setOption( "step", this.options.step );
 13346 
 14838 
 13347 		// format the value, but don't constrain
 14839 		// Only format if there is a value, prevents the field from being marked
 13348 		this._value( this.element.val(), true );
 14840 		// as invalid in Firefox, see #9573.
       
 14841 		if ( this.value() !== "" ) {
       
 14842 			// Format the value, but don't constrain.
       
 14843 			this._value( this.element.val(), true );
       
 14844 		}
 13349 
 14845 
 13350 		this._draw();
 14846 		this._draw();
 13351 		this._on( this._events );
 14847 		this._on( this._events );
 13352 		this._refresh();
 14848 		this._refresh();
 13353 
 14849 
 13584 		var incremental = this.options.incremental;
 15080 		var incremental = this.options.incremental;
 13585 
 15081 
 13586 		if ( incremental ) {
 15082 		if ( incremental ) {
 13587 			return $.isFunction( incremental ) ?
 15083 			return $.isFunction( incremental ) ?
 13588 				incremental( i ) :
 15084 				incremental( i ) :
 13589 				Math.floor( i*i*i/50000 - i*i/500 + 17*i/200 + 1 );
 15085 				Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
 13590 		}
 15086 		}
 13591 
 15087 
 13592 		return 1;
 15088 		return 1;
 13593 	},
 15089 	},
 13594 
 15090 
 13668 		}
 15164 		}
 13669 
 15165 
 13670 		this._super( key, value );
 15166 		this._super( key, value );
 13671 
 15167 
 13672 		if ( key === "disabled" ) {
 15168 		if ( key === "disabled" ) {
 13673 			if ( value ) {
 15169 			this.widget().toggleClass( "ui-state-disabled", !!value );
 13674 				this.element.prop( "disabled", true );
 15170 			this.element.prop( "disabled", !!value );
 13675 				this.buttons.button( "disable" );
 15171 			this.buttons.button( value ? "disable" : "enable" );
 13676 			} else {
 15172 		}
 13677 				this.element.prop( "disabled", false );
 15173 	},
 13678 				this.buttons.button( "enable" );
 15174 
 13679 			}
 15175 	_setOptions: spinner_modifier(function( options ) {
 13680 		}
       
 13681 	},
       
 13682 
       
 13683 	_setOptions: modifier(function( options ) {
       
 13684 		this._super( options );
 15176 		this._super( options );
 13685 		this._value( this.element.val() );
       
 13686 	}),
 15177 	}),
 13687 
 15178 
 13688 	_parse: function( val ) {
 15179 	_parse: function( val ) {
 13689 		if ( typeof val === "string" && val !== "" ) {
 15180 		if ( typeof val === "string" && val !== "" ) {
 13690 			val = window.Globalize && this.options.numberFormat ?
 15181 			val = window.Globalize && this.options.numberFormat ?
 13707 			"aria-valuemin": this.options.min,
 15198 			"aria-valuemin": this.options.min,
 13708 			"aria-valuemax": this.options.max,
 15199 			"aria-valuemax": this.options.max,
 13709 			// TODO: what should we do with values that can't be parsed?
 15200 			// TODO: what should we do with values that can't be parsed?
 13710 			"aria-valuenow": this._parse( this.element.val() )
 15201 			"aria-valuenow": this._parse( this.element.val() )
 13711 		});
 15202 		});
       
 15203 	},
       
 15204 
       
 15205 	isValid: function() {
       
 15206 		var value = this.value();
       
 15207 
       
 15208 		// null is invalid
       
 15209 		if ( value === null ) {
       
 15210 			return false;
       
 15211 		}
       
 15212 
       
 15213 		// if value gets adjusted, it's invalid
       
 15214 		return value === this._adjustValue( value );
 13712 	},
 15215 	},
 13713 
 15216 
 13714 	// update the value without triggering change
 15217 	// update the value without triggering change
 13715 	_value: function( value, allowAny ) {
 15218 	_value: function( value, allowAny ) {
 13716 		var parsed;
 15219 		var parsed;
 13737 			.removeAttr( "aria-valuemax" )
 15240 			.removeAttr( "aria-valuemax" )
 13738 			.removeAttr( "aria-valuenow" );
 15241 			.removeAttr( "aria-valuenow" );
 13739 		this.uiSpinner.replaceWith( this.element );
 15242 		this.uiSpinner.replaceWith( this.element );
 13740 	},
 15243 	},
 13741 
 15244 
 13742 	stepUp: modifier(function( steps ) {
 15245 	stepUp: spinner_modifier(function( steps ) {
 13743 		this._stepUp( steps );
 15246 		this._stepUp( steps );
 13744 	}),
 15247 	}),
 13745 	_stepUp: function( steps ) {
 15248 	_stepUp: function( steps ) {
 13746 		if ( this._start() ) {
 15249 		if ( this._start() ) {
 13747 			this._spin( (steps || 1) * this.options.step );
 15250 			this._spin( (steps || 1) * this.options.step );
 13748 			this._stop();
 15251 			this._stop();
 13749 		}
 15252 		}
 13750 	},
 15253 	},
 13751 
 15254 
 13752 	stepDown: modifier(function( steps ) {
 15255 	stepDown: spinner_modifier(function( steps ) {
 13753 		this._stepDown( steps );
 15256 		this._stepDown( steps );
 13754 	}),
 15257 	}),
 13755 	_stepDown: function( steps ) {
 15258 	_stepDown: function( steps ) {
 13756 		if ( this._start() ) {
 15259 		if ( this._start() ) {
 13757 			this._spin( (steps || 1) * -this.options.step );
 15260 			this._spin( (steps || 1) * -this.options.step );
 13758 			this._stop();
 15261 			this._stop();
 13759 		}
 15262 		}
 13760 	},
 15263 	},
 13761 
 15264 
 13762 	pageUp: modifier(function( pages ) {
 15265 	pageUp: spinner_modifier(function( pages ) {
 13763 		this._stepUp( (pages || 1) * this.options.page );
 15266 		this._stepUp( (pages || 1) * this.options.page );
 13764 	}),
 15267 	}),
 13765 
 15268 
 13766 	pageDown: modifier(function( pages ) {
 15269 	pageDown: spinner_modifier(function( pages ) {
 13767 		this._stepDown( (pages || 1) * this.options.page );
 15270 		this._stepDown( (pages || 1) * this.options.page );
 13768 	}),
 15271 	}),
 13769 
 15272 
 13770 	value: function( newVal ) {
 15273 	value: function( newVal ) {
 13771 		if ( !arguments.length ) {
 15274 		if ( !arguments.length ) {
 13772 			return this._parse( this.element.val() );
 15275 			return this._parse( this.element.val() );
 13773 		}
 15276 		}
 13774 		modifier( this._value ).call( this, newVal );
 15277 		spinner_modifier( this._value ).call( this, newVal );
 13775 	},
 15278 	},
 13776 
 15279 
 13777 	widget: function() {
 15280 	widget: function() {
 13778 		return this.uiSpinner;
 15281 		return this.uiSpinner;
 13779 	}
 15282 	}
 13780 });
 15283 });
 13781 
 15284 
 13782 }( jQuery ) );
 15285 
 13783 
 15286 /*!
 13784 (function( $, undefined ) {
 15287  * jQuery UI Tabs 1.11.4
 13785 
 15288  * http://jqueryui.com
 13786 var tabId = 0,
 15289  *
 13787 	rhash = /#.*$/;
 15290  * Copyright jQuery Foundation and other contributors
 13788 
 15291  * Released under the MIT license.
 13789 function getNextTabId() {
 15292  * http://jquery.org/license
 13790 	return ++tabId;
 15293  *
 13791 }
 15294  * http://api.jqueryui.com/tabs/
 13792 
 15295  */
 13793 function isLocal( anchor ) {
 15296 
 13794 	return anchor.hash.length > 1 &&
 15297 
 13795 		decodeURIComponent( anchor.href.replace( rhash, "" ) ) ===
 15298 var tabs = $.widget( "ui.tabs", {
 13796 			decodeURIComponent( location.href.replace( rhash, "" ) );
 15299 	version: "1.11.4",
 13797 }
       
 13798 
       
 13799 $.widget( "ui.tabs", {
       
 13800 	version: "1.10.3",
       
 13801 	delay: 300,
 15300 	delay: 300,
 13802 	options: {
 15301 	options: {
 13803 		active: null,
 15302 		active: null,
 13804 		collapsible: false,
 15303 		collapsible: false,
 13805 		event: "click",
 15304 		event: "click",
 13812 		beforeActivate: null,
 15311 		beforeActivate: null,
 13813 		beforeLoad: null,
 15312 		beforeLoad: null,
 13814 		load: null
 15313 		load: null
 13815 	},
 15314 	},
 13816 
 15315 
       
 15316 	_isLocal: (function() {
       
 15317 		var rhash = /#.*$/;
       
 15318 
       
 15319 		return function( anchor ) {
       
 15320 			var anchorUrl, locationUrl;
       
 15321 
       
 15322 			// support: IE7
       
 15323 			// IE7 doesn't normalize the href property when set via script (#9317)
       
 15324 			anchor = anchor.cloneNode( false );
       
 15325 
       
 15326 			anchorUrl = anchor.href.replace( rhash, "" );
       
 15327 			locationUrl = location.href.replace( rhash, "" );
       
 15328 
       
 15329 			// decoding may throw an error if the URL isn't UTF-8 (#9518)
       
 15330 			try {
       
 15331 				anchorUrl = decodeURIComponent( anchorUrl );
       
 15332 			} catch ( error ) {}
       
 15333 			try {
       
 15334 				locationUrl = decodeURIComponent( locationUrl );
       
 15335 			} catch ( error ) {}
       
 15336 
       
 15337 			return anchor.hash.length > 1 && anchorUrl === locationUrl;
       
 15338 		};
       
 15339 	})(),
       
 15340 
 13817 	_create: function() {
 15341 	_create: function() {
 13818 		var that = this,
 15342 		var that = this,
 13819 			options = this.options;
 15343 			options = this.options;
 13820 
 15344 
 13821 		this.running = false;
 15345 		this.running = false;
 13822 
 15346 
 13823 		this.element
 15347 		this.element
 13824 			.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
 15348 			.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
 13825 			.toggleClass( "ui-tabs-collapsible", options.collapsible )
 15349 			.toggleClass( "ui-tabs-collapsible", options.collapsible );
 13826 			// Prevent users from focusing disabled tabs via click
       
 13827 			.delegate( ".ui-tabs-nav > li", "mousedown" + this.eventNamespace, function( event ) {
       
 13828 				if ( $( this ).is( ".ui-state-disabled" ) ) {
       
 13829 					event.preventDefault();
       
 13830 				}
       
 13831 			})
       
 13832 			// support: IE <9
       
 13833 			// Preventing the default action in mousedown doesn't prevent IE
       
 13834 			// from focusing the element, so if the anchor gets focused, blur.
       
 13835 			// We don't have to worry about focusing the previously focused
       
 13836 			// element since clicking on a non-focusable element should focus
       
 13837 			// the body anyway.
       
 13838 			.delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
       
 13839 				if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
       
 13840 					this.blur();
       
 13841 				}
       
 13842 			});
       
 13843 
 15350 
 13844 		this._processTabs();
 15351 		this._processTabs();
 13845 		options.active = this._initialActive();
 15352 		options.active = this._initialActive();
 13846 
 15353 
 13847 		// Take disabling tabs via class attribute from HTML
 15354 		// Take disabling tabs via class attribute from HTML
 13917 			panel: !this.active.length ? $() : this._getPanelForTab( this.active )
 15424 			panel: !this.active.length ? $() : this._getPanelForTab( this.active )
 13918 		};
 15425 		};
 13919 	},
 15426 	},
 13920 
 15427 
 13921 	_tabKeydown: function( event ) {
 15428 	_tabKeydown: function( event ) {
 13922 		/*jshint maxcomplexity:15*/
       
 13923 		var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
 15429 		var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
 13924 			selectedIndex = this.tabs.index( focusedTab ),
 15430 			selectedIndex = this.tabs.index( focusedTab ),
 13925 			goingForward = true;
 15431 			goingForward = true;
 13926 
 15432 
 13927 		if ( this._handlePageNav( event ) ) {
 15433 		if ( this._handlePageNav( event ) ) {
 13964 		// Focus the appropriate tab, based on which key was pressed
 15470 		// Focus the appropriate tab, based on which key was pressed
 13965 		event.preventDefault();
 15471 		event.preventDefault();
 13966 		clearTimeout( this.activating );
 15472 		clearTimeout( this.activating );
 13967 		selectedIndex = this._focusNextTab( selectedIndex, goingForward );
 15473 		selectedIndex = this._focusNextTab( selectedIndex, goingForward );
 13968 
 15474 
 13969 		// Navigating with control key will prevent automatic activation
 15475 		// Navigating with control/command key will prevent automatic activation
 13970 		if ( !event.ctrlKey ) {
 15476 		if ( !event.ctrlKey && !event.metaKey ) {
       
 15477 
 13971 			// Update aria-selected immediately so that AT think the tab is already selected.
 15478 			// Update aria-selected immediately so that AT think the tab is already selected.
 13972 			// Otherwise AT may confuse the user by stating that they need to activate the tab,
 15479 			// Otherwise AT may confuse the user by stating that they need to activate the tab,
 13973 			// but the tab will already be activated by the time the announcement finishes.
 15480 			// but the tab will already be activated by the time the announcement finishes.
 13974 			focusedTab.attr( "aria-selected", "false" );
 15481 			focusedTab.attr( "aria-selected", "false" );
 13975 			this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
 15482 			this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
 14058 		}
 15565 		}
 14059 
 15566 
 14060 		if ( key === "heightStyle" ) {
 15567 		if ( key === "heightStyle" ) {
 14061 			this._setupHeightStyle( value );
 15568 			this._setupHeightStyle( value );
 14062 		}
 15569 		}
 14063 	},
       
 14064 
       
 14065 	_tabId: function( tab ) {
       
 14066 		return tab.attr( "aria-controls" ) || "ui-tabs-" + getNextTabId();
       
 14067 	},
 15570 	},
 14068 
 15571 
 14069 	_sanitizeSelector: function( hash ) {
 15572 	_sanitizeSelector: function( hash ) {
 14070 		return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
 15573 		return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
 14071 	},
 15574 	},
 14110 		this._setupEvents( this.options.event );
 15613 		this._setupEvents( this.options.event );
 14111 		this._setupHeightStyle( this.options.heightStyle );
 15614 		this._setupHeightStyle( this.options.heightStyle );
 14112 
 15615 
 14113 		this.tabs.not( this.active ).attr({
 15616 		this.tabs.not( this.active ).attr({
 14114 			"aria-selected": "false",
 15617 			"aria-selected": "false",
       
 15618 			"aria-expanded": "false",
 14115 			tabIndex: -1
 15619 			tabIndex: -1
 14116 		});
 15620 		});
 14117 		this.panels.not( this._getPanelForTab( this.active ) )
 15621 		this.panels.not( this._getPanelForTab( this.active ) )
 14118 			.hide()
 15622 			.hide()
 14119 			.attr({
 15623 			.attr({
 14120 				"aria-expanded": "false",
       
 14121 				"aria-hidden": "true"
 15624 				"aria-hidden": "true"
 14122 			});
 15625 			});
 14123 
 15626 
 14124 		// Make sure one tab is in the tab order
 15627 		// Make sure one tab is in the tab order
 14125 		if ( !this.active.length ) {
 15628 		if ( !this.active.length ) {
 14127 		} else {
 15630 		} else {
 14128 			this.active
 15631 			this.active
 14129 				.addClass( "ui-tabs-active ui-state-active" )
 15632 				.addClass( "ui-tabs-active ui-state-active" )
 14130 				.attr({
 15633 				.attr({
 14131 					"aria-selected": "true",
 15634 					"aria-selected": "true",
       
 15635 					"aria-expanded": "true",
 14132 					tabIndex: 0
 15636 					tabIndex: 0
 14133 				});
 15637 				});
 14134 			this._getPanelForTab( this.active )
 15638 			this._getPanelForTab( this.active )
 14135 				.show()
 15639 				.show()
 14136 				.attr({
 15640 				.attr({
 14137 					"aria-expanded": "true",
       
 14138 					"aria-hidden": "false"
 15641 					"aria-hidden": "false"
 14139 				});
 15642 				});
 14140 		}
 15643 		}
 14141 	},
 15644 	},
 14142 
 15645 
 14143 	_processTabs: function() {
 15646 	_processTabs: function() {
 14144 		var that = this;
 15647 		var that = this,
       
 15648 			prevTabs = this.tabs,
       
 15649 			prevAnchors = this.anchors,
       
 15650 			prevPanels = this.panels;
 14145 
 15651 
 14146 		this.tablist = this._getList()
 15652 		this.tablist = this._getList()
 14147 			.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
 15653 			.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
 14148 			.attr( "role", "tablist" );
 15654 			.attr( "role", "tablist" )
       
 15655 
       
 15656 			// Prevent users from focusing disabled tabs via click
       
 15657 			.delegate( "> li", "mousedown" + this.eventNamespace, function( event ) {
       
 15658 				if ( $( this ).is( ".ui-state-disabled" ) ) {
       
 15659 					event.preventDefault();
       
 15660 				}
       
 15661 			})
       
 15662 
       
 15663 			// support: IE <9
       
 15664 			// Preventing the default action in mousedown doesn't prevent IE
       
 15665 			// from focusing the element, so if the anchor gets focused, blur.
       
 15666 			// We don't have to worry about focusing the previously focused
       
 15667 			// element since clicking on a non-focusable element should focus
       
 15668 			// the body anyway.
       
 15669 			.delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
       
 15670 				if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
       
 15671 					this.blur();
       
 15672 				}
       
 15673 			});
 14149 
 15674 
 14150 		this.tabs = this.tablist.find( "> li:has(a[href])" )
 15675 		this.tabs = this.tablist.find( "> li:has(a[href])" )
 14151 			.addClass( "ui-state-default ui-corner-top" )
 15676 			.addClass( "ui-state-default ui-corner-top" )
 14152 			.attr({
 15677 			.attr({
 14153 				role: "tab",
 15678 				role: "tab",
 14170 				anchorId = $( anchor ).uniqueId().attr( "id" ),
 15695 				anchorId = $( anchor ).uniqueId().attr( "id" ),
 14171 				tab = $( anchor ).closest( "li" ),
 15696 				tab = $( anchor ).closest( "li" ),
 14172 				originalAriaControls = tab.attr( "aria-controls" );
 15697 				originalAriaControls = tab.attr( "aria-controls" );
 14173 
 15698 
 14174 			// inline tab
 15699 			// inline tab
 14175 			if ( isLocal( anchor ) ) {
 15700 			if ( that._isLocal( anchor ) ) {
 14176 				selector = anchor.hash;
 15701 				selector = anchor.hash;
       
 15702 				panelId = selector.substring( 1 );
 14177 				panel = that.element.find( that._sanitizeSelector( selector ) );
 15703 				panel = that.element.find( that._sanitizeSelector( selector ) );
 14178 			// remote tab
 15704 			// remote tab
 14179 			} else {
 15705 			} else {
 14180 				panelId = that._tabId( tab );
 15706 				// If the tab doesn't already have aria-controls,
       
 15707 				// generate an id by using a throw-away element
       
 15708 				panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;
 14181 				selector = "#" + panelId;
 15709 				selector = "#" + panelId;
 14182 				panel = that.element.find( selector );
 15710 				panel = that.element.find( selector );
 14183 				if ( !panel.length ) {
 15711 				if ( !panel.length ) {
 14184 					panel = that._createPanel( panelId );
 15712 					panel = that._createPanel( panelId );
 14185 					panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
 15713 					panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
 14192 			}
 15720 			}
 14193 			if ( originalAriaControls ) {
 15721 			if ( originalAriaControls ) {
 14194 				tab.data( "ui-tabs-aria-controls", originalAriaControls );
 15722 				tab.data( "ui-tabs-aria-controls", originalAriaControls );
 14195 			}
 15723 			}
 14196 			tab.attr({
 15724 			tab.attr({
 14197 				"aria-controls": selector.substring( 1 ),
 15725 				"aria-controls": panelId,
 14198 				"aria-labelledby": anchorId
 15726 				"aria-labelledby": anchorId
 14199 			});
 15727 			});
 14200 			panel.attr( "aria-labelledby", anchorId );
 15728 			panel.attr( "aria-labelledby", anchorId );
 14201 		});
 15729 		});
 14202 
 15730 
 14203 		this.panels
 15731 		this.panels
 14204 			.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
 15732 			.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
 14205 			.attr( "role", "tabpanel" );
 15733 			.attr( "role", "tabpanel" );
       
 15734 
       
 15735 		// Avoid memory leaks (#10056)
       
 15736 		if ( prevTabs ) {
       
 15737 			this._off( prevTabs.not( this.tabs ) );
       
 15738 			this._off( prevAnchors.not( this.anchors ) );
       
 15739 			this._off( prevPanels.not( this.panels ) );
       
 15740 		}
 14206 	},
 15741 	},
 14207 
 15742 
 14208 	// allow overriding how to find the list for rare usage scenarios (#7715)
 15743 	// allow overriding how to find the list for rare usage scenarios (#7715)
 14209 	_getList: function() {
 15744 	_getList: function() {
 14210 		return this.element.find( "ol,ul" ).eq( 0 );
 15745 		return this.tablist || this.element.find( "ol,ul" ).eq( 0 );
 14211 	},
 15746 	},
 14212 
 15747 
 14213 	_createPanel: function( id ) {
 15748 	_createPanel: function( id ) {
 14214 		return $( "<div>" )
 15749 		return $( "<div>" )
 14215 			.attr( "id", id )
 15750 			.attr( "id", id )
 14241 
 15776 
 14242 		this.options.disabled = disabled;
 15777 		this.options.disabled = disabled;
 14243 	},
 15778 	},
 14244 
 15779 
 14245 	_setupEvents: function( event ) {
 15780 	_setupEvents: function( event ) {
 14246 		var events = {
 15781 		var events = {};
 14247 			click: function( event ) {
       
 14248 				event.preventDefault();
       
 14249 			}
       
 14250 		};
       
 14251 		if ( event ) {
 15782 		if ( event ) {
 14252 			$.each( event.split(" "), function( index, eventName ) {
 15783 			$.each( event.split(" "), function( index, eventName ) {
 14253 				events[ eventName ] = "_eventHandler";
 15784 				events[ eventName ] = "_eventHandler";
 14254 			});
 15785 			});
 14255 		}
 15786 		}
 14256 
 15787 
 14257 		this._off( this.anchors.add( this.tabs ).add( this.panels ) );
 15788 		this._off( this.anchors.add( this.tabs ).add( this.panels ) );
       
 15789 		// Always prevent the default action, even when disabled
       
 15790 		this._on( true, this.anchors, {
       
 15791 			click: function( event ) {
       
 15792 				event.preventDefault();
       
 15793 			}
       
 15794 		});
 14258 		this._on( this.anchors, events );
 15795 		this._on( this.anchors, events );
 14259 		this._on( this.tabs, { keydown: "_tabKeydown" } );
 15796 		this._on( this.tabs, { keydown: "_tabKeydown" } );
 14260 		this._on( this.panels, { keydown: "_panelKeydown" } );
 15797 		this._on( this.panels, { keydown: "_panelKeydown" } );
 14261 
 15798 
 14262 		this._focusable( this.tabs );
 15799 		this._focusable( this.tabs );
 14379 			eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
 15916 			eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
 14380 			toHide.hide();
 15917 			toHide.hide();
 14381 			show();
 15918 			show();
 14382 		}
 15919 		}
 14383 
 15920 
 14384 		toHide.attr({
 15921 		toHide.attr( "aria-hidden", "true" );
 14385 			"aria-expanded": "false",
 15922 		eventData.oldTab.attr({
 14386 			"aria-hidden": "true"
 15923 			"aria-selected": "false",
       
 15924 			"aria-expanded": "false"
 14387 		});
 15925 		});
 14388 		eventData.oldTab.attr( "aria-selected", "false" );
       
 14389 		// If we're switching tabs, remove the old tab from the tab order.
 15926 		// If we're switching tabs, remove the old tab from the tab order.
 14390 		// If we're opening from collapsed state, remove the previous tab from the tab order.
 15927 		// If we're opening from collapsed state, remove the previous tab from the tab order.
 14391 		// If we're collapsing, then keep the collapsing tab in the tab order.
 15928 		// If we're collapsing, then keep the collapsing tab in the tab order.
 14392 		if ( toShow.length && toHide.length ) {
 15929 		if ( toShow.length && toHide.length ) {
 14393 			eventData.oldTab.attr( "tabIndex", -1 );
 15930 			eventData.oldTab.attr( "tabIndex", -1 );
 14396 				return $( this ).attr( "tabIndex" ) === 0;
 15933 				return $( this ).attr( "tabIndex" ) === 0;
 14397 			})
 15934 			})
 14398 			.attr( "tabIndex", -1 );
 15935 			.attr( "tabIndex", -1 );
 14399 		}
 15936 		}
 14400 
 15937 
 14401 		toShow.attr({
 15938 		toShow.attr( "aria-hidden", "false" );
 14402 			"aria-expanded": "true",
       
 14403 			"aria-hidden": "false"
       
 14404 		});
       
 14405 		eventData.newTab.attr({
 15939 		eventData.newTab.attr({
 14406 			"aria-selected": "true",
 15940 			"aria-selected": "true",
       
 15941 			"aria-expanded": "true",
 14407 			tabIndex: 0
 15942 			tabIndex: 0
 14408 		});
 15943 		});
 14409 	},
 15944 	},
 14410 
 15945 
 14411 	_activate: function( index ) {
 15946 	_activate: function( index ) {
 14457 		this.anchors
 15992 		this.anchors
 14458 			.removeClass( "ui-tabs-anchor" )
 15993 			.removeClass( "ui-tabs-anchor" )
 14459 			.removeAttr( "role" )
 15994 			.removeAttr( "role" )
 14460 			.removeAttr( "tabIndex" )
 15995 			.removeAttr( "tabIndex" )
 14461 			.removeUniqueId();
 15996 			.removeUniqueId();
       
 15997 
       
 15998 		this.tablist.unbind( this.eventNamespace );
 14462 
 15999 
 14463 		this.tabs.add( this.panels ).each(function() {
 16000 		this.tabs.add( this.panels ).each(function() {
 14464 			if ( $.data( this, "ui-tabs-destroy" ) ) {
 16001 			if ( $.data( this, "ui-tabs-destroy" ) ) {
 14465 				$( this ).remove();
 16002 				$( this ).remove();
 14466 			} else {
 16003 			} else {
 14549 			anchor = tab.find( ".ui-tabs-anchor" ),
 16086 			anchor = tab.find( ".ui-tabs-anchor" ),
 14550 			panel = this._getPanelForTab( tab ),
 16087 			panel = this._getPanelForTab( tab ),
 14551 			eventData = {
 16088 			eventData = {
 14552 				tab: tab,
 16089 				tab: tab,
 14553 				panel: panel
 16090 				panel: panel
       
 16091 			},
       
 16092 			complete = function( jqXHR, status ) {
       
 16093 				if ( status === "abort" ) {
       
 16094 					that.panels.stop( false, true );
       
 16095 				}
       
 16096 
       
 16097 				tab.removeClass( "ui-tabs-loading" );
       
 16098 				panel.removeAttr( "aria-busy" );
       
 16099 
       
 16100 				if ( jqXHR === that.xhr ) {
       
 16101 					delete that.xhr;
       
 16102 				}
 14554 			};
 16103 			};
 14555 
 16104 
 14556 		// not remote
 16105 		// not remote
 14557 		if ( isLocal( anchor[ 0 ] ) ) {
 16106 		if ( this._isLocal( anchor[ 0 ] ) ) {
 14558 			return;
 16107 			return;
 14559 		}
 16108 		}
 14560 
 16109 
 14561 		this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
 16110 		this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
 14562 
 16111 
 14566 		if ( this.xhr && this.xhr.statusText !== "canceled" ) {
 16115 		if ( this.xhr && this.xhr.statusText !== "canceled" ) {
 14567 			tab.addClass( "ui-tabs-loading" );
 16116 			tab.addClass( "ui-tabs-loading" );
 14568 			panel.attr( "aria-busy", "true" );
 16117 			panel.attr( "aria-busy", "true" );
 14569 
 16118 
 14570 			this.xhr
 16119 			this.xhr
 14571 				.success(function( response ) {
 16120 				.done(function( response, status, jqXHR ) {
 14572 					// support: jQuery <1.8
 16121 					// support: jQuery <1.8
 14573 					// http://bugs.jquery.com/ticket/11778
 16122 					// http://bugs.jquery.com/ticket/11778
 14574 					setTimeout(function() {
 16123 					setTimeout(function() {
 14575 						panel.html( response );
 16124 						panel.html( response );
 14576 						that._trigger( "load", event, eventData );
 16125 						that._trigger( "load", event, eventData );
       
 16126 
       
 16127 						complete( jqXHR, status );
 14577 					}, 1 );
 16128 					}, 1 );
 14578 				})
 16129 				})
 14579 				.complete(function( jqXHR, status ) {
 16130 				.fail(function( jqXHR, status ) {
 14580 					// support: jQuery <1.8
 16131 					// support: jQuery <1.8
 14581 					// http://bugs.jquery.com/ticket/11778
 16132 					// http://bugs.jquery.com/ticket/11778
 14582 					setTimeout(function() {
 16133 					setTimeout(function() {
 14583 						if ( status === "abort" ) {
 16134 						complete( jqXHR, status );
 14584 							that.panels.stop( false, true );
       
 14585 						}
       
 14586 
       
 14587 						tab.removeClass( "ui-tabs-loading" );
       
 14588 						panel.removeAttr( "aria-busy" );
       
 14589 
       
 14590 						if ( jqXHR === that.xhr ) {
       
 14591 							delete that.xhr;
       
 14592 						}
       
 14593 					}, 1 );
 16135 					}, 1 );
 14594 				});
 16136 				});
 14595 		}
 16137 		}
 14596 	},
 16138 	},
 14597 
 16139 
 14599 		var that = this;
 16141 		var that = this;
 14600 		return {
 16142 		return {
 14601 			url: anchor.attr( "href" ),
 16143 			url: anchor.attr( "href" ),
 14602 			beforeSend: function( jqXHR, settings ) {
 16144 			beforeSend: function( jqXHR, settings ) {
 14603 				return that._trigger( "beforeLoad", event,
 16145 				return that._trigger( "beforeLoad", event,
 14604 					$.extend( { jqXHR : jqXHR, ajaxSettings: settings }, eventData ) );
 16146 					$.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );
 14605 			}
 16147 			}
 14606 		};
 16148 		};
 14607 	},
 16149 	},
 14608 
 16150 
 14609 	_getPanelForTab: function( tab ) {
 16151 	_getPanelForTab: function( tab ) {
 14610 		var id = $( tab ).attr( "aria-controls" );
 16152 		var id = $( tab ).attr( "aria-controls" );
 14611 		return this.element.find( this._sanitizeSelector( "#" + id ) );
 16153 		return this.element.find( this._sanitizeSelector( "#" + id ) );
 14612 	}
 16154 	}
 14613 });
 16155 });
 14614 
 16156 
 14615 })( jQuery );
 16157 
 14616 
 16158 /*!
 14617 (function( $ ) {
 16159  * jQuery UI Tooltip 1.11.4
 14618 
 16160  * http://jqueryui.com
 14619 var increments = 0;
 16161  *
 14620 
 16162  * Copyright jQuery Foundation and other contributors
 14621 function addDescribedBy( elem, id ) {
 16163  * Released under the MIT license.
 14622 	var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
 16164  * http://jquery.org/license
 14623 	describedby.push( id );
 16165  *
 14624 	elem
 16166  * http://api.jqueryui.com/tooltip/
 14625 		.data( "ui-tooltip-id", id )
 16167  */
 14626 		.attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
 16168 
 14627 }
 16169 
 14628 
 16170 var tooltip = $.widget( "ui.tooltip", {
 14629 function removeDescribedBy( elem ) {
 16171 	version: "1.11.4",
 14630 	var id = elem.data( "ui-tooltip-id" ),
       
 14631 		describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
       
 14632 		index = $.inArray( id, describedby );
       
 14633 	if ( index !== -1 ) {
       
 14634 		describedby.splice( index, 1 );
       
 14635 	}
       
 14636 
       
 14637 	elem.removeData( "ui-tooltip-id" );
       
 14638 	describedby = $.trim( describedby.join( " " ) );
       
 14639 	if ( describedby ) {
       
 14640 		elem.attr( "aria-describedby", describedby );
       
 14641 	} else {
       
 14642 		elem.removeAttr( "aria-describedby" );
       
 14643 	}
       
 14644 }
       
 14645 
       
 14646 $.widget( "ui.tooltip", {
       
 14647 	version: "1.10.3",
       
 14648 	options: {
 16172 	options: {
 14649 		content: function() {
 16173 		content: function() {
 14650 			// support: IE<9, Opera in jQuery <1.7
 16174 			// support: IE<9, Opera in jQuery <1.7
 14651 			// .text() can't accept undefined, so coerce to a string
 16175 			// .text() can't accept undefined, so coerce to a string
 14652 			var title = $( this ).attr( "title" ) || "";
 16176 			var title = $( this ).attr( "title" ) || "";
 14668 		// callbacks
 16192 		// callbacks
 14669 		close: null,
 16193 		close: null,
 14670 		open: null
 16194 		open: null
 14671 	},
 16195 	},
 14672 
 16196 
       
 16197 	_addDescribedBy: function( elem, id ) {
       
 16198 		var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
       
 16199 		describedby.push( id );
       
 16200 		elem
       
 16201 			.data( "ui-tooltip-id", id )
       
 16202 			.attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
       
 16203 	},
       
 16204 
       
 16205 	_removeDescribedBy: function( elem ) {
       
 16206 		var id = elem.data( "ui-tooltip-id" ),
       
 16207 			describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
       
 16208 			index = $.inArray( id, describedby );
       
 16209 
       
 16210 		if ( index !== -1 ) {
       
 16211 			describedby.splice( index, 1 );
       
 16212 		}
       
 16213 
       
 16214 		elem.removeData( "ui-tooltip-id" );
       
 16215 		describedby = $.trim( describedby.join( " " ) );
       
 16216 		if ( describedby ) {
       
 16217 			elem.attr( "aria-describedby", describedby );
       
 16218 		} else {
       
 16219 			elem.removeAttr( "aria-describedby" );
       
 16220 		}
       
 16221 	},
       
 16222 
 14673 	_create: function() {
 16223 	_create: function() {
 14674 		this._on({
 16224 		this._on({
 14675 			mouseover: "open",
 16225 			mouseover: "open",
 14676 			focusin: "open"
 16226 			focusin: "open"
 14677 		});
 16227 		});
 14678 
 16228 
 14679 		// IDs of generated tooltips, needed for destroy
 16229 		// IDs of generated tooltips, needed for destroy
 14680 		this.tooltips = {};
 16230 		this.tooltips = {};
       
 16231 
 14681 		// IDs of parent tooltips where we removed the title attribute
 16232 		// IDs of parent tooltips where we removed the title attribute
 14682 		this.parents = {};
 16233 		this.parents = {};
 14683 
 16234 
 14684 		if ( this.options.disabled ) {
 16235 		if ( this.options.disabled ) {
 14685 			this._disable();
 16236 			this._disable();
 14686 		}
 16237 		}
       
 16238 
       
 16239 		// Append the aria-live region so tooltips announce correctly
       
 16240 		this.liveRegion = $( "<div>" )
       
 16241 			.attr({
       
 16242 				role: "log",
       
 16243 				"aria-live": "assertive",
       
 16244 				"aria-relevant": "additions"
       
 16245 			})
       
 16246 			.addClass( "ui-helper-hidden-accessible" )
       
 16247 			.appendTo( this.document[ 0 ].body );
 14687 	},
 16248 	},
 14688 
 16249 
 14689 	_setOption: function( key, value ) {
 16250 	_setOption: function( key, value ) {
 14690 		var that = this;
 16251 		var that = this;
 14691 
 16252 
 14697 		}
 16258 		}
 14698 
 16259 
 14699 		this._super( key, value );
 16260 		this._super( key, value );
 14700 
 16261 
 14701 		if ( key === "content" ) {
 16262 		if ( key === "content" ) {
 14702 			$.each( this.tooltips, function( id, element ) {
 16263 			$.each( this.tooltips, function( id, tooltipData ) {
 14703 				that._updateContent( element );
 16264 				that._updateContent( tooltipData.element );
 14704 			});
 16265 			});
 14705 		}
 16266 		}
 14706 	},
 16267 	},
 14707 
 16268 
 14708 	_disable: function() {
 16269 	_disable: function() {
 14709 		var that = this;
 16270 		var that = this;
 14710 
 16271 
 14711 		// close open tooltips
 16272 		// close open tooltips
 14712 		$.each( this.tooltips, function( id, element ) {
 16273 		$.each( this.tooltips, function( id, tooltipData ) {
 14713 			var event = $.Event( "blur" );
 16274 			var event = $.Event( "blur" );
 14714 			event.target = event.currentTarget = element[0];
 16275 			event.target = event.currentTarget = tooltipData.element[ 0 ];
 14715 			that.close( event, true );
 16276 			that.close( event, true );
 14716 		});
 16277 		});
 14717 
 16278 
 14718 		// remove title attributes to prevent native tooltips
 16279 		// remove title attributes to prevent native tooltips
 14719 		this.element.find( this.options.items ).addBack().each(function() {
 16280 		this.element.find( this.options.items ).addBack().each(function() {
 14720 			var element = $( this );
 16281 			var element = $( this );
 14721 			if ( element.is( "[title]" ) ) {
 16282 			if ( element.is( "[title]" ) ) {
 14722 				element
 16283 				element
 14723 					.data( "ui-tooltip-title", element.attr( "title" ) )
 16284 					.data( "ui-tooltip-title", element.attr( "title" ) )
 14724 					.attr( "title", "" );
 16285 					.removeAttr( "title" );
 14725 			}
 16286 			}
 14726 		});
 16287 		});
 14727 	},
 16288 	},
 14728 
 16289 
 14729 	_enable: function() {
 16290 	_enable: function() {
 14773 					parent.attr( "title", "" );
 16334 					parent.attr( "title", "" );
 14774 				}
 16335 				}
 14775 			});
 16336 			});
 14776 		}
 16337 		}
 14777 
 16338 
       
 16339 		this._registerCloseHandlers( event, target );
 14778 		this._updateContent( target, event );
 16340 		this._updateContent( target, event );
 14779 	},
 16341 	},
 14780 
 16342 
 14781 	_updateContent: function( target, event ) {
 16343 	_updateContent: function( target, event ) {
 14782 		var content,
 16344 		var content,
 14787 		if ( typeof contentOption === "string" ) {
 16349 		if ( typeof contentOption === "string" ) {
 14788 			return this._open( event, target, contentOption );
 16350 			return this._open( event, target, contentOption );
 14789 		}
 16351 		}
 14790 
 16352 
 14791 		content = contentOption.call( target[0], function( response ) {
 16353 		content = contentOption.call( target[0], function( response ) {
 14792 			// ignore async response if tooltip was closed already
 16354 
 14793 			if ( !target.data( "ui-tooltip-open" ) ) {
       
 14794 				return;
       
 14795 			}
       
 14796 			// IE may instantly serve a cached response for ajax requests
 16355 			// IE may instantly serve a cached response for ajax requests
 14797 			// delay this call to _open so the other call to _open runs first
 16356 			// delay this call to _open so the other call to _open runs first
 14798 			that._delay(function() {
 16357 			that._delay(function() {
       
 16358 
       
 16359 				// Ignore async response if tooltip was closed already
       
 16360 				if ( !target.data( "ui-tooltip-open" ) ) {
       
 16361 					return;
       
 16362 				}
       
 16363 
 14799 				// jQuery creates a special event for focusin when it doesn't
 16364 				// jQuery creates a special event for focusin when it doesn't
 14800 				// exist natively. To improve performance, the native event
 16365 				// exist natively. To improve performance, the native event
 14801 				// object is reused and the type is changed. Therefore, we can't
 16366 				// object is reused and the type is changed. Therefore, we can't
 14802 				// rely on the type being correct after the event finished
 16367 				// rely on the type being correct after the event finished
 14803 				// bubbling, so we set it back to the previous value. (#8740)
 16368 				// bubbling, so we set it back to the previous value. (#8740)
 14811 			this._open( event, target, content );
 16376 			this._open( event, target, content );
 14812 		}
 16377 		}
 14813 	},
 16378 	},
 14814 
 16379 
 14815 	_open: function( event, target, content ) {
 16380 	_open: function( event, target, content ) {
 14816 		var tooltip, events, delayedShow,
 16381 		var tooltipData, tooltip, delayedShow, a11yContent,
 14817 			positionOption = $.extend( {}, this.options.position );
 16382 			positionOption = $.extend( {}, this.options.position );
 14818 
 16383 
 14819 		if ( !content ) {
 16384 		if ( !content ) {
 14820 			return;
 16385 			return;
 14821 		}
 16386 		}
 14822 
 16387 
 14823 		// Content can be updated multiple times. If the tooltip already
 16388 		// Content can be updated multiple times. If the tooltip already
 14824 		// exists, then just update the content and bail.
 16389 		// exists, then just update the content and bail.
 14825 		tooltip = this._find( target );
 16390 		tooltipData = this._find( target );
 14826 		if ( tooltip.length ) {
 16391 		if ( tooltipData ) {
 14827 			tooltip.find( ".ui-tooltip-content" ).html( content );
 16392 			tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
 14828 			return;
 16393 			return;
 14829 		}
 16394 		}
 14830 
 16395 
 14831 		// if we have a title, clear it to prevent the native tooltip
 16396 		// if we have a title, clear it to prevent the native tooltip
 14832 		// we have to check first to avoid defining a title if none exists
 16397 		// we have to check first to avoid defining a title if none exists
 14841 			} else {
 16406 			} else {
 14842 				target.removeAttr( "title" );
 16407 				target.removeAttr( "title" );
 14843 			}
 16408 			}
 14844 		}
 16409 		}
 14845 
 16410 
 14846 		tooltip = this._tooltip( target );
 16411 		tooltipData = this._tooltip( target );
 14847 		addDescribedBy( target, tooltip.attr( "id" ) );
 16412 		tooltip = tooltipData.tooltip;
       
 16413 		this._addDescribedBy( target, tooltip.attr( "id" ) );
 14848 		tooltip.find( ".ui-tooltip-content" ).html( content );
 16414 		tooltip.find( ".ui-tooltip-content" ).html( content );
       
 16415 
       
 16416 		// Support: Voiceover on OS X, JAWS on IE <= 9
       
 16417 		// JAWS announces deletions even when aria-relevant="additions"
       
 16418 		// Voiceover will sometimes re-read the entire log region's contents from the beginning
       
 16419 		this.liveRegion.children().hide();
       
 16420 		if ( content.clone ) {
       
 16421 			a11yContent = content.clone();
       
 16422 			a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
       
 16423 		} else {
       
 16424 			a11yContent = content;
       
 16425 		}
       
 16426 		$( "<div>" ).html( a11yContent ).appendTo( this.liveRegion );
 14849 
 16427 
 14850 		function position( event ) {
 16428 		function position( event ) {
 14851 			positionOption.of = event;
 16429 			positionOption.of = event;
 14852 			if ( tooltip.is( ":hidden" ) ) {
 16430 			if ( tooltip.is( ":hidden" ) ) {
 14853 				return;
 16431 				return;
 14880 				}
 16458 				}
 14881 			}, $.fx.interval );
 16459 			}, $.fx.interval );
 14882 		}
 16460 		}
 14883 
 16461 
 14884 		this._trigger( "open", event, { tooltip: tooltip } );
 16462 		this._trigger( "open", event, { tooltip: tooltip } );
 14885 
 16463 	},
 14886 		events = {
 16464 
       
 16465 	_registerCloseHandlers: function( event, target ) {
       
 16466 		var events = {
 14887 			keyup: function( event ) {
 16467 			keyup: function( event ) {
 14888 				if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
 16468 				if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
 14889 					var fakeEvent = $.Event(event);
 16469 					var fakeEvent = $.Event(event);
 14890 					fakeEvent.currentTarget = target[0];
 16470 					fakeEvent.currentTarget = target[0];
 14891 					this.close( fakeEvent, true );
 16471 					this.close( fakeEvent, true );
 14892 				}
 16472 				}
 14893 			},
       
 14894 			remove: function() {
       
 14895 				this._removeTooltip( tooltip );
       
 14896 			}
 16473 			}
 14897 		};
 16474 		};
       
 16475 
       
 16476 		// Only bind remove handler for delegated targets. Non-delegated
       
 16477 		// tooltips will handle this in destroy.
       
 16478 		if ( target[ 0 ] !== this.element[ 0 ] ) {
       
 16479 			events.remove = function() {
       
 16480 				this._removeTooltip( this._find( target ).tooltip );
       
 16481 			};
       
 16482 		}
       
 16483 
 14898 		if ( !event || event.type === "mouseover" ) {
 16484 		if ( !event || event.type === "mouseover" ) {
 14899 			events.mouseleave = "close";
 16485 			events.mouseleave = "close";
 14900 		}
 16486 		}
 14901 		if ( !event || event.type === "focusin" ) {
 16487 		if ( !event || event.type === "focusin" ) {
 14902 			events.focusout = "close";
 16488 			events.focusout = "close";
 14903 		}
 16489 		}
 14904 		this._on( true, target, events );
 16490 		this._on( true, target, events );
 14905 	},
 16491 	},
 14906 
 16492 
 14907 	close: function( event ) {
 16493 	close: function( event ) {
 14908 		var that = this,
 16494 		var tooltip,
       
 16495 			that = this,
 14909 			target = $( event ? event.currentTarget : this.element ),
 16496 			target = $( event ? event.currentTarget : this.element ),
 14910 			tooltip = this._find( target );
 16497 			tooltipData = this._find( target );
       
 16498 
       
 16499 		// The tooltip may already be closed
       
 16500 		if ( !tooltipData ) {
       
 16501 
       
 16502 			// We set ui-tooltip-open immediately upon open (in open()), but only set the
       
 16503 			// additional data once there's actually content to show (in _open()). So even if the
       
 16504 			// tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
       
 16505 			// the period between open() and _open().
       
 16506 			target.removeData( "ui-tooltip-open" );
       
 16507 			return;
       
 16508 		}
       
 16509 
       
 16510 		tooltip = tooltipData.tooltip;
 14911 
 16511 
 14912 		// disabling closes the tooltip, so we need to track when we're closing
 16512 		// disabling closes the tooltip, so we need to track when we're closing
 14913 		// to avoid an infinite loop in case the tooltip becomes disabled on close
 16513 		// to avoid an infinite loop in case the tooltip becomes disabled on close
 14914 		if ( this.closing ) {
 16514 		if ( tooltipData.closing ) {
 14915 			return;
 16515 			return;
 14916 		}
 16516 		}
 14917 
 16517 
 14918 		// Clear the interval for delayed tracking tooltips
 16518 		// Clear the interval for delayed tracking tooltips
 14919 		clearInterval( this.delayedShow );
 16519 		clearInterval( this.delayedShow );
 14920 
 16520 
 14921 		// only set title if we had one before (see comment in _open())
 16521 		// only set title if we had one before (see comment in _open())
 14922 		if ( target.data( "ui-tooltip-title" ) ) {
 16522 		// If the title attribute has changed since open(), don't restore
       
 16523 		if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
 14923 			target.attr( "title", target.data( "ui-tooltip-title" ) );
 16524 			target.attr( "title", target.data( "ui-tooltip-title" ) );
 14924 		}
 16525 		}
 14925 
 16526 
 14926 		removeDescribedBy( target );
 16527 		this._removeDescribedBy( target );
 14927 
 16528 
       
 16529 		tooltipData.hiding = true;
 14928 		tooltip.stop( true );
 16530 		tooltip.stop( true );
 14929 		this._hide( tooltip, this.options.hide, function() {
 16531 		this._hide( tooltip, this.options.hide, function() {
 14930 			that._removeTooltip( $( this ) );
 16532 			that._removeTooltip( $( this ) );
 14931 		});
 16533 		});
 14932 
 16534 
 14933 		target.removeData( "ui-tooltip-open" );
 16535 		target.removeData( "ui-tooltip-open" );
 14934 		this._off( target, "mouseleave focusout keyup" );
 16536 		this._off( target, "mouseleave focusout keyup" );
       
 16537 
 14935 		// Remove 'remove' binding only on delegated targets
 16538 		// Remove 'remove' binding only on delegated targets
 14936 		if ( target[0] !== this.element[0] ) {
 16539 		if ( target[ 0 ] !== this.element[ 0 ] ) {
 14937 			this._off( target, "remove" );
 16540 			this._off( target, "remove" );
 14938 		}
 16541 		}
 14939 		this._off( this.document, "mousemove" );
 16542 		this._off( this.document, "mousemove" );
 14940 
 16543 
 14941 		if ( event && event.type === "mouseleave" ) {
 16544 		if ( event && event.type === "mouseleave" ) {
 14943 				$( parent.element ).attr( "title", parent.title );
 16546 				$( parent.element ).attr( "title", parent.title );
 14944 				delete that.parents[ id ];
 16547 				delete that.parents[ id ];
 14945 			});
 16548 			});
 14946 		}
 16549 		}
 14947 
 16550 
 14948 		this.closing = true;
 16551 		tooltipData.closing = true;
 14949 		this._trigger( "close", event, { tooltip: tooltip } );
 16552 		this._trigger( "close", event, { tooltip: tooltip } );
 14950 		this.closing = false;
 16553 		if ( !tooltipData.hiding ) {
       
 16554 			tooltipData.closing = false;
       
 16555 		}
 14951 	},
 16556 	},
 14952 
 16557 
 14953 	_tooltip: function( element ) {
 16558 	_tooltip: function( element ) {
 14954 		var id = "ui-tooltip-" + increments++,
 16559 		var tooltip = $( "<div>" )
 14955 			tooltip = $( "<div>" )
 16560 				.attr( "role", "tooltip" )
 14956 				.attr({
       
 14957 					id: id,
       
 14958 					role: "tooltip"
       
 14959 				})
       
 14960 				.addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
 16561 				.addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
 14961 					( this.options.tooltipClass || "" ) );
 16562 					( this.options.tooltipClass || "" ) ),
       
 16563 			id = tooltip.uniqueId().attr( "id" );
       
 16564 
 14962 		$( "<div>" )
 16565 		$( "<div>" )
 14963 			.addClass( "ui-tooltip-content" )
 16566 			.addClass( "ui-tooltip-content" )
 14964 			.appendTo( tooltip );
 16567 			.appendTo( tooltip );
       
 16568 
 14965 		tooltip.appendTo( this.document[0].body );
 16569 		tooltip.appendTo( this.document[0].body );
 14966 		this.tooltips[ id ] = element;
 16570 
 14967 		return tooltip;
 16571 		return this.tooltips[ id ] = {
       
 16572 			element: element,
       
 16573 			tooltip: tooltip
       
 16574 		};
 14968 	},
 16575 	},
 14969 
 16576 
 14970 	_find: function( target ) {
 16577 	_find: function( target ) {
 14971 		var id = target.data( "ui-tooltip-id" );
 16578 		var id = target.data( "ui-tooltip-id" );
 14972 		return id ? $( "#" + id ) : $();
 16579 		return id ? this.tooltips[ id ] : null;
 14973 	},
 16580 	},
 14974 
 16581 
 14975 	_removeTooltip: function( tooltip ) {
 16582 	_removeTooltip: function( tooltip ) {
 14976 		tooltip.remove();
 16583 		tooltip.remove();
 14977 		delete this.tooltips[ tooltip.attr( "id" ) ];
 16584 		delete this.tooltips[ tooltip.attr( "id" ) ];
 14979 
 16586 
 14980 	_destroy: function() {
 16587 	_destroy: function() {
 14981 		var that = this;
 16588 		var that = this;
 14982 
 16589 
 14983 		// close open tooltips
 16590 		// close open tooltips
 14984 		$.each( this.tooltips, function( id, element ) {
 16591 		$.each( this.tooltips, function( id, tooltipData ) {
 14985 			// Delegate to close method to handle common cleanup
 16592 			// Delegate to close method to handle common cleanup
 14986 			var event = $.Event( "blur" );
 16593 			var event = $.Event( "blur" ),
 14987 			event.target = event.currentTarget = element[0];
 16594 				element = tooltipData.element;
       
 16595 			event.target = event.currentTarget = element[ 0 ];
 14988 			that.close( event, true );
 16596 			that.close( event, true );
 14989 
 16597 
 14990 			// Remove immediately; destroying an open tooltip doesn't use the
 16598 			// Remove immediately; destroying an open tooltip doesn't use the
 14991 			// hide animation
 16599 			// hide animation
 14992 			$( "#" + id ).remove();
 16600 			$( "#" + id ).remove();
 14993 
 16601 
 14994 			// Restore the title
 16602 			// Restore the title
 14995 			if ( element.data( "ui-tooltip-title" ) ) {
 16603 			if ( element.data( "ui-tooltip-title" ) ) {
 14996 				element.attr( "title", element.data( "ui-tooltip-title" ) );
 16604 				// If the title attribute has changed since open(), don't restore
       
 16605 				if ( !element.attr( "title" ) ) {
       
 16606 					element.attr( "title", element.data( "ui-tooltip-title" ) );
       
 16607 				}
 14997 				element.removeData( "ui-tooltip-title" );
 16608 				element.removeData( "ui-tooltip-title" );
 14998 			}
 16609 			}
 14999 		});
 16610 		});
       
 16611 		this.liveRegion.remove();
 15000 	}
 16612 	}
 15001 });
 16613 });
 15002 
 16614 
 15003 }( jQuery ) );
 16615 
       
 16616 
       
 16617 }));