PageSourceSearch

https://www.prepaidgiftbalance.com/o/kroger-comp-responsive-theme/…&languageId=en_US&t=1789209522000

js prepaidgiftbalance.com collected 2026-10-04 02:17:42 UTC 48,227 bytes, 1,433 lines download raw bytes

1/*
2 * jQuery UI @VERSION
3 *
4 * Copyright (c) 2008 Paul Bakaus (ui.jquery.com)
5 * Dual licensed under the MIT (MIT-LICENSE.txt)
6 * and GPL (GPL-LICENSE.txt) licenses.
7 *
8 * http://docs.jquery.com/UI
9 */
10;(function($) {
11
12// This adds a selector to check if data exists.
13jQuery.extend(jQuery.expr[':'], { 
14	data: "jQuery.data(a, m[3])"
15});
16
17$.ui = {
18	plugin: {
19		add: function(module, option, set) {
20			var proto = $.ui[module].prototype;
21			for(var i in set) {
22				proto.plugins[i] = proto.plugins[i] || [];
23				proto.plugins[i].push([option, set[i]]);
24			}
25		},
26		call: function(instance, name, args) {
27			var set = instance.plugins[name];
28			if(!set) { return; }
29			
30			for (var i = 0; i < set.length; i++) {
31				if (instance.options[set[i][0]]) {
32					set[i][1].apply(instance.element, args);
33				}
34			}
35		}	
36	},
37	cssCache: {},
38	css: function(name) {
39		if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }
40		var tmp = $('<div class="ui-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body');
41		
42		//if (!$.browser.safari)
43			//tmp.appendTo('body'); 
44		
45		//Opera and Safari set width and height to 0px instead of auto
46		//Safari returns rgba(0,0,0,0) when bgcolor is not set
47		$.ui.cssCache[name] = !!(
48			(!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || 
49			!(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))
50		);
51		try { $('body').get(0).removeChild(tmp.get(0));	} catch(e){}
52		return $.ui.cssCache[name];
53	},
54	disableSelection: function(el) {
55		$(el).attr('unselectable', 'on').css('MozUserSelect', 'none');
56	},
57	enableSelection: function(el) {
58		$(el).attr('unselectable', 'off').css('MozUserSelect', '');
59	},
60	hasScroll: function(e, a) {
61		var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
62			has = false;
63		
64		if (e[scroll] > 0) { return true; }
65		
66		// TODO: determine which cases actually cause this to happen
67		// if the element doesn't have the scroll set, see if it's possible to
68		// set the scroll
69		e[scroll] = 1;
70		has = (e[scroll] > 0);
71		e[scroll] = 0;
72		return has;
73	}
74};
75
76
77/** jQuery core modifications and additions **/
78
79var _remove = $.fn.remove;
80$.fn.remove = function() {
81	$("*", this).add(this).triggerHandler("remove");
82	return _remove.apply(this, arguments );
83};
84
85// $.widget is a factory to create jQuery plugins
86// taking some boilerplate code out of the plugin code
87// created by Scott González and Jörn Zaefferer
88function getter(namespace, plugin, method) {
89	var methods = $[namespace][plugin].getter || [];
90	methods = (typeof methods == "string" ? methods.split(/,?\s+/) : methods);
91	return ($.inArray(method, methods) != -1);
92}
93
94$.widget = function(name, prototype) {
95	var namespace = name.split(".")[0];
96	name = name.split(".")[1];
97	
98	// create plugin method
99	$.fn[name] = function(options) {
100		var isMethodCall = (typeof options == 'string'),
101			args = Array.prototype.slice.call(arguments, 1);
102		
103		if (isMethodCall && getter(namespace, name, options)) {
104			var instance = $.data(this[0], name);
105			return (instance ? instance[options].apply(instance, args)
106				: undefined);
107		}
108		
109		return this.each(function() {
110			var instance = $.data(this, name);
111			if (isMethodCall && instance && $.isFunction(instance[options])) {
112				instance[options].apply(instance, args);
113			} else if (!isMethodCall) {
114				$.data(this, name, new $[namespace][name](this, options));
115			}
116		});
117	};
118	
119	// create widget constructor
120	$[namespace][name] = function(element, options) {
121		var self = this;
122		
123		this.widgetName = name;
124		this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
125		this.widgetBaseClass = namespace + '-' + name;
126		
127		this.options = $.extend({}, $.widget.defaults, $[namespace][name].defaults, options);
128		this.element = $(element)
129			.bind('setData.' + name, function(e, key, value) {
130				return self.setData(key, value);
131			})
132			.bind('getData.' + name, function(e, key) {
133				return self.getData(key);
134			})
135			.bind('remove', function() {
136				return self.destroy();
137			});
138		this.init();
139	};
140	
141	// add widget prototype
142	$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
143};
144
145$.widget.prototype = {
146	init: function() {},
147	destroy: function() {
148		this.element.removeData(this.widgetName);
149	},
150	
151	getData: function(key) {
152		return this.options[key];
153	},
154	setData: function(key, value) {
155		this.options[key] = value;
156		
157		if (key == 'disabled') {
158			this.element[value ? 'addClass' : 'removeClass'](
159				this.widgetBaseClass + '-disabled');
160		}
161	},
162	
163	enable: function() {
164		this.setData('disabled', false);
165	},
166	disable: function() {
167		this.setData('disabled', true);
168	},
169	
170	trigger: function(type, e, data) {
171		var eventName = (type == this.widgetEventPrefix
172			? type : this.widgetEventPrefix + type);
173		e = e  || $.event.fix({ type: eventName, target: this.element[0] });
174		return this.element.triggerHandler(eventName, [e, data], this.options[type]);
175	}
176};
177
178$.widget.defaults = {
179	disabled: false
180};
181
182
183/** Mouse Interaction Plugin **/
184
185$.ui.mouse = {
186	mouseInit: function() {
187		var self = this;
188	
189		this.element.bind('mousedown.'+this.widgetName, function(e) {
190			return self.mouseDown(e);
191		});
192		
193		// Prevent text selection in IE
194		/**if ($.browser.msie) {
195			this._mouseUnselectable = this.element.attr('unselectable');
196			this.element.attr('unselectable', 'on');
197		}**/
198		
199		this.started = false;
200	},
201	
202	// TODO: make sure destroying one instance of mouse doesn't mess with
203	// other instances of mouse
204	mouseDestroy: function() {
205		this.element.unbind('.'+this.widgetName);
206		
207		// Restore text selection in IE
208		($.browser.msie
209			&& this.element.attr('unselectable', this._mouseUnselectable));
210	},
211	
212	mouseDown: function(e) {
213		// we may have missed mouseup (out of window)
214		(this._mouseStarted && this.mouseUp(e));
215		
216		this._mouseDownEvent = e;
217		
218		var self = this,
219			btnIsLeft = (e.which == 1),
220			elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false);
221		if (!btnIsLeft || elIsCancel || !this.mouseCapture(e)) {
222			return true;
223		}
224		
225		this._mouseDelayMet = !this.options.delay;
226		if (!this._mouseDelayMet) {
227			this._mouseDelayTimer = setTimeout(function() {
228				self._mouseDelayMet = true;
229			}, this.options.delay);
230		}
231		
232		if (this.mouseDistanceMet(e) && this.mouseDelayMet(e)) {
233			this._mouseStarted = (this.mouseStart(e) !== false);
234			if (!this._mouseStarted) {
235				e.preventDefault();
236				return true;
237			}
238		}
239		
240		// these delegates are required to keep context
241		this._mouseMoveDelegate = function(e) {
242			return self.mouseMove(e);
243		};
244		this._mouseUpDelegate = function(e) {
245			return self.mouseUp(e);
246		};
247		$(document)
248			.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
249			.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
250		
251		return false;
252	},
253	
254	mouseMove: function(e) {
255		// IE mouseup check - mouseup happened when mouse was out of window
256		if ($.browser.msie && !e.button) {
257			return this.mouseUp(e);
258		}
259		
260		if (this._mouseStarted) {
261			this.mouseDrag(e);
262			return false;
263		}
264		
265		if (this.mouseDistanceMet(e) && this.mouseDelayMet(e)) {
266			this._mouseStarted =
267				(this.mouseStart(this._mouseDownEvent, e) !== false);
268			(this._mouseStarted ? this.mouseDrag(e) : this.mouseUp(e));
269		}
270		
271		return !this._mouseStarted;
272	},
273	
274	mouseUp: function(e) {
275		$(document)
276			.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
277			.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
278		
279		if (this._mouseStarted) {
280			this._mouseStarted = false;
281			this.mouseStop(e);
282		}
283		
284		return false;
285	},
286	
287	mouseDistanceMet: function(e) {
288		return (Math.max(
289				Math.abs(this._mouseDownEvent.pageX - e.pageX),
290				Math.abs(this._mouseDownEvent.pageY - e.pageY)
291			) >= this.options.distance
292		);
293	},
294	
295	mouseDelayMet: function(e) {
296		return this._mouseDelayMet;
297	},
298	
299	// These are placeholder methods, to be overriden by extending plugin
300	mouseStart: function(e) {},
301	mouseDrag: function(e) {},
302	mouseStop: function(e) {},
303	mouseCapture: function(e) { return true; }
304};
305
306$.ui.mouse.defaults = {
307	cancel: null,
308	distance: 1,
309	delay: 0
310};
311
312})(jQuery);
313
314/*
315 * jQuery UI Dialog
316 *
317 * Copyright (c) 2008 Richard D. Worth (rdworth.org)
318 * Dual licensed under the MIT (MIT-LICENSE.txt)
319 * and GPL (GPL-LICENSE.txt) licenses.
320 * 
321 * http://docs.jquery.com/UI/Dialog
322 *
323 * Depends:
324 *	ui.core.js
325 *	ui.draggable.js
326 *	ui.resizable.js
327 */
328(function($) {
329
330var setDataSwitch = {
331	dragStart: "start.draggable",
332	drag: "drag.draggable",
333	dragStop: "stop.draggable",
334	maxHeight: "maxHeight.resizable",
335	minHeight: "minHeight.resizable",
336	maxWidth: "maxWidth.resizable",
337	minWidth: "minWidth.resizable",
338	resizeStart: "start.resizable",
339	resize: "drag.resizable",
340	resizeStop: "stop.resizable"
341};
342
343$.widget("ui.dialog", {
344	init: function() {
345		this.options.title = this.options.title || this.element.attr('title');
346		
347		var self = this,
348			options = this.options,
349			resizeHandles = typeof options.resizable == 'string'
350				? options.resizable
351				: 'n,e,s,w,se,sw,ne,nw',
352			
353			uiDialogContent = this.element
354				.addClass('ui-dialog-content')
355				.wrap('<div/>')
356				.wrap('<div/>'),
357			
358			uiDialogContainer = (this.uiDialogContainer = uiDialogContent.parent())
359				.addClass('ui-dialog-container')
360				.css({
361					position: 'relative',
362					width: '100%',
363					height: '100%'
364				}),
365			
366			title = options.title || '&nbsp;',
367			uiDialogTitlebar = (this.uiDialogTitlebar =
368				$('<div class="ui-dialog-titlebar"/>'))
369				.append('<span class="ui-dialog-title">' + title + '</span>')
370				.append('<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>')
371				.prependTo(uiDialogContainer),
372			
373			uiDialog = (this.uiDialog = uiDialogContainer.parent())
374				.appendTo(document.body)
375				.hide()
376				.addClass('ui-dialog')
377				.addClass(options.dialogClass)
378				// add content classes to dialog
379				// to inherit theme at top level of element
380				.addClass(uiDialogContent.attr('className'))
381					.removeClass('ui-dialog-content')
382				.css({
383					position: 'absolute',
384					width: options.width,
385					height: options.height,
386					overflow: 'hidden',
387					zIndex: options.zIndex
388				})
389				// setting tabIndex makes the div focusable
390				// setting outline to 0 prevents a border on focus in Mozilla
391				.attr('tabIndex', -1).css('outline', 0).keydown(function(ev) {
392					if (options.closeOnEscape) {
393						var ESC = 27;
394						(ev.keyCode && ev.keyCode == ESC && self.close());
395					}
396				})
397				.mousedown(function() {
398					self.moveToTop();
399				}),
400			
401			uiDialogButtonPane = (this.uiDialogButtonPane = $('<div/>'))
402				.addClass('ui-dialog-buttonpane')
403				.css({
404					position: 'absolute',
405					bottom: 0
406				})
407				.appendTo(uiDialog);
408		
409		this.uiDialogTitlebarClose = $('.ui-dialog-titlebar-close', uiDialogTitlebar)
410			.hover(
411				function() {
412					$(this).addClass('ui-dialog-titlebar-close-hover');
413				},
414				function() {
415					$(this).removeClass('ui-dialog-titlebar-close-hover');
416				}
417			)
418			.mousedown(function(ev) {
419				ev.stopPropagation();
420			})
421			.click(function() {
422				self.close();
423				return false;
424			});
425		
426		uiDialogTitlebar.find("*").add(uiDialogTitlebar).each(function() {
427			$.ui.disableSelection(this);
428		});
429		
430		if ($.fn.draggable) {
431			uiDialog.draggable({
432				cancel: '.ui-dialog-content',
433				helper: options.dragHelper,
434				handle: '.ui-dialog-titlebar',
435				start: function() {
436					self.moveToTop();
437					(options.dragStart && options.dragStart.apply(self.element[0], arguments));
438				},
439				drag: function() {
440					(options.drag && options.drag.apply(self.element[0], arguments));
441				},
442				stop: function() {
443					(options.dragStop && options.dragStop.apply(self.element[0], arguments));
444					$.ui.dialog.overlay.resize();
445				}
446			});
447			(options.draggable || uiDialog.draggable('disable'));
448		}
449		
450		if ($.fn.resizable) {
451			uiDialog.resizable({
452				cancel: '.ui-dialog-content',
453				helper: options.resizeHelper,
454				maxWidth: options.maxWidth,
455				maxHeight: options.maxHeight,
456				minWidth: options.minWidth,
457				minHeight: options.minHeight,
458				start: function() {
459					(options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
460				},
461				resize: function() {
462					(options.autoResize && self.size.apply(self));
463					(options.resize && options.resize.apply(self.element[0], arguments));
464				},
465				handles: resizeHandles,
466				stop: function() {
467					(options.autoResize && self.size.apply(self));
468					(options.resizeStop && options.resizeStop.apply(self.element[0], arguments));
469					$.ui.dialog.overlay.resize();
470				}
471			});
472			(options.resizable || uiDialog.resizable('disable'));
473		}
474		
475		this.createButtons(options.buttons);
476		this.isOpen = false;
477		
478		(options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe());
479		(options.autoOpen && this.open());
480	},
481	
482	setData: function(key, value){
483		(setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));
484		switch (key) {
485			case "buttons":
486				this.createButtons(value);
487				break;
488			case "draggable":
489				this.uiDialog.draggable(value ? 'enable' : 'disable');
490				break;
491			case "height":
492				this.uiDialog.height(value);
493				break;
494			case "position":
495				this.position(value);
496				break;
497			case "resizable":
498				(typeof value == 'string' && this.uiDialog.data('handles.resizable', value));
499				this.uiDialog.resizable(value ? 'enable' : 'disable');
500				break;
501			case "title":
502				$(".ui-dialog-title", this.uiDialogTitlebar).html(value || '&nbsp;');
503				break;
504			case "width":
505				this.uiDialog.width(value);
506				break;
507		}
508		
509		$.widget.prototype.setData.apply(this, arguments);
510	},
511	
512	position: function(pos) {
513		var wnd = $(window), doc = $(document),
514			pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
515			minTop = pTop;
516		
517		if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) {
518			pos = [
519				pos == 'right' || pos == 'left' ? pos : 'center',
520				pos == 'top' || pos == 'bottom' ? pos : 'middle'
521			];
522		}
523		if (pos.constructor != Array) {
524			pos = ['center', 'middle'];
525		}
526		if (pos[0].constructor == Number) {
527			pLeft += pos[0];
528		} else {
529			switch (pos[0]) {
530				case 'left':
531					pLeft += 0;
532					break;
533				case 'right':
534					pLeft += wnd.width() - this.uiDialog.width();
535					break;
536				default:
537				case 'center':
538					pLeft += (wnd.width() - this.uiDialog.width()) / 2;
539			}
540		}
541		if (pos[1].constructor == Number) {
542			pTop += pos[1];
543		} else {
544			switch (pos[1]) {
545				case 'top':
546					pTop += 0;
547					break;
548				case 'bottom':
549					pTop += wnd.height() - this.uiDialog.height();
550					break;
551				default:
552				case 'middle':
553					pTop += (wnd.height() - this.uiDialog.height()) / 2;
554			}
555		}
556		
557		// prevent the dialog from being too high (make sure the titlebar
558		// is accessible)
559		pTop = Math.max(pTop, minTop);
560		this.uiDialog.css({top: pTop, left: pLeft});
561	},
562	
563	size: function() {
564		var container = this.uiDialogContainer,
565			titlebar = this.uiDialogTitlebar,
566			content = this.element,
567			tbMargin = (parseInt(content.css('margin-top'), 10) || 0)
568				+ (parseInt(content.css('margin-bottom'), 10) || 0),
569			lrMargin = (parseInt(content.css('margin-left'), 10) || 0)
570				+ (parseInt(content.css('margin-right'), 10) || 0);
571		content.height(container.height() - titlebar.outerHeight() - tbMargin);
572		content.width(container.width() - lrMargin);
573	},
574	
575	open: function() {
576		if (this.isOpen) { return; }
577		
578		this.overlay = this.options.modal ? new $.ui.dialog.overlay(this) : null;
579		(this.uiDialog.next().length && this.uiDialog.appendTo('body'));
580		this.position(this.options.position);
581		this.uiDialog.show(this.options.show);
582		(this.options.autoResize && this.size());
583		this.moveToTop(true);
584		
585		this.trigger('open', null, { options: this.options });
586		this.isOpen = true;
587	},
588	
589	// the force parameter allows us to move modal dialogs to their correct
590	// position on open
591	moveToTop: function(force) {
592		
593		if ((this.options.modal && !force)
594			|| (!this.options.stack && !this.options.modal)) {
595			return this.trigger('focus', null, { options: this.options });
596		}
597		
598		var maxZ = this.options.zIndex, options = this.options;
599		$('.ui-dialog:visible').each(function() {
600			maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex);
601		});
602		(this.overlay && this.overlay.$el.css('z-index', ++maxZ));
603		this.uiDialog.css('z-index', ++maxZ);
604		
605		this.trigger('focus', null, { options: this.options });
606	},
607	
608	close: function() {
609		(this.overlay && this.overlay.destroy());
610		this.uiDialog.hide(this.options.hide);
611		
612		this.trigger('close', null, { options: this.options });
613		$.ui.dialog.overlay.resize();
614		
615		this.isOpen = false;
616	},
617	
618	destroy: function() {
619		(this.overlay && this.overlay.destroy());
620		this.uiDialog.hide();
621		this.element
622			.unbind('.dialog')
623			.removeData('dialog')
624			.removeClass('ui-dialog-content')
625			.hide().appendTo('body');
626		this.uiDialog.remove();
627	},
628	
629	createButtons: function(buttons) {
630		var self = this,
631			hasButtons = false,
632			uiDialogButtonPane = this.uiDialogButtonPane;
633		
634		// remove any existing buttons
635		uiDialogButtonPane.empty().hide();
636		
637		$.each(buttons, function() { return !(hasButtons = true); });
638		if (hasButtons) {
639			uiDialogButtonPane.show();
640			$.each(buttons, function(name, fn) {
641				$('<button/>')
642					.text(name)
643					.click(function() { fn.apply(self.element[0], arguments); })
644					.appendTo(uiDialogButtonPane);
645			});
646		}
647	},
648	
649	fakeEvent: function(type) {
650		return $.event.fix({
651			type: type,
652			target: this.element[0]
653		});
654	}
655});
656
657$.extend($.ui.dialog, {
658	defaults: {
659		autoOpen: true,
660		autoResize: true,
661		bgiframe: false,
662		buttons: {},
663		closeOnEscape: true,
664		draggable: true,
665		height: 200,
666		minHeight: 100,
667		minWidth: 150,
668		modal: false,
669		overlay: {},
670		position: 'center',
671		resizable: true,
672		stack: true,
673		width: 300,
674		zIndex: 1000
675	},
676	
677	overlay: function(dialog) {
678		this.$el = $.ui.dialog.overlay.create(dialog);
679	}
680});
681
682$.extend($.ui.dialog.overlay, {
683	instances: [],
684	events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
685		function(e) { return e + '.dialog-overlay'; }).join(' '),
686	create: function(dialog) {
687		if (this.instances.length === 0) {
688			// prevent use of anchors and inputs
689			// we use a setTimeout in case the overlay is created from an
690			// event that we're going to be cancelling (see #2804)
691			setTimeout(function() {
692				$('a, :input').bind($.ui.dialog.overlay.events, function() {
693					// allow use of the element if inside a dialog and
694					// - there are no modal dialogs
695					// - there are modal dialogs, but we are in front of the topmost modal
696					var allow = false;
697					var $dialog = $(this).parents('.ui-dialog');
698					if ($dialog.length) {
699						var $overlays = $('.ui-dialog-overlay');
700						if ($overlays.length) {
701							var maxZ = parseInt($overlays.css('z-index'), 10);
702							$overlays.each(function() {
703								maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10));
704							});
705							allow = parseInt($dialog.css('z-index'), 10) > maxZ;
706						} else {
707							allow = true;
708						}
709					}
710					return allow;
711				});
712			}, 1);
713			
714			// allow closing by pressing the escape key
715			$(document).bind('keydown.dialog-overlay', function(e) {
716				var ESC = 27;
717				(e.keyCode && e.keyCode == ESC && dialog.close()); 
718			});
719			
720			// handle window resize
721			$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
722		}
723		
724		var $el = $('<div/>').appendTo(document.body)
725			.addClass('ui-dialog-overlay').css($.extend({
726				borderWidth: 0, margin: 0, padding: 0,
727				position: 'absolute', top: 0, left: 0,
728				width: this.width(),
729				height: this.height()
730			}, dialog.options.overlay));
731		
732		(dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe());
733		
734		this.instances.push($el);
735		return $el;
736	},
737	
738	destroy: function($el) {
739		this.instances.splice($.inArray(this.instances, $el), 1);
740		
741		if (this.instances.length === 0) {
742			$('a, :input').add([document, window]).unbind('.dialog-overlay');
743		}
744		
745		$el.remove();
746	},
747	
748	height: function() {
749		// handle IE 6
750		/**
751		if ($.browser.msie && $.browser.version < 7) {
752			var scrollHeight = Math.max(
753				document.documentElement.scrollHeight,
754				document.body.scrollHeight
755			);
756			var offsetHeight = Math.max(
757				document.documentElement.offsetHeight,
758				document.body.offsetHeight
759			);
760			
761			if (scrollHeight < offsetHeight) {
762				return $(window).height() + 'px';
763			} else {
764				return scrollHeight + 'px';
765			}
766		// handle Opera
767		} else if ($.browser.opera) {
768			return Math.max(
769				window.innerHeight,
770				$(document).height()
771			) + 'px';
772		// handle "good" browsers
773		} else {
774			return $(document).height() + 'px';
775		}
776		**/
777		return $(document).height() + 'px';
778	},
779	
780	width: function() {
781		// handle IE 6
782		/**
783		if ($.browser.msie && $.browser.version < 7) {
784			var scrollWidth = Math.max(
785				document.documentElement.scrollWidth,
786				document.body.scrollWidth
787			);
788			var offsetWidth = Math.max(
789				document.documentElement.offsetWidth,
790				document.body.offsetWidth
791			);
792			
793			if (scrollWidth < offsetWidth) {
794				return $(window).width() + 'px';
795			} else {
796				return scrollWidth + 'px';
797			}
798		// handle Opera
799		} else if ($.browser.opera) {
800			return Math.max(
801				window.innerWidth,
802				$(document).width()
803			) + 'px';
804		// handle "good" browsers
805		} else {
806			return $(document).width() + 'px';
807		}
808		**/
809		return $(document).width() + 'px';
810	},
811	
812	resize: function() {
813		/* If the dialog is draggable and the user drags it past the
814		 * right edge of the window, the document becomes wider so we
815		 * need to stretch the overlay. If the user then drags the
816		 * dialog back to the left, the document will become narrower,
817		 * so we need to shrink the overlay to the appropriate size.
818		 * This is handled by shrinking the overlay before setting it
819		 * to the full document size.
820		 */
821		var $overlays = $([]);
822		$.each($.ui.dialog.overlay.instances, function() {
823			$overlays = $overlays.add(this);
824		});
825		
826		$overlays.css({
827			width: 0,
828			height: 0
829		}).css({
830			width: $.ui.dialog.overlay.width(),
831			height: $.ui.dialog.overlay.height()
832		});
833	}
834});
835
836$.extend($.ui.dialog.overlay.prototype, {
837	destroy: function() {
838		$.ui.dialog.overlay.destroy(this.$el);
839	}
840});
841
842})(jQuery);
843
844/*
845 * jQuery UI Draggable
846 *
847 * Copyright (c) 2008 Paul Bakaus
848 * Dual licensed under the MIT (MIT-LICENSE.txt)
849 * and GPL (GPL-LICENSE.txt) licenses.
850 * 
851 * http://docs.jquery.com/UI/Draggables
852 *
853 * Depends:
854 *	ui.core.js
855 */
856(function($) {
857
858$.widget("ui.draggable", $.extend({}, $.ui.mouse, {
859	init: function() {
860		
861		if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
862			this.element[0].style.position = 'relative';
863		
864		(this.options.cssNamespace && this.element.addClass(this.options.cssNamespace+"-draggable"));
865		(this.options.disabled && this.element.addClass('ui-draggable-disabled'));
866		
867		this.mouseInit();
868		
869	},
870	mouseStart: function(e) {
871		
872		var o = this.options;
873		
874		if (this.helper || o.disabled || $(e.target).is('.ui-resizable-handle'))
875			return false;
876		
877		//Check if we have a valid handle
878		var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
879		$(this.options.handle, this.element).find("*").andSelf().each(function() {
880			if(this == e.target) handle = true;
881		});
882		if (!handle) return false;
883		
884		if($.ui.ddmanager)
885			$.ui.ddmanager.current = this;
886		
887		//Create and append the visible helper
888		this.helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [e])) : (o.helper == 'clone' ? this.element.clone() : this.element);
889		if(!this.helper.parents('body').length) this.helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
890		if(this.helper[0] != this.element[0] && !(/(fixed|absolute)/).test(this.helper.css("position"))) this.helper.css("position", "absolute");
891		
892		/*
893		 * - Position generation -
894		 * This block generates everything position related - it's the core of draggables.
895		 */
896		
897		this.margins = {																				//Cache the margins
898			left: (parseInt(this.element.css("marginLeft"),10) || 0),
899			top: (parseInt(this.element.css("marginTop"),10) || 0)
900		};		
901		
902		this.cssPosition = this.helper.css("position");													//Store the helper's css position
903		this.offset = this.element.offset();															//The element's absolute position on the page
904		this.offset = {																					//Substract the margins from the element's absolute offset
905			top: this.offset.top - this.margins.top,
906			left: this.offset.left - this.margins.left
907		};
908		
909		this.offset.click = {																			//Where the click happened, relative to the element
910			left: e.pageX - this.offset.left,
911			top: e.pageY - this.offset.top
912		};
913
914		this.scrollTopParent = function(el) {
915			do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode);
916			return $(document);
917		}(this.helper);
918		this.scrollLeftParent = function(el) {
919			do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);
920			return $(document);
921		}(this.helper);
922		
923		this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset();			//Get the offsetParent and cache its position
924		if(this.offsetParent[0] == document.body && $.browser.mozilla) po = { top: 0, left: 0 };		//Ugly FF3 fix
925		this.offset.parent = {																			//Store its position plus border
926			top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
927			left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
928		};
929		
930		var p = this.element.position();																//This is a relative to absolute position minus the actual position calculation - only used for relative positioned helpers
931		this.offset.relative = this.cssPosition == "relative" ? {
932			top: p.top - (parseInt(this.helper.css("top"),10) || 0) + (this.scrollTopParent[0].scrollTop || 0),
933			left: p.left - (parseInt(this.helper.css("left"),10) || 0) + (this.scrollLeftParent[0].scrollLeft || 0)
934		} : { top: 0, left: 0 };
935		
936		this.originalPosition = this.generatePosition(e);												//Generate the original position
937		this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Cache the helper size
938		
939		if(o.cursorAt) {
940			if(o.cursorAt.left != undefined) this.offset.click.left = o.cursorAt.left + this.margins.left;
941			if(o.cursorAt.right != undefined) this.offset.click.left = this.helperProportions.width - o.cursorAt.right + this.margins.left;
942			if(o.cursorAt.top != undefined) this.offset.click.top = o.cursorAt.top + this.margins.top;
943			if(o.cursorAt.bottom != undefined) this.offset.click.top = this.helperProportions.height - o.cursorAt.bottom + this.margins.top;
944		}
945		
946		
947		/*
948		 * - Position constraining -
949		 * Here we prepare position constraining like grid and containment.
950		 */	
951		
952		if(o.containment) {
953			if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
954			if(o.containment == 'document' || o.containment == 'window') this.containment = [
955				0 - this.offset.relative.left - this.offset.parent.left,
956				0 - this.offset.relative.top - this.offset.parent.top,
957				$(o.containment == 'document' ? document : window).width() - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
958				($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
959			];
960			
961			if(!(/^(document|window|parent)$/).test(o.containment)) {
962				var ce = $(o.containment)[0];
963				var co = $(o.containment).offset();
964				
965				this.containment = [
966					co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left,
967					co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top,
968					co.left+Math.max(ce.scrollWidth,ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
969					co.top+Math.max(ce.scrollHeight,ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
970				];
971			}
972		}
973		
974		//Call plugins and callbacks
975		this.propagate("start", e);
976		
977		this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size
978		if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);
979		
980		this.helper.addClass("ui-draggable-dragging");
981		this.mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position
982		return true;
983	},
984	convertPositionTo: function(d, pos) {
985		if(!pos) pos = this.position;
986		var mod = d == "absolute" ? 1 : -1;
987		return {
988			top: (
989				pos.top																	// the calculated relative position
990				+ this.offset.relative.top	* mod										// Only for relative positioned nodes: Relative offset from element to offset parent
991				+ this.offset.parent.top * mod											// The offsetParent's offset without borders (offset + border)
992				- (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.scrollTopParent[0].scrollTop) * mod	// The offsetParent's scroll position, not if the element is fixed
993				+ (this.cssPosition == "fixed" ? $(document).scrollTop() : 0) * mod
994				+ this.margins.top * mod												//Add the margin (you don't want the margin counting in intersection methods)
995			),
996			left: (
997				pos.left																// the calculated relative position
998				+ this.offset.relative.left	* mod										// Only for relative positioned nodes: Relative offset from element to offset parent
999				+ this.offset.parent.left * mod											// The offsetParent's offset without borders (offset + border)
1000				- (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.scrollLeftParent[0].scrollLeft) * mod	// The offsetParent's scroll position, not if the element is fixed
1001				+ (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0) * mod
1002				+ this.margins.left * mod												//Add the margin (you don't want the margin counting in intersection methods)
1003			)
1004		};
1005	},
1006	generatePosition: function(e) {
1007
1008		var o = this.options;
1009		var position = {
1010			top: (
1011				e.pageY																	// The absolute mouse position
1012				- this.offset.click.top													// Click offset (relative to the element)
1013				- this.offset.relative.top												// Only for relative positioned nodes: Relative offset from element to offset parent
1014				- this.offset.parent.top												// The offsetParent's offset without borders (offset + border)
1015				+ (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : (this.scrollTopParent[0].scrollTop || 0))	// The offsetParent's scroll position, not if the element is fixed
1016				- (this.cssPosition == "fixed" ? $(document).scrollTop() : 0)
1017			),
1018			left: (
1019				e.pageX																	// The absolute mouse position
1020				- this.offset.click.left												// Click offset (relative to the element)
1021				- this.offset.relative.left												// Only for relative positioned nodes: Relative offset from element to offset parent
1022				- this.offset.parent.left												// The offsetParent's offset without borders (offset + border)
1023				+ (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : (this.scrollLeftParent[0].scrollLeft || 0))	// The offsetParent's scroll position, not if the element is fixed
1024				- (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0)
1025			)
1026		};
1027	
1028		if(!this.originalPosition) return position;										//If we are not dragging yet, we won't check for options
1029		
1030		/*
1031		 * - Position constraining -
1032		 * Constrain the position to a mix of grid, containment.
1033		 */
1034		if(this.containment) {
1035			if(position.left < this.containment[0]) position.left = this.containment[0];
1036			if(position.top < this.containment[1]) position.top = this.containment[1];
1037			if(position.left > this.containment[2]) position.left = this.containment[2];
1038			if(position.top > this.containment[3]) position.top = this.containment[3];
1039		}
1040		
1041		if(o.grid) {
1042			var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1];
1043			position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
1044			
1045			var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0];
1046			position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
1047		}
1048		
1049		return position;
1050	},
1051	mouseDrag: function(e) {
1052	
1053		//Compute the helpers position
1054		this.position = this.generatePosition(e);
1055		this.positionAbs = this.convertPositionTo("absolute");
1056		
1057		//Call plugins and callbacks and use the resulting position if something is returned		
1058		this.position = this.propagate("drag", e) || this.position;
1059	
1060		if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
1061		if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
1062		if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);
1063		
1064		return false;
1065	},
1066	mouseStop: function(e) {
1067		
1068		//If we are using droppables, inform the manager about the drop
1069		var dropped = false;
1070		if ($.ui.ddmanager && !this.options.dropBehaviour)
1071			var dropped = $.ui.ddmanager.drop(this, e);		
1072		
1073		if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true) {
1074			var self = this;
1075			$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10) || 500, function() {
1076				self.propagate("stop", e);
1077				self.clear();
1078			});
1079		} else {
1080			this.propagate("stop", e);
1081			this.clear();
1082		}
1083		
1084		return false;
1085	},
1086	clear: function() {
1087		this.helper.removeClass("ui-draggable-dragging");
1088		if(this.options.helper != 'original' && !this.cancelHelperRemoval) this.helper.remove();
1089		//if($.ui.ddmanager) $.ui.ddmanager.current = null;
1090		this.helper = null;
1091		this.cancelHelperRemoval = false;
1092	},
1093	
1094	// From now on bulk stuff - mainly helpers
1095	plugins: {},
1096	uiHash: function(e) {
1097		return {
1098			helper: this.helper,
1099			position: this.position,
1100			absolutePosition: this.positionAbs,
1101			options: this.options			
1102		};
1103	},
1104	propagate: function(n,e) {
1105		$.ui.plugin.call(this, n, [e, this.uiHash()]);
1106		if(n == "drag") this.positionAbs = this.convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
1107		return this.element.triggerHandler(n == "drag" ? n : "drag"+n, [e, this.uiHash()], this.options[n]);
1108	},
1109	destroy: function() {
1110		if(!this.element.data('draggable')) return;
1111		this.element.removeData("draggable").unbind(".draggable").removeClass('ui-draggable-dragging ui-draggable-disabled');
1112		this.mouseDestroy();
1113	}
1114}));
1115
1116$.extend($.ui.draggable, {
1117	defaults: {
1118		appendTo: "parent",
1119		axis: false,
1120		cancel: ":input",
1121		delay: 0,
1122		distance: 1,
1123		helper: "original",
1124		scope: "default",
1125		cssNamespace: "ui"
1126	}
1127});
1128
1129$.ui.plugin.add("draggable", "cursor", {
1130	start: function(e, ui) {
1131		var t = $('body');
1132		if (t.css("cursor")) ui.options._cursor = t.css("cursor");
1133		t.css("cursor", ui.options.cursor);
1134	},
1135	stop: function(e, ui) {
1136		if (ui.options._cursor) $('body').css("cursor", ui.options._cursor);
1137	}
1138});
1139
1140$.ui.plugin.add("draggable", "zIndex", {
1141	start: function(e, ui) {
1142		var t = $(ui.helper);
1143		if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex");
1144		t.css('zIndex', ui.options.zIndex);
1145	},
1146	stop: function(e, ui) {
1147		if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex);
1148	}
1149});
1150
1151$.ui.plugin.add("draggable", "opacity", {
1152	start: function(e, ui) {
1153		var t = $(ui.helper);
1154		if(t.css("opacity")) ui.options._opacity = t.css("opacity");
1155		t.css('opacity', ui.options.opacity);
1156	},
1157	stop: function(e, ui) {
1158		if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity);
1159	}
1160});
1161
1162$.ui.plugin.add("draggable", "iframeFix", {
1163	start: function(e, ui) {
1164		$(ui.options.iframeFix === true ? "iframe" : ui.options.iframeFix).each(function() {					
1165			$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
1166			.css({
1167				width: this.offsetWidth+"px", height: this.offsetHeight+"px",
1168				position: "absolute", opacity: "0.001", zIndex: 1000
1169			})
1170			.css($(this).offset())
1171			.appendTo("body");
1172		});
1173	},
1174	stop: function(e, ui) {
1175		$("div.DragDropIframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers	
1176	}
1177});
1178
1179
1180
1181$.ui.plugin.add("draggable", "scroll", {
1182	start: function(e, ui) {
1183		var o = ui.options;
1184		var i = $(this).data("draggable");
1185		o.scrollSensitivity	= o.scrollSensitivity || 20;
1186		o.scrollSpeed		= o.scrollSpeed || 20;
1187		
1188		i.overflowY = function(el) {
1189			do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode);
1190			return $(document);
1191		}(this);
1192		i.overflowX = function(el) {
1193			do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);
1194			return $(document);
1195		}(this);
1196		
1197		if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset();
1198		if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset();
1199		
1200	},
1201	drag: function(e, ui) {
1202		
1203		var o = ui.options, scrolled = false;
1204		var i = $(this).data("draggable");
1205		
1206		if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {
1207			if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity)
1208				i.overflowY[0].scrollTop = scrolled = i.overflowY[0].scrollTop + o.scrollSpeed;
1209			if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity)
1210				i.overflowY[0].scrollTop = scrolled = i.overflowY[0].scrollTop - o.scrollSpeed;
1211							
1212		} else {
1213			if(e.pageY - $(document).scrollTop() < o.scrollSensitivity)
1214				scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
1215			if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity)
1216				scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
1217		}
1218		
1219		if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {
1220			if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity)
1221				i.overflowX[0].scrollLeft = scrolled = i.overflowX[0].scrollLeft + o.scrollSpeed;
1222			if(e.pageX - i.overflowXOffset.left < o.scrollSensitivity)
1223				i.overflowX[0].scrollLeft = scrolled = i.overflowX[0].scrollLeft - o.scrollSpeed;
1224		} else {
1225			if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity)
1226				scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
1227			if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
1228				scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
1229		}
1230		
1231		if(scrolled !== false)
1232			$.ui.ddmanager.prepareOffsets(i, e);
1233		
1234	}
1235});
1236
1237
1238$.ui.plugin.add("draggable", "snap", {
1239	start: function(e, ui) {
1240		
1241		var inst = $(this).data("draggable");
1242		inst.snapElements = [];
1243
1244		$(ui.options.snap.constructor != String ? ( ui.options.snap.items || ':data(draggable)' ) : ui.options.snap).each(function() {
1245			var $t = $(this); var $o = $t.offset();
1246			if(this != inst.element[0]) inst.snapElements.push({
1247				item: this,
1248				width: $t.outerWidth(), height: $t.outerHeight(),
1249				top: $o.top, left: $o.left
1250			});
1251		});
1252		
1253	},
1254	drag: function(e, ui) {
1255	
1256		var inst = $(this).data("draggable");
1257		var d = ui.options.snapTolerance || 20;
1258		var x1 = ui.absolutePosition.left, x2 = x1 + inst.helperProportions.width,
1259			y1 = ui.absolutePosition.top, y2 = y1 + inst.helperProportions.height;
1260		
1261		for (var i = inst.snapElements.length - 1; i >= 0; i--){
1262			
1263			var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, 
1264				t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
1265			
1266			//Yes, I know, this is insane ;)
1267			if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
1268				if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, null, $.extend(inst.uiHash(), { snapItem: inst.snapElements[i].item })));
1269				inst.snapElements[i].snapping = false;
1270				continue;
1271			}
1272			
1273			if(ui.options.snapMode != 'inner') {
1274				var ts = Math.abs(t - y2) <= 20;
1275				var bs = Math.abs(b - y1) <= 20;
1276				var ls = Math.abs(l - x2) <= 20;
1277				var rs = Math.abs(r - x1) <= 20;
1278				if(ts) ui.position.top = inst.convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
1279				if(bs) ui.position.top = inst.convertPositionTo("relative", { top: b, left: 0 }).top;
1280				if(ls) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
1281				if(rs) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: r }).left;
1282			}
1283			
1284			var first = (ts || bs || ls || rs);
1285			
1286			if(ui.options.snapMode != 'outer') {
1287				var ts = Math.abs(t - y1) <= 20;
1288				var bs = Math.abs(b - y2) <= 20;
1289				var ls = Math.abs(l - x1) <= 20;
1290				var rs = Math.abs(r - x2) <= 20;
1291				if(ts) ui.position.top = inst.convertPositionTo("relative", { top: t, left: 0 }).top;
1292				if(bs) ui.position.top = inst.convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
1293				if(ls) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: l }).left;
1294				if(rs) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
1295			}
1296			
1297			if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
1298				(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, null, $.extend(inst.uiHash(), { snapItem: inst.snapElements[i].item })));
1299			inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
1300			
1301		};
1302
1303	}
1304}
1304);
1305
1306$.ui.plugin.add("draggable", "connectToSortable", {
1307	start: function(e,ui) {
1308	
1309		var inst = $(this).data("draggable");
1310		inst.sortables = [];
1311		$(ui.options.connectToSortable).each(function() {
1312			if($.data(this, 'sortable')) {
1313				var sortable = $.data(this, 'sortable');
1314				inst.sortables.push({
1315					instance: sortable,
1316					shouldRevert: sortable.options.revert
1317				});
1318				sortable.refreshItems();	//Do a one-time refresh at start to refresh the containerCache	
1319				sortable.propagate("activate", e, inst);
1320			}
1321		});
1322
1323	},
1324	stop: function(e,ui) {
1325		
1326		//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
1327		var inst = $(this).data("draggable");
1328		
1329		$.each(inst.sortables, function() {
1330			if(this.instance.isOver) {
1331				this.instance.isOver = 0;
1332				inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
1333				this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
1334				if(this.shouldRevert) this.instance.options.revert = true; //revert here
1335				this.instance.mouseStop(e);
1336				
1337				//Also propagate receive event, since the sortable is actually receiving a element
1338				this.instance.element.triggerHandler("sortreceive", [e, $.extend(this.instance.ui(), { sender: inst.element })], this.instance.options["receive"]);
1339
1340				this.instance.options.helper = this.instance.options._helper;
1341			} else {
1342				this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
1343				this.instance.propagate("deactivate", e, inst);
1344			}
1345
1346		});
1347		
1348	},
1349	drag: function(e,ui) {
1350
1351		var inst = $(this).data("draggable"), self = this;
1352		
1353		var checkPos = function(o) {
1354				
1355			var l = o.left, r = l + o.width,
1356				t = o.top, b = t + o.height;
1357
1358			return (l < (this.positionAbs.left + this.offset.click.left) && (this.positionAbs.left + this.offset.click.left) < r
1359					&& t < (this.positionAbs.top + this.offset.click.top) && (this.positionAbs.top + this.offset.click.top) < b);				
1360		};
1361		
1362		$.each(inst.sortables, function(i) {
1363
1364			if(checkPos.call(inst, this.instance.containerCache)) {
1365
1366				//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
1367				if(!this.instance.isOver) {
1368					this.instance.isOver = 1;
1369
1370					//Now we fake the start of dragging for the sortable instance,
1371					//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
1372					//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)
1373					this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
1374					this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
1375					this.instance.options.helper = function() { return ui.helper[0]; };
1376				
1377					e.target = this.instance.currentItem[0];
1378					this.instance.mouseCapture(e, true);
1379					this.instance.mouseStart(e, true, true);
1380
1381					//Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
1382					this.instance.offset.click.top = inst.offset.click.top;
1383					this.instance.offset.click.left = inst.offset.click.left;
1384					this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
1385					this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
1386					
1387					inst.propagate("toSortable", e);
1388				
1389				}
1390				
1391				//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
1392				if(this.instance.currentItem) this.instance.mouseDrag(e);
1393				
1394			} else {
1395				
1396				//If it doesn't intersect with the sortable, and it intersected before,
1397				//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
1398				if(this.instance.isOver) {
1399					this.instance.isOver = 0;
1400					this.instance.cancelHelperRemoval = true;
1401					this.instance.options.revert = false; //No revert here
1402					this.instance.mouseStop(e, true);
1403					this.instance.options.helper = this.instance.options._helper;
1404					
1405					//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
1406					this.instance.currentItem.remove();
1407					if(this.instance.placeholder) this.instance.placeholder.remove();
1408					
1409					inst.propagate("fromSortable", e);
1410				}
1411				
1412			};
1413
1414		});
1415
1416	}
1417});
1418
1419$.ui.plugin.add("draggable", "stack", {
1420	start: function(e,ui) {
1421		var group = $.makeArray($(ui.options.stack.group)).sort(function(a,b) {
1422			return (parseInt($(a).css("zIndex"),10) || ui.options.stack.min) - (parseInt($(b).css("zIndex"),10) || ui.options.stack.min);
1423		});
1424		
1425		$(group).each(function(i) {
1426			this.style.zIndex = ui.options.stack.min + i;
1427		});
1428		
1429		this[0].style.zIndex = ui.options.stack.min + group.length;
1430	}
1431});
1432
1433})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.