CLICK HERE TO BUY IT TODAY! OR GET IT FREE VIA TRIALPAY  

PHP Demo Application - Source Code

/Framework/Model/Vendor/jquery-ui/js/jquery-ui.js



/*!
 * jQuery UI 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function( $, undefined ) {
	// prevent duplicate loading
	// this is only a problem because we proxy existing functions
	// and we don't want to double proxy them
	$.ui = $.ui || {};
	if ( $.ui.version ) {
		    return;
		}
	$.extend( $.ui, {
		    version"1.8.5",
		    keyCode: {
			        ALT18,
			        BACKSPACE8,
			        CAPS_LOCK20,
			        COMMA188,
			        COMMAND91,
			        COMMAND_LEFT91// COMMAND
			        COMMAND_RIGHT93,
			        CONTROL17,
			        DELETE46,
			        DOWN40,
			        END35,
			        ENTER13,
			        ESCAPE27,
			        HOME36,
			        INSERT45,
			        LEFT37,
			        MENU93// COMMAND_RIGHT
			        NUMPAD_ADD107,
			        NUMPAD_DECIMAL110,
			        NUMPAD_DIVIDE111,
			        NUMPAD_ENTER108,
			        NUMPAD_MULTIPLY106,
			        NUMPAD_SUBTRACT109,
			        PAGE_DOWN34,
			        PAGE_UP33,
			        PERIOD190,
			        RIGHT39,
			        SHIFT16,
			        SPACE32,
			        TAB9,
			        UP38,
			        WINDOWS91 // COMMAND
			    }
		});
	// plugins
	$.fn.extend({
		    _focus: $.fn.focus,
		    focus: function( delayfn ) {
			        return typeof delay === "number" ?
			            this.each(function() {
				                var elem this;
				                setTimeout(function() {
					                    $( elem ).focus();
					                    if ( fn ) {
						                        fn.callelem );
						                    }
					                }, delay );
				            }) :
			            this._focus.applythisarguments );
			    },
		    scrollParent: function() {
			        var scrollParent;
			        if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
				            scrollParent this.parents().filter(function() {
					                return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
					            }).eq(0);
				        } else {
				            scrollParent this.parents().filter(function() {
					                return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
					            }).eq(0);
				        }
			        return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
			    },
		    zIndex: function( zIndex ) {
			        if ( zIndex !== undefined ) {
				            return this.css"zIndex"zIndex );
				        }
			        if ( this.length ) {
				            var elem = $( this] ), positionvalue;
				            while ( elem.length && elem] !== document ) {
					                // Ignore z-index if position is set to a value where z-index is ignored by the browser
					                // This makes behavior of this function consistent across browsers
					                // WebKit always returns auto if the element is positioned
					                position elem.css"position" );
					                if ( position === "absolute" || position === "relative" || position === "fixed" ) {
						                    // IE returns 0 when zIndex is not specified
						                    // other browsers return a string
						                    // we ignore the case of nested elements with an explicit value of 0
						                    // <div style="z-index: -10;
						"><div style="z-index0;
						"></div></div>
						                    value = parseInt( elem.css( "zIndex" ) );
						                    if ( !isNaN( value ) && value != 0 ) {
							                        return value;
							                    }
						                }
					                elem = elem.parent();
					            }
				        }
			        return 0;
			    },
		    disableSelection: function() {
			        return this.bind(
			            "mousedown.ui-disableSelection selectstart.ui-disableSelection",
			            function( event ) {
				                event.preventDefault();
				            });
			    },
		    enableSelection: function() {
			        return this.unbind( ".ui-disableSelection" );
			    }
		});
	$.each( [ "Width", "Height" ], function( i, name ) {
		    var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
		        type = name.toLowerCase(),
		        orig = {
			            innerWidth: $.fn.innerWidth,
			            innerHeight: $.fn.innerHeight,
			            outerWidth: $.fn.outerWidth,
			            outerHeight: $.fn.outerHeight
			        };
		    function reduce( elem, size, border, margin ) {
			        $.each( side, function() {
				            size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
				            if ( border ) {
					                size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
					            }
				            if ( margin ) {
					                size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
					            }
				        });
			        return size;
			    }
		    $.fn[ "inner" + name ] = function( size ) {
			        if ( size === undefined ) {
				            return orig[ "inner" + name ].call( this );
				        }
			        return this.each(function() {
				            $.style( this, type, reduce( this, size ) + "px" );
				        });
			    };
		    $.fn[ "outer" + name] = function( size, margin ) {
			        if ( typeof size !== "number" ) {
				            return orig[ "outer" + name ].call( this, size );
				        }
			        return this.each(function() {
				            $.style( this, type, reduce( this, size, true, margin ) + "px" );
				        });
			    };
		});
	// selectors
	function visible( element ) {
		    return !$( element ).parents().andSelf().filter(function() {
			        return $.curCSS( this, "visibility" ) === "hidden" ||
			            $.expr.filters.hidden( this );
			    }).length;
		}
	$.extend( $.expr[ ":" ], {
		    data: function( elem, i, match ) {
			        return !!$.data( elem, match[ 3 ] );
			    },
		    focusable: function( element ) {
			        var nodeName = element.nodeName.toLowerCase(),
			            tabIndex = $.attr( element, "tabindex" );
			        if ( "area" === nodeName ) {
				            var map = element.parentNode,
				                mapName = map.name,
				                img;
				            if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
					                return false;
					            }
				            img = $( "img[usemap=#" + mapName + "]" )[0];
				            return !!img && visibleimg );
				        }
			        return ( /input|select|textarea|button|object/.testnodeName )
			            ? !element.disabled
			            "a" == nodeName
			                element.href || !isNaNtabIndex )
			                : !isNaNtabIndex ))
			            // the element and all of its ancestors must be visible
			            && visibleelement );
			    },
		    tabbable: function( element ) {
			        var tabIndex = $.attrelement"tabindex" );
			        return ( isNaNtabIndex ) || tabIndex >= ) && $( element ).is":focusable" );
			    }
		});
	// support
	$(function() {
		    var div document.createElement"div" ),
		        body document.body;
		    $.extenddiv.style, {
			        minHeight"100px",
			        height"auto",
			        padding0,
			        borderWidth0
			    });
		    $.support.minHeight body.appendChilddiv ).offsetHeight === 100;
		    // set display to none to avoid a layout bug in IE
		    // http://dev.jquery.com/ticket/4014
		    body.removeChilddiv ).style.display "none";
		});
	// deprecated
	$.extend( $.ui, {
		    // $.ui.plugin is deprecated.  Use the proxy pattern instead.
		    plugin: {
			        add: function( moduleoptionset ) {
				            var proto = $.uimodule ].prototype;
				            for ( var i in set ) {
					                proto.plugins] = proto.plugins] || [];
					                proto.plugins].push( [ optionset] ] );
					            }
				        },
			        call: function( instancenameargs ) {
				            var set instance.pluginsname ];
				            if ( !set || !instance.element].parentNode ) {
					                return;
					            }
				            for ( var 0;
				 set.length;
				 i++ ) {
					                if ( instance.optionsset][ ] ] ) {
						                    set][ ].applyinstance.elementargs );
						                }
					            }
				        }
			    },
		    // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
		    contains: function( a) {
			        return document.compareDocumentPosition ?
			            a.compareDocumentPosition) & 16 :
			            !== && a.contains);
			    },
		    // only used by resizable
		    hasScroll: function( el) {
			        //If overflow is hidden, the element might have extra content, but the user wants to hide it
			        if ( $( el ).css"overflow" ) === "hidden") {
				            return false;
				        }
			        var scroll = ( && === "left" ) ? "scrollLeft" "scrollTop",
			            has false;
			        if ( elscroll ] > ) {
				            return true;
				        }
			        // TODO: determine which cases actually cause this to happen
			        // if the element doesn't have the scroll set, see if it's possible to
			        // set the scroll
			        elscroll ] = 1;
			        has = ( elscroll ] > );
			        elscroll ] = 0;
			        return has;
			    },
		    // these are odd functions, fix the API or move into individual plugins
		    isOverAxis: function( xreferencesize ) {
			        //Determines when x coordinate is over "b" element axis
			        return ( reference ) && ( < ( reference size ) );
			    },
		    isOver: function( yxtopleftheightwidth ) {
			        //Determines when x, y coordinates is over "b" element
			        return $.ui.isOverAxisytopheight ) && $.ui.isOverAxisxleftwidth );
			    }
		});
	})( jQuery );
/*!
 * jQuery UI Widget 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function( $, undefined ) {
	// jQuery 1.4+
	if ( $.cleanData ) {
		    var _cleanData = $.cleanData;
		    $.cleanData = function( elems ) {
			        for ( var 0elem;
			 (elem elems[i]) != null;
			 i++ ) {
				            $( elem ).triggerHandler"remove" );
				        }
			        _cleanDataelems );
			    };
		} else {
		    var _remove = $.fn.remove;
		    $.fn.remove = function( selectorkeepData ) {
			        return this.each(function() {
				            if ( !keepData ) {
					                if ( !selector || $.filterselector, [ this ] ).length ) {
						                    $( "*"this ).add( [ this ] ).each(function() {
							                        $( this ).triggerHandler"remove" );
							                    });
						                }
					            }
				            return _remove.call( $(this), selectorkeepData );
				        });
			    };
		}
	$.widget = function( namebaseprototype ) {
		    var namespace = name.split"." )[ ],
		        fullName;
		    name name.split"." )[ ];
		    fullName = namespace + "-" name;
		    if ( !prototype ) {
			        prototype base;
			        base = $.Widget;
			    }
		    // create selector for plugin
		    $.expr":" ][ fullName ] = function( elem ) {
			        return !!$.dataelemname );
			    };
		    $[ namespace ] = $[ namespace ] || {};
		    $[ namespace ][ name ] = function( optionselement ) {
			        // allow instantiation without initializing for simple inheritance
			        if ( arguments.length ) {
				            this._createWidgetoptionselement );
				        }
			    };
		    var basePrototype = new base();
		    // we need to make the options hash a property directly on the new instance
		    // otherwise we'll modify the options hash on the prototype that we're
		    // inheriting from
		//    $.each( basePrototype, function( key, val ) {
			//        if ( $.isPlainObject(val) ) {
				//            basePrototype[ key ] = $.extend( {}, val );
				//        }
			//    });
		    basePrototype.options = $.extendtrue{}basePrototype.options );
		    $[ namespace ][ name ].prototype = $.extendtruebasePrototype, {
			        namespace: namespace,
			        widgetNamename,
			        widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
			        widgetBaseClassfullName
			    }, prototype );
		    $.widget.bridgename, $[ namespace ][ name ] );
		};
	$.widget.bridge = function( nameobject ) {
		    $.fnname ] = function( options ) {
			        var isMethodCall typeof options === "string",
			            args = Array.prototype.slice.callarguments),
			            returnValue this;
			        // allow multiple hashes to be passed on init
			        options = !isMethodCall && args.length ?
			            $.extend.applynull, [ trueoptions ].concat(args) ) :
			            options;
			        // prevent calls to internal methods
			        if ( isMethodCall && options.substring0) === "_" ) {
				            return returnValue;
				        }
			        if ( isMethodCall ) {
				            this.each(function() {
					                var instance = $.datathisname );
					                if ( !instance ) {
						                    throw "cannot call methods on " name " prior to initialization;
						 " +
						                        "attempted to call method '" options "'";
						                }
					                if ( !$.isFunctioninstance[options] ) ) {
						                    throw "no such method '" options "' for " name " widget instance";
						                }
					                var methodValue instanceoptions ].applyinstanceargs );
					                if ( methodValue !== instance && methodValue !== undefined ) {
						                    returnValue methodValue;
						                    return false;
						                }
					            });
				        } else {
				            this.each(function() {
					                var instance = $.datathisname );
					                if ( instance ) {
						                    instance.optionoptions || {} )._init();
						                } else {
						                    $.datathisname, new objectoptionsthis ) );
						                }
					            });
				        }
			        return returnValue;
			    };
		};
	$.Widget = function( optionselement ) {
		    // allow instantiation without initializing for simple inheritance
		    if ( arguments.length ) {
			        this._createWidgetoptionselement );
			    }
		};
	$.Widget.prototype = {
		    widgetName"widget",
		    widgetEventPrefix"",
		    options: {
			        disabledfalse
			    },
		    _createWidget: function( optionselement ) {
			        // $.widget.bridge stores the plugin instance, but we do it anyway
			        // so that it's stored even before the _create function runs
			        $.dataelementthis.widgetNamethis );
			        this.element = $( element );
			        this.options = $.extendtrue{},
			            this.options,
			            $.metadata && $.metadata.getelement )[ this.widgetName ],
			            options );
			        var self this;
			        this.element.bind"remove." this.widgetName, function() {
				            self.destroy();
				        });
			        this._create();
			        this._init();
			    },
		    _create: function() {},
		    _init: function() {},
		    destroy: function() {
			        this.element
			            .unbind"." this.widgetName )
			            .removeDatathis.widgetName );
			        this.widget()
			            .unbind"." this.widgetName )
			            .removeAttr"aria-disabled" )
			            .removeClass(
			                this.widgetBaseClass "-disabled " +
			                "ui-state-disabled" );
			    },
		    widget: function() {
			        return this.element;
			    },
		    option: function( keyvalue ) {
			        var options key,
			            self this;
			        if ( arguments.length === ) {
				            // don't return a reference to the internal hash
				            return $.extend{}self.options );
				        }
			        if  (typeof key === "string" ) {
				            if ( value === undefined ) {
					                return this.optionskey ];
					            }
				            options {};
				            optionskey ] = value;
				        }
			        $.eachoptions, function( keyvalue ) {
				            self._setOptionkeyvalue );
				        });
			        return self;
			    },
		    _setOption: function( keyvalue ) {
			        this.optionskey ] = value;
			        if ( key === "disabled" ) {
				            this.widget()
				                [ value "addClass" "removeClass"](
				                    this.widgetBaseClass "-disabled" " " +
				                    "ui-state-disabled" )
				                .attr"aria-disabled"value );
				        }
			        return this;
			    },
		    enable: function() {
			        return this._setOption"disabled"false );
			    },
		    disable: function() {
			        return this._setOption"disabled"true );
			    },
		    _trigger: function( typeeventdata ) {
			        var callback this.optionstype ];
			        event = $.Eventevent );
			        event.type = ( type === this.widgetEventPrefix ?
			            type :
			            this.widgetEventPrefix type ).toLowerCase();
			        data data || {};
			        // copy original event properties over to the new event
			        // this would happen if we could call $.event.fix instead of $.Event
			        // but we don't have a way to force an event to be fixed multiple times
			        if ( event.originalEvent ) {
				            for ( var = $.event.props.lengthprop;
				 i;
				 ) {
					                prop = $.event.props[ --];
					                eventprop ] = event.originalEventprop ];
					            }
				        }
			        this.element.triggereventdata );
			        return !( $.isFunction(callback) &&
			            callback.callthis.element[0], eventdata ) === false ||
			            event.isDefaultPrevented() );
			    }
		};
	})( jQuery );
/*!
 * jQuery UI Mouse 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *    jquery.ui.widget.js
 */
(function( $, undefined ) {
	$.widget("ui.mouse", {
		    options: {
			        cancel':input,option',
			        distance1,
			        delay0
			    },
		    _mouseInit: function() {
			        var self this;
			        this.element
			            .bind('mousedown.'+this.widgetName, function(event) {
				                return self._mouseDown(event);
				            })
			            .bind('click.'+this.widgetName, function(event) {
				                if(self._preventClickEvent) {
					                    self._preventClickEvent false;
					                    event.stopImmediatePropagation();
					                    return false;
					                }
				            });
			        this.started false;
			    },
		    // TODO: make sure destroying one instance of mouse doesn't mess with
		    // other instances of mouse
		    _mouseDestroy: function() {
			        this.element.unbind('.'+this.widgetName);
			    },
		    _mouseDown: function(event) {
			        // don't let more than one widget handle mouseStart
			        // TODO: figure out why we have to use originalEvent
			        event.originalEvent event.originalEvent || {};
			        if (event.originalEvent.mouseHandled) {
				return;
				}
			        // we may have missed mouseup (out of window)
			        (this._mouseStarted && this._mouseUp(event));
			        this._mouseDownEvent event;
			        var self this,
			            btnIsLeft = (event.which == 1),
			            elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length false);
			        if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
				            return true;
				        }
			        this.mouseDelayMet = !this.options.delay;
			        if (!this.mouseDelayMet) {
				            this._mouseDelayTimer setTimeout(function() {
					                self.mouseDelayMet true;
					            }, this.options.delay);
				        }
			        if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
				            this._mouseStarted = (this._mouseStart(event) !== false);
				            if (!this._mouseStarted) {
					                event.preventDefault();
					                return true;
					            }
				        }
			        // these delegates are required to keep context
			        this._mouseMoveDelegate = function(event) {
				            return self._mouseMove(event);
				        };
			        this._mouseUpDelegate = function(event) {
				            return self._mouseUp(event);
				        };
			        $(document)
			            .bind('mousemove.'+this.widgetNamethis._mouseMoveDelegate)
			            .bind('mouseup.'+this.widgetNamethis._mouseUpDelegate);
			        // preventDefault() is used to prevent the selection of text here -
			        // however, in Safari, this causes select boxes not to be selectable
			        // anymore, so this fix is needed
			        ($.browser.safari || event.preventDefault());
			        event.originalEvent.mouseHandled true;
			        return true;
			    },
		    _mouseMove: function(event) {
			        // IE mouseup check - mouseup happened when mouse was out of window
			        if ($.browser.msie && !event.button) {
				            return this._mouseUp(event);
				        }
			        if (this._mouseStarted) {
				            this._mouseDrag(event);
				            return event.preventDefault();
				        }
			        if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
				            this._mouseStarted =
				                (this._mouseStart(this._mouseDownEventevent) !== false);
				            (this._mouseStarted this._mouseDrag(event) : this._mouseUp(event));
				        }
			        return !this._mouseStarted;
			    },
		    _mouseUp: function(event) {
			        $(document)
			            .unbind('mousemove.'+this.widgetNamethis._mouseMoveDelegate)
			            .unbind('mouseup.'+this.widgetNamethis._mouseUpDelegate);
			        if (this._mouseStarted) {
				            this._mouseStarted false;
				            this._preventClickEvent = (event.target == this._mouseDownEvent.target);
				            this._mouseStop(event);
				        }
			        return false;
			    },
		    _mouseDistanceMet: function(event) {
			        return (Math.max(
			                Math.abs(this._mouseDownEvent.pageX event.pageX),
			                Math.abs(this._mouseDownEvent.pageY event.pageY)
			            ) >= this.options.distance
			        );
			    },
		    _mouseDelayMet: function(event) {
			        return this.mouseDelayMet;
			    },
		    // These are placeholder methods, to be overriden by extending plugin
		    _mouseStart: function(event{},
		    _mouseDrag: function(event{},
		    _mouseStop: function(event{},
		    _mouseCapture: function(event) {
			return true;
			}
		});
	})(jQuery);
/*
 * jQuery UI Draggable 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Draggables
 *
 * Depends:
 *    jquery.ui.core.js
 *    jquery.ui.mouse.js
 *    jquery.ui.widget.js
 */
(function( $, undefined ) {
	$.widget("ui.draggable", $.ui.mouse, {
		    widgetEventPrefix"drag",
		    options: {
			        addClassestrue,
			        appendTo"parent",
			        axisfalse,
			        connectToSortablefalse,
			        containmentfalse,
			        cursor"auto",
			        cursorAtfalse,
			        gridfalse,
			        handlefalse,
			        helper"original",
			        iframeFixfalse,
			        opacityfalse,
			        refreshPositionsfalse,
			        revertfalse,
			        revertDuration500,
			        scope"default",
			        scrolltrue,
			        scrollSensitivity20,
			        scrollSpeed20,
			        snapfalse,
			        snapMode"both",
			        snapTolerance20,
			        stackfalse,
			        zIndexfalse
			    },
		    _create: function() {
			        if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
			            this.element[0].style.position 'relative';
			        (this.options.addClasses && this.element.addClass("ui-draggable"));
			        (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
			        this._mouseInit();
			    },
		    destroy: function() {
			        if(!this.element.data('draggable')) return;
			        this.element
			            .removeData("draggable")
			            .unbind(".draggable")
			            .removeClass("ui-draggable"
			                " ui-draggable-dragging"
			                " ui-draggable-disabled");
			        this._mouseDestroy();
			        return this;
			    },
		    _mouseCapture: function(event) {
			        var this.options;
			        // among others, prevent a drag on a resizable-handle
			        if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
			            return false;
			        //Quit if we're not on a valid handle
			        this.handle this._getHandle(event);
			        if (!this.handle)
			            return false;
			        return true;
			    },
		    _mouseStart: function(event) {
			        var this.options;
			        //Create and append the visible helper
			        this.helper this._createHelper(event);
			        //Cache the helper size
			        this._cacheHelperProportions();
			        //If ddmanager is used for droppables, set the global draggable
			        if($.ui.ddmanager)
			            $.ui.ddmanager.current this;
			        /*
			         * - Position generation -
			         * This block generates everything position related - it's the core of draggables.
			         */
			        //Cache the margins of the original element
			        this._cacheMargins();
			        //Store the helper's css position
			        this.cssPosition this.helper.css("position");
			        this.scrollParent this.helper.scrollParent();
			        //The element's absolute position on the page minus margins
			        this.offset this.positionAbs this.element.offset();
			        this.offset = {
				            topthis.offset.top this.margins.top,
				            leftthis.offset.left this.margins.left
				        };
			        $.extend(this.offset, {
				            click: { //Where the click happened, relative to the element
					                leftevent.pageX this.offset.left,
					                topevent.pageY this.offset.top
					            },
				            parentthis._getParentOffset(),
				            relativethis._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
				        });
			        //Generate the original position
			        this.originalPosition this.position this._generatePosition(event);
			        this.originalPageX event.pageX;
			        this.originalPageY event.pageY;
			        //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
			        (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
			        //Set a containment if given in the options
			        if(o.containment)
			            this._setContainment();
			        //Trigger event + callbacks
			        if(this._trigger("start"event) === false) {
				            this._clear();
				            return false;
				        }
			        //Recache the helper size
			        this._cacheHelperProportions();
			        //Prepare the droppable offsets
			        if ($.ui.ddmanager && !o.dropBehaviour)
			            $.ui.ddmanager.prepareOffsets(thisevent);
			        this.helper.addClass("ui-draggable-dragging");
			        this._mouseDrag(eventtrue);
			 //Execute the drag once - this causes the helper not to be visible before getting its correct position
			        return true;
			    },
		    _mouseDrag: function(eventnoPropagation) {
			        //Compute the helpers position
			        this.position this._generatePosition(event);
			        this.positionAbs this._convertPositionTo("absolute");
			        //Call plugins and callbacks and use the resulting position if something is returned
			        if (!noPropagation) {
				            var ui this._uiHash();
				            if(this._trigger('drag'eventui) === false) {
					                this._mouseUp({});
					                return false;
					            }
				            this.position ui.position;
				        }
			        if(!this.options.axis || this.options.axis != "y"this.helper[0].style.left this.position.left+'px';
			        if(!this.options.axis || this.options.axis != "x"this.helper[0].style.top this.position.top+'px';
			        if($.ui.ddmanager) $.ui.ddmanager.drag(thisevent);
			        return false;
			    },
		    _mouseStop: function(event) {
			        //If we are using droppables, inform the manager about the drop
			        var dropped false;
			        if ($.ui.ddmanager && !this.options.dropBehaviour)
			            dropped = $.ui.ddmanager.drop(thisevent);
			        //if a drop comes from outside (a sortable)
			        if(this.dropped) {
				            dropped this.dropped;
				            this.dropped false;
				        }
			        //if the original element is removed, don't bother to continue
			        if(!this.element[0] || !this.element[0].parentNode)
			            return false;
			        if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.elementdropped))) {
				            var self this;
				            $(this.helper).animate(this.originalPositionparseInt(this.options.revertDuration10), function() {
					                if(self._trigger("stop"event) !== false) {
						                    self._clear();
						                }
					            });
				        } else {
				            if(this._trigger("stop"event) !== false) {
					                this._clear();
					            }
				        }
			        return false;
			    },
		    cancel: function() {
			        if(this.helper.is(".ui-draggable-dragging")) {
				            this._mouseUp({});
				        } else {
				            this._clear();
				        }
			        return this;
			    },
		    _getHandle: function(event) {
			        var handle = !this.options.handle || !$(this.options.handlethis.element).length true false;
			        $(this.options.handlethis.element)
			            .find("*")
			            .andSelf()
			            .each(function() {
				                if(this == event.targethandle true;
				            });
			        return handle;
			    },
		    _createHelper: function(event) {
			        var this.options;
			        var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' this.element.clone() : this.element);
			        if(!helper.parents('body').length)
			            helper.appendTo((o.appendTo == 'parent' this.element[0].parentNode o.appendTo));
			        if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
			            helper.css("position""absolute");
			        return helper;
			    },
		    _adjustOffsetFromHelper: function(obj) {
			        if (typeof obj == 'string') {
				            obj obj.split(' ');
				        }
			        if ($.isArray(obj)) {
				            obj = {left: +obj[0], top: +obj[1] || 0};
				        }
			        if ('left' in obj) {
				            this.offset.click.left obj.left this.margins.left;
				        }
			        if ('right' in obj) {
				            this.offset.click.left this.helperProportions.width obj.right this.margins.left;
				        }
			        if ('top' in obj) {
				            this.offset.click.top obj.top this.margins.top;
				        }
			        if ('bottom' in obj) {
				            this.offset.click.top this.helperProportions.height obj.bottom this.margins.top;
				        }
			    },
		    _getParentOffset: function() {
			        //Get the offsetParent and cache its position
			        this.offsetParent this.helper.offsetParent();
			        var po this.offsetParent.offset();
			        // This is a special case where we need to modify a offset calculated on start, since the following happened:
			        // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
			        // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
			        //    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
			        if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
				            po.left += this.scrollParent.scrollLeft();
				            po.top += this.scrollParent.scrollTop();
				        }
			        if((this.offsetParent[0] == document.body//This needs to be actually done for all browsers, since pageX/pageY includes this information
			        || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
			            po = { top0left0
				};
			        return {
				            toppo.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
				            leftpo.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
				        };
			    },
		    _getRelativeOffset: function() {
			        if(this.cssPosition == "relative") {
				            var this.element.position();
				            return {
					                topp.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
					                leftp.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
					            };
				        } else {
				            return { top0left0
					};
				        }
			    },
		    _cacheMargins: function() {
			        this.margins = {
				            left: (parseInt(this.element.css("marginLeft"),10) || 0),
				            top: (parseInt(this.element.css("marginTop"),10) || 0)
				        };
			    },
		    _cacheHelperProportions: function() {
			        this.helperProportions = {
				            widththis.helper.outerWidth(),
				            heightthis.helper.outerHeight()
				        };
			    },
		    _setContainment: function() {
			        var this.options;
			        if(o.containment == 'parent'o.containment this.helper[0].parentNode;
			        if(o.containment == 'document' || o.containment == 'window'this.containment = [
			            this.offset.relative.left this.offset.parent.left,
			            this.offset.relative.top this.offset.parent.top,
			            $(o.containment == 'document' document window).width() - this.helperProportions.width this.margins.left,
			            ($(o.containment == 'document' document window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height this.margins.top
			        ];
			        if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
				            var ce = $(o.containment)[0];
				 if(!ce) return;
				            var co = $(o.containment).offset();
				            var over = ($(ce).css("overflow") != 'hidden');
				            this.containment = [
				                co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
				                co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
				                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,
				                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
				            ];
				        } else if(o.containment.constructor == Array) {
				            this.containment o.containment;
				        }
			    },
		    _convertPositionTo: function(dpos) {
			        if(!pospos this.position;
			        var mod == "absolute" : -1;
			        var this.optionsscroll this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent this.scrollParentscrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
			        return {
				            top: (
				                pos.top                                                                    // The absolute mouse position
				                this.offset.relative.top mod                                        // Only for relative positioned nodes: Relative offset from element to offset parent
				                this.offset.parent.top mod                                            // The offsetParent's offset without borders (offset + border)
				                - ($.browser.safari && $.browser.version 526 && this.cssPosition == 'fixed' : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode scroll.scrollTop() ) ) * mod)
				            ),
				            left: (
				                pos.left                                                                // The absolute mouse position
				                this.offset.relative.left mod                                        // Only for relative positioned nodes: Relative offset from element to offset parent
				                this.offset.parent.left mod                                            // The offsetParent's offset without borders (offset + border)
				                - ($.browser.safari && $.browser.version 526 && this.cssPosition == 'fixed' : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode scroll.scrollLeft() ) * mod)
				            )
				        };
			    },
		    _generatePosition: function(event) {
			        var this.optionsscroll this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent this.scrollParentscrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
			        var pageX event.pageX;
			        var pageY event.pageY;
			        /*
			         * - Position constraining -
			         * Constrain the position to a mix of grid, containment.
			         */
			        if(this.originalPosition) {
				//If we are not dragging yet, we won't check for options
				            if(this.containment) {
					                if(event.pageX this.offset.click.left this.containment[0]) pageX this.containment[0] + this.offset.click.left;
					                if(event.pageY this.offset.click.top this.containment[1]) pageY this.containment[1] + this.offset.click.top;
					                if(event.pageX this.offset.click.left this.containment[2]) pageX this.containment[2] + this.offset.click.left;
					                if(event.pageY this.offset.click.top this.containment[3]) pageY this.containment[3] + this.offset.click.top;
					            }
				            if(o.grid) {
					                var top this.originalPageY Math.round((pageY this.originalPageY) / o.grid[1]) * o.grid[1];
					                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;
					                var left this.originalPageX Math.round((pageX this.originalPageX) / o.grid[0]) * o.grid[0];
					                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;
					            }
				        }
			        return {
				            top: (
				                pageY                                                                // The absolute mouse position
				                this.offset.click.top                                                    // Click offset (relative to the element)
				                this.offset.relative.top                                                // Only for relative positioned nodes: Relative offset from element to offset parent
				                this.offset.parent.top                                                // The offsetParent's offset without borders (offset + border)
				                + ($.browser.safari && $.browser.version 526 && this.cssPosition == 'fixed' : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode scroll.scrollTop() ) ))
				            ),
				            left: (
				                pageX                                                                // The absolute mouse position
				                this.offset.click.left                                                // Click offset (relative to the element)
				                this.offset.relative.left                                                // Only for relative positioned nodes: Relative offset from element to offset parent
				                this.offset.parent.left                                                // The offsetParent's offset without borders (offset + border)
				                + ($.browser.safari && $.browser.version 526 && this.cssPosition == 'fixed' : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode scroll.scrollLeft() ))
				            )
				        };
			    },
		    _clear: function() {
			        this.helper.removeClass("ui-draggable-dragging");
			        if(this.helper[0] != this.element[0] && !this.cancelHelperRemovalthis.helper.remove();
			        //if($.ui.ddmanager) $.ui.ddmanager.current = null;
			        this.helper null;
			        this.cancelHelperRemoval false;
			    },
		    // From now on bulk stuff - mainly helpers
		    _trigger: function(typeeventui) {
			        ui ui || this._uiHash();
			        $.ui.plugin.call(thistype, [eventui]);
			        if(type == "drag"this.positionAbs this._convertPositionTo("absolute");
			 //The absolute position has to be recalculated after plugins
			        return $.Widget.prototype._trigger.call(thistypeeventui);
			    },
		    plugins{},
		    _uiHash: function(event) {
			        return {
				            helperthis.helper,
				            positionthis.position,
				            originalPositionthis.originalPosition,
				            offsetthis.positionAbs
				        };
			    }
		});
	$.extend($.ui.draggable, {
		    version"1.8.5"
		});
	$.ui.plugin.add("draggable""connectToSortable", {
		    start: function(eventui) {
			        var inst = $(this).data("draggable"), inst.options,
			            uiSortable = $.extend({}ui, { iteminst.element
				});
			        inst.sortables [];
			        $(o.connectToSortable).each(function() {
				            var sortable = $.data(this'sortable');
				            if (sortable && !sortable.options.disabled) {
					                inst.sortables.push({
						                    instancesortable,
						                    shouldRevertsortable.options.revert
						                });
					                sortable._refreshItems();
					    //Do a one-time refresh at start to refresh the containerCache
					                sortable._trigger("activate"eventuiSortable);
					            }
				        });
			    },
		    stop: function(eventui) {
			        //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
			        var inst = $(this).data("draggable"),
			            uiSortable = $.extend({}ui, { iteminst.element
				});
			        $.each(inst.sortables, function() {
				            if(this.instance.isOver) {
					                this.instance.isOver 0;
					                inst.cancelHelperRemoval true;
					 //Don't remove the helper in the draggable instance
					                this.instance.cancelHelperRemoval false;
					 //Remove it in the sortable instance (so sortable plugins like revert still work)
					                //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
					                if(this.shouldRevertthis.instance.options.revert true;
					                //Trigger the stop of the sortable
					                this.instance._mouseStop(event);
					                this.instance.options.helper this.instance.options._helper;
					                //If the helper has been the original item, restore properties in the sortable
					                if(inst.options.helper == 'original')
					                    this.instance.currentItem.css({ top'auto'left'auto'
						});
					            } else {
					                this.instance.cancelHelperRemoval false;
					 //Remove the helper in the sortable instance
					                this.instance._trigger("deactivate"eventuiSortable);
					            }
				        });
			    },
		    drag: function(eventui) {
			        var inst = $(this).data("draggable"), self this;
			        var checkPos = function(o) {
				            var dyClick this.offset.click.topdxClick this.offset.click.left;
				            var helperTop this.positionAbs.tophelperLeft this.positionAbs.left;
				            var itemHeight o.heightitemWidth o.width;
				            var itemTop o.topitemLeft o.left;
				            return $.ui.isOver(helperTop dyClickhelperLeft dxClickitemTopitemLeftitemHeightitemWidth);
				        };
			        $.each(inst.sortables, function(i) {
				            //Copy over some variables to allow calling the sortable's native _intersectsWith
				            this.instance.positionAbs inst.positionAbs;
				            this.instance.helperProportions inst.helperProportions;
				            this.instance.offset.click inst.offset.click;
				            if(this.instance._intersectsWith(this.instance.containerCache)) {
					                //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
					                if(!this.instance.isOver) {
						                    this.instance.isOver 1;
						                    //Now we fake the start of dragging for the sortable instance,
						                    //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
						                    //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)
						                    this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item"true);
						                    this.instance.options._helper this.instance.options.helper;
						 //Store helper option to later restore it
						                    this.instance.options.helper = function() {
							return ui.helper[0];
							};
						                    event.target this.instance.currentItem[0];
						                    this.instance._mouseCapture(eventtrue);
						                    this.instance._mouseStart(eventtruetrue);
						                    //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
						                    this.instance.offset.click.top inst.offset.click.top;
						                    this.instance.offset.click.left inst.offset.click.left;
						                    this.instance.offset.parent.left -= inst.offset.parent.left this.instance.offset.parent.left;
						                    this.instance.offset.parent.top -= inst.offset.parent.top this.instance.offset.parent.top;
						                    inst._trigger("toSortable"event);
						                    inst.dropped this.instance.element;
						 //draggable revert needs that
						                    //hack so receive/update callbacks work (mostly)
						                    inst.currentItem inst.element;
						                    this.instance.fromOutside inst;
						                }
					                //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
					                if(this.instance.currentItemthis.instance._mouseDrag(event);
					            } else {
					                //If it doesn't intersect with the sortable, and it intersected before,
					                //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
					                if(this.instance.isOver) {
						                    this.instance.isOver 0;
						                    this.instance.cancelHelperRemoval true;
						                    //Prevent reverting on this forced stop
						                    this.instance.options.revert false;
						                    // The out event needs to be triggered independently
						                    this.instance._trigger('out'eventthis.instance._uiHash(this.instance));
						                    this.instance._mouseStop(eventtrue);
						                    this.instance.options.helper this.instance.options._helper;
						                    //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
						                    this.instance.currentItem.remove();
						                    if(this.instance.placeholderthis.instance.placeholder.remove();
						                    inst._trigger("fromSortable"event);
						                    inst.dropped false;
						 //draggable revert needs that
						                }
					            };
				        });
			    }
		});
	$.ui.plugin.add("draggable""cursor", {
		    start: function(eventui) {
			        var = $('body'), = $(this).data('draggable').options;
			        if (t.css("cursor")) o._cursor t.css("cursor");
			        t.css("cursor"o.cursor);
			    },
		    stop: function(eventui) {
			        var = $(this).data('draggable').options;
			        if (o._cursor) $('body').css("cursor"o._cursor);
			    }
		});
	$.ui.plugin.add("draggable""iframeFix", {
		    start: function(eventui) {
			        var = $(this).data('draggable').options;
			        $(o.iframeFix === true "iframe" o.iframeFix).each(function() {
				            $('<div class="ui-draggable-iframeFix" style="background: #fff;
				"></div>')
				            .css({
					                widththis.offsetWidth+"px"heightthis.offsetHeight+"px",
					                position"absolute"opacity"0.001"zIndex1000
					            })
				            .css($(this).offset())
				            .appendTo("body");
				        });
			    },
		    stop: function(eventui) {
			        $("div.ui-draggable-iframeFix").each(function() {
				this.parentNode.removeChild(this);
				});
			 //Remove frame helpers
			    }
		});
	$.ui.plugin.add("draggable""opacity", {
		    start: function(eventui) {
			        var = $(ui.helper), = $(this).data('draggable').options;
			        if(t.css("opacity")) o._opacity t.css("opacity");
			        t.css('opacity'o.opacity);
			    },
		    stop: function(eventui) {
			        var = $(this).data('draggable').options;
			        if(o._opacity) $(ui.helper).css('opacity'o._opacity);
			    }
		});
	$.ui.plugin.add("draggable""scroll", {
		    start: function(eventui) {
			        var = $(this).data("draggable");
			        if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML'i.overflowOffset i.scrollParent.offset();
			    },
		    drag: function(eventui) {
			        var = $(this).data("draggable"), i.optionsscrolled false;
			        if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
				            if(!o.axis || o.axis != 'x') {
					                if((i.overflowOffset.top i.scrollParent[0].offsetHeight) - event.pageY o.scrollSensitivity)
					                    i.scrollParent[0].scrollTop scrolled i.scrollParent[0].scrollTop o.scrollSpeed;
					                else if(event.pageY i.overflowOffset.top o.scrollSensitivity)
					                    i.scrollParent[0].scrollTop scrolled i.scrollParent[0].scrollTop o.scrollSpeed;
					            }
				            if(!o.axis || o.axis != 'y') {
					                if((i.overflowOffset.left i.scrollParent[0].offsetWidth) - event.pageX o.scrollSensitivity)
					                    i.scrollParent[0].scrollLeft scrolled i.scrollParent[0].scrollLeft o.scrollSpeed;
					                else if(event.pageX i.overflowOffset.left o.scrollSensitivity)
					                    i.scrollParent[0].scrollLeft scrolled i.scrollParent[0].scrollLeft o.scrollSpeed;
					            }
				        } else {
				            if(!o.axis || o.axis != 'x') {
					                if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
					                    scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
					                else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
					                    scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
					            }
				            if(!o.axis || o.axis != 'y') {
					                if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
					                    scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
					                else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
					                    scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
					            }
				        }
			        if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
			            $.ui.ddmanager.prepareOffsets(ievent);
			    }
		});
	$.ui.plugin.add("draggable""snap", {
		    start: function(eventui) {
			        var = $(this).data("draggable"), i.options;
			        i.snapElements [];
			        $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
				            var $t = $(this);
				 var $o $t.offset();
				            if(this != i.element[0]) i.snapElements.push({
					                itemthis,
					                width$t.outerWidth(), height$t.outerHeight(),
					                top$o.topleft$o.left
					            });
				        });
			    },
		    drag: function(eventui) {
			        var inst = $(this).data("draggable"), inst.options;
			        var o.snapTolerance;
			        var x1 ui.offset.leftx2 x1 inst.helperProportions.width,
			            y1 ui.offset.topy2 y1 inst.helperProportions.height;
			        for (var inst.snapElements.length 1;
			 >= 0;
			 i--){
				            var inst.snapElements[i].leftinst.snapElements[i].width,
				                inst.snapElements[i].topinst.snapElements[i].height;
				            //Yes, I know, this is insane ;
				)
				            if(!((l-x1 && x1 r+&& t-y1 && y1 b+d) || (l-x1 && x1 r+&& t-y2 && y2 b+d) || (l-x2 && x2 r+&& t-y1 && y1 b+d) || (l-x2 && x2 r+&& t-y2 && y2 b+d))) {
					                if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.elementevent, $.extend(inst._uiHash(), { snapIteminst.snapElements[i].item
						})));
					                inst.snapElements[i].snapping false;
					                continue;
					            }
				            if(o.snapMode != 'inner') {
					                var ts Math.abs(y2) <= d;
					                var bs Math.abs(y1) <= d;
					                var ls Math.abs(x2) <= d;
					                var rs Math.abs(x1) <= d;
					                if(tsui.position.top inst._convertPositionTo("relative", { topinst.helperProportions.heightleft0
						}).top inst.margins.top;
					                if(bsui.position.top inst._convertPositionTo("relative", { topbleft0
						}).top inst.margins.top;
					                if(lsui.position.left inst._convertPositionTo("relative", { top0leftinst.helperProportions.width
						}).left inst.margins.left;
					                if(rsui.position.left inst._convertPositionTo("relative", { top0leftr
						}).left inst.margins.left;
					            }
				            var first = (ts || bs || ls || rs);
				            if(o.snapMode != 'outer') {
					                var ts Math.abs(y1) <= d;
					                var bs Math.abs(y2) <= d;
					                var ls Math.abs(x1) <= d;
					                var rs Math.abs(x2) <= d;
					                if(tsui.position.top inst._convertPositionTo("relative", { toptleft0
						}).top inst.margins.top;
					                if(bsui.position.top inst._convertPositionTo("relative", { topinst.helperProportions.heightleft0
						}).top inst.margins.top;
					                if(lsui.position.left inst._convertPositionTo("relative", { top0leftl
						}).left inst.margins.left;
					                if(rsui.position.left inst._convertPositionTo("relative", { top0leftinst.helperProportions.width
						}).left inst.margins.left;
					            }
				            if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
				                (inst.options.snap.snap && inst.options.snap.snap.call(inst.elementevent, $.extend(inst._uiHash(), { snapIteminst.snapElements[i].item
					})));
				            inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
				        };
			    }
		});
	$.ui.plugin.add("draggable""stack", {
		    start: function(eventui) {
			        var = $(this).data("draggable").options;
			        var group = $.makeArray($(o.stack)).sort(function(a,b) {
				            return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
				        });
			        if (!group.length) {
				return;
				}
			        var min parseInt(group[0].style.zIndex) || 0;
			        $(group).each(function(i) {
				            this.style.zIndex min i;
				        });
			        this[0].style.zIndex min group.length;
			    }
		});
	$.ui.plugin.add("draggable""zIndex", {
		    start: function(eventui) {
			        var = $(ui.helper), = $(this).data("draggable").options;
			        if(t.css("zIndex")) o._zIndex t.css("zIndex");
			        t.css('zIndex'o.zIndex);
			    },
		    stop: function(eventui) {
			        var = $(this).data("draggable").options;
			        if(o._zIndex) $(ui.helper).css('zIndex'o._zIndex);
			    }
		});
	})(jQuery);
/*
 * jQuery UI Droppable 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Droppables
 *
 * Depends:
 *    jquery.ui.core.js
 *    jquery.ui.widget.js
 *    jquery.ui.mouse.js
 *    jquery.ui.draggable.js
 */
(function( $, undefined ) {
	$.widget("ui.droppable", {
		    widgetEventPrefix"drop",
		    options: {
			        accept'*',
			        activeClassfalse,
			        addClassestrue,
			        greedyfalse,
			        hoverClassfalse,
			        scope'default',
			        tolerance'intersect'
			    },
		    _create: function() {
			        var this.optionsaccept o.accept;
			        this.isover 0;
			 this.isout 1;
			        this.accept = $.isFunction(accept) ? accept : function(d) {
				            return d.is(accept);
				        };
			        //Store the droppable's proportions
			        this.proportions = { widththis.element[0].offsetWidthheightthis.element[0].offsetHeight
				};
			        // Add the reference and positions to the manager
			        $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
			        $.ui.ddmanager.droppables[o.scope].push(this);
			        (o.addClasses && this.element.addClass("ui-droppable"));
			    },
		    destroy: function() {
			        var drop = $.ui.ddmanager.droppables[this.options.scope];
			        for ( var 0;
			 drop.length;
			 i++ )
			            if ( drop[i] == this )
			                drop.splice(i1);
			        this.element
			            .removeClass("ui-droppable ui-droppable-disabled")
			            .removeData("droppable")
			            .unbind(".droppable");
			        return this;
			    },
		    _setOption: function(keyvalue) {
			        if(key == 'accept') {
				            this.accept = $.isFunction(value) ? value : function(d) {
					                return d.is(value);
					            };
				        }
			        $.Widget.prototype._setOption.apply(thisarguments);
			    },
		    _activate: function(event) {
			        var draggable = $.ui.ddmanager.current;
			        if(this.options.activeClassthis.element.addClass(this.options.activeClass);
			        (draggable && this._trigger('activate'eventthis.ui(draggable)));
			    },
		    _deactivate: function(event) {
			        var draggable = $.ui.ddmanager.current;
			        if(this.options.activeClassthis.element.removeClass(this.options.activeClass);
			        (draggable && this._trigger('deactivate'eventthis.ui(draggable)));
			    },
		    _over: function(event) {
			        var draggable = $.ui.ddmanager.current;
			        if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return;
			 // Bail if draggable and droppable are same element
			        if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
				            if(this.options.hoverClassthis.element.addClass(this.options.hoverClass);
				            this._trigger('over'eventthis.ui(draggable));
				        }
			    },
		    _out: function(event) {
			        var draggable = $.ui.ddmanager.current;
			        if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return;
			 // Bail if draggable and droppable are same element
			        if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
				            if(this.options.hoverClassthis.element.removeClass(this.options.hoverClass);
				            this._trigger('out'eventthis.ui(draggable));
				        }
			    },
		    _drop: function(event,custom) {
			        var draggable custom || $.ui.ddmanager.current;
			        if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false;
			 // Bail if draggable and droppable are same element
			        var childrenIntersection false;
			        this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
				            var inst = $.data(this'droppable');
				            if(
				                inst.options.greedy
				                && !inst.options.disabled
				                && inst.options.scope == draggable.options.scope
				                && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
				                && $.ui.intersect(draggable, $.extend(inst, { offsetinst.element.offset()
					}), inst.options.tolerance)
				            ) {
					childrenIntersection true;
					 return false;
					}
				        });
			        if(childrenIntersection) return false;
			        if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
				            if(this.options.activeClassthis.element.removeClass(this.options.activeClass);
				            if(this.options.hoverClassthis.element.removeClass(this.options.hoverClass);
				            this._trigger('drop'eventthis.ui(draggable));
				            return this.element;
				        }
			        return false;
			    },
		    ui: function(c) {
			        return {
				            draggable: (c.currentItem || c.element),
				            helperc.helper,
				            positionc.position,
				            offsetc.positionAbs
				        };
			    }
		});
	$.extend($.ui.droppable, {
		    version"1.8.5"
		});
	$.ui.intersect = function(draggabledroppabletoleranceMode) {
		    if (!droppable.offset) return false;
		    var x1 = (draggable.positionAbs || draggable.position.absolute).leftx2 x1 draggable.helperProportions.width,
		        y1 = (draggable.positionAbs || draggable.position.absolute).topy2 y1 draggable.helperProportions.height;
		    var droppable.offset.leftdroppable.proportions.width,
		        droppable.offset.topdroppable.proportions.height;
		    switch (toleranceMode) {
			        case 'fit':
			            return (<= x1 && x2 <= r
			                && <= y1 && y2 <= b);
			            break;
			        case 'intersect':
			            return (x1 + (draggable.helperProportions.width 2// Right Half
			                && x2 - (draggable.helperProportions.width 2) < // Left Half
			                && y1 + (draggable.helperProportions.height 2// Bottom Half
			                && y2 - (draggable.helperProportions.height 2) < );
			 // Top Half
			            break;
			        case 'pointer':
			            var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
			                draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
			                isOver = $.ui.isOver(draggableTopdraggableLefttldroppable.proportions.heightdroppable.proportions.width);
			            return isOver;
			            break;
			        case 'touch':
			            return (
			                    (y1 >= && y1 <= b) ||    // Top edge touching
			                    (y2 >= && y2 <= b) ||    // Bottom edge touching
			                    (y1 && y2 b)        // Surrounded vertically
			                ) && (
			                    (x1 >= && x1 <= r) ||    // Left edge touching
			                    (x2 >= && x2 <= r) ||    // Right edge touching
			                    (x1 && x2 r)        // Surrounded horizontally
			                );
			            break;
			        default:
			            return false;
			            break;
			        }
		};
	/*
	    This manager tracks offsets of draggables and droppables
	*/
	$.ui.ddmanager = {
		    currentnull,
		    droppables: { 'default'[]
			},
		    prepareOffsets: function(tevent) {
			        var = $.ui.ddmanager.droppables[t.options.scope] || [];
			        var type event event.type null;
			 // workaround for #2317
			        var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
			        droppablesLoop: for (var 0;
			 m.length;
			 i++) {
				            if(m[i].options.disabled || (&& !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue;
				    //No disabled and non-accepted
				            for (var j=0;
				 < list.length;
				 j++) {
					if(list[j] == m[i].element[0]) {
						m[i].proportions.height 0;
						 continue droppablesLoop;
						}
					};
				 //Filter out elements in the current dragged item
				            m[i].visible m[i].element.css("display") != "none";
				 if(!m[i].visible) continue;
				                                     //If the element is not visible, continue
				            m[i].offset m[i].element.offset();
				            m[i].proportions = { widthm[i].element[0].offsetWidthheightm[i].element[0].offsetHeight
					};
				            if(type == "mousedown"m[i]._activate.call(m[i], event);
				 //Activate the droppable if used directly from draggables
				        }
			    },
		    drop: function(draggableevent) {
			        var dropped false;
			        $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
				            if(!this.options) return;
				            if (!this.options.disabled && this.visible && $.ui.intersect(draggablethisthis.options.tolerance))
				                dropped dropped || this._drop.call(thisevent);
				            if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
					                this.isout 1;
					 this.isover 0;
					                this._deactivate.call(thisevent);
					            }
				        });
			        return dropped;
			    },
		    drag: function(draggableevent) {
			        //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
			        if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggableevent);
			        //Run through all droppables and check their positions based on specific tolerance options
			        $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
				            if(this.options.disabled || this.greedyChild || !this.visible) return;
				            var intersects = $.ui.intersect(draggablethisthis.options.tolerance);
				            var = !intersects && this.isover == 'isout' : (intersects && this.isover == 'isover' null);
				            if(!c) return;
				            var parentInstance;
				            if (this.options.greedy) {
					                var parent this.element.parents(':data(droppable):eq(0)');
					                if (parent.length) {
						                    parentInstance = $.data(parent[0], 'droppable');
						                    parentInstance.greedyChild = (== 'isover' 0);
						                }
					            }
				            // we just moved into a greedy child
				            if (parentInstance && == 'isover') {
					                parentInstance['isover'] = 0;
					                parentInstance['isout'] = 1;
					                parentInstance._out.call(parentInstanceevent);
					            }
				            this[c] = 1;
				 this[== 'isout' 'isover' 'isout'] = 0;
				            this[== "isover" "_over" "_out"].call(thisevent);
				            // we just moved out of a greedy child
				            if (parentInstance && == 'isout') {
					                parentInstance['isout'] = 0;
					                parentInstance['isover'] = 1;
					                parentInstance._over.call(parentInstanceevent);
					            }
				        });
			    }
		};
	})(jQuery);
/*
 * jQuery UI Resizable 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Resizables
 *
 * Depends:
 *    jquery.ui.core.js
 *    jquery.ui.mouse.js
 *    jquery.ui.widget.js
 */
(function( $, undefined ) {
	$.widget("ui.resizable", $.ui.mouse, {
		    widgetEventPrefix"resize",
		    options: {
			        alsoResizefalse,
			        animatefalse,
			        animateDuration"slow",
			        animateEasing"swing",
			        aspectRatiofalse,
			        autoHidefalse,
			        containmentfalse,
			        ghostfalse,
			        gridfalse,
			        handles"e,s,se",
			        helperfalse,
			        maxHeightnull,
			        maxWidthnull,
			        minHeight10,
			        minWidth10,
			        zIndex1000
			    },
		    _create: function() {
			        var self thisthis.options;
			        this.element.addClass("ui-resizable");
			        $.extend(this, {
				            _aspectRatio: !!(o.aspectRatio),
				            aspectRatioo.aspectRatio,
				            originalElementthis.element,
				            _proportionallyResizeElements[],
				            _helpero.helper || o.ghost || o.animate o.helper || 'ui-resizable-helper' null
				        });
			        //Wrap the element if it cannot hold child nodes
			        if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
				            //Opera fix for relative positioning
				            if (/relative/.test(this.element.css('position')) && $.browser.opera)
				                this.element.css({ position'relative'top'auto'left'auto'
					});
				            //Create a wrapper element and set the wrapper to the new current internal element
				            this.element.wrap(
				                $('<div class="ui-wrapper" style="overflow: hidden;
				"></div>').css({
					                    positionthis.element.css('position'),
					                    widththis.element.outerWidth(),
					                    heightthis.element.outerHeight(),
					                    topthis.element.css('top'),
					                    leftthis.element.css('left')
					                })
				            );
				            //Overwrite the original this.element
				            this.element this.element.parent().data(
				                "resizable"this.element.data('resizable')
				            );
				            this.elementIsWrapper true;
				            //Move margins to the wrapper
				            this.element.css({ marginLeftthis.originalElement.css("marginLeft"), marginTopthis.originalElement.css("marginTop"), marginRightthis.originalElement.css("marginRight"), marginBottomthis.originalElement.css("marginBottom")
					});
				            this.originalElement.css({ marginLeft0marginTop0marginRight0marginBottom0});
				            //Prevent Safari textarea resize
				            this.originalResizeStyle this.originalElement.css('resize');
				            this.originalElement.css('resize''none');
				            //Push the actual element to our proportionallyResize internal array
				            this._proportionallyResizeElements.push(this.originalElement.css({ position'static'zoom1display'block'
					}));
				            // avoid IE jump (hard set the margin)
				            this.originalElement.css({ marginthis.originalElement.css('margin')
					});
				            // fix handlers offset
				            this._proportionallyResize();
				        }
			        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'
				});
			        if(this.handles.constructor == String) {
				            if(this.handles == 'all'this.handles 'n,e,s,w,se,sw,ne,nw';
				            var this.handles.split(",");
				 this.handles {};
				            for(var 0;
				 n.length;
				 i++) {
					                var handle = $.trim(n[i]), hname 'ui-resizable-'+handle;
					                var axis = $('<div class="ui-resizable-handle ' hname '"></div>');
					                // increase zIndex of sw, se, ne, nw axis
					                //TODO : this modifies original option
					                if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex
						});
					                //TODO : What's going on here?
					                if ('se' == handle) {
						                    axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
						                };
					                //Insert into internal handles object and append to element
					                this.handles[handle] = '.ui-resizable-'+handle;
					                this.element.append(axis);
					            }
				        }
			        this._renderAxis = function(target) {
				            target target || this.element;
				            for(var i in this.handles) {
					                if(this.handles[i].constructor == String)
					                    this.handles[i] = $(this.handles[i], this.element).show();
					                //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
					                if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
						                    var axis = $(this.handles[i], this.element), padWrapper 0;
						                    //Checking the correct pad and border
						                    padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
						                    //The padding type i have to apply...
						                    var padPos = [ 'padding',
						                        /ne|nw|n/.test(i) ? 'Top' :
						                        /se|sw|s/.test(i) ? 'Bottom' :
						                        /^e$/.test(i) ? 'Right' 'Left' ].join("");
						                    target.css(padPospadWrapper);
						                    this._proportionallyResize();
						                }
					                //TODO: What's that good for? There's not anything to be executed left
					                if(!$(this.handles[i]).length)
					                    continue;
					            }
				        };
			        //TODO: make renderAxis a prototype function
			        this._renderAxis(this.element);
			        this._handles = $('.ui-resizable-handle'this.element)
			            .disableSelection();
			        //Matching axis name
			        this._handles.mouseover(function() {
				            if (!self.resizing) {
					                if (this.className)
					                    var axis this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
					                //Axis, default = se
					                self.axis axis && axis[1] ? axis[1] : 'se';
					            }
				        });
			        //If we want to auto hide the elements
			        if (o.autoHide) {
				            this._handles.hide();
				            $(this.element)
				                .addClass("ui-resizable-autohide")
				                .hover(function() {
					                    $(this).removeClass("ui-resizable-autohide");
					                    self._handles.show();
					                },
				                function(){
					                    if (!self.resizing) {
						                        $(this).addClass("ui-resizable-autohide");
						                        self._handles.hide();
						                    }
					                });
				        }
			        //Initialize the mouse interaction
			        this._mouseInit();
			    },
		    destroy: function() {
			        this._mouseDestroy();
			        var _destroy = function(exp) {
				            $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
				                .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
				        };
			        //TODO: Unwrap at same DOM position
			        if (this.elementIsWrapper) {
				            _destroy(this.element);
				            var wrapper this.element;
				            wrapper.after(
				                this.originalElement.css({
					                    positionwrapper.css('position'),
					                    widthwrapper.outerWidth(),
					                    heightwrapper.outerHeight(),
					                    topwrapper.css('top'),
					                    leftwrapper.css('left')
					                })
				            ).remove();
				        }
			        this.originalElement.css('resize'this.originalResizeStyle);
			        _destroy(this.originalElement);
			        return this;
			    },
		    _mouseCapture: function(event) {
			        var handle false;
			        for (var i in this.handles) {
				            if ($(this.handles[i])[0] == event.target) {
					                handle true;
					            }
				        }
			        return !this.options.disabled && handle;
			    },
		    _mouseStart: function(event) {
			        var this.optionsiniPos this.element.position(), el this.element;
			        this.resizing true;
			        this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft()
				};
			        // bugfix for http://dev.jquery.com/ticket/1749
			        if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
				            el.css({ position'absolute'topiniPos.topleftiniPos.left
					});
				        }
			        //Opera fixing relative position
			        if ($.browser.opera && (/relative/).test(el.css('position')))
			            el.css({ position'relative'top'auto'left'auto'
				});
			        this._renderProxy();
			        var curleft num(this.helper.css('left')), curtop num(this.helper.css('top'));
			        if (o.containment) {
				            curleft += $(o.containment).scrollLeft() || 0;
				            curtop += $(o.containment).scrollTop() || 0;
				        }
			        //Store needed variables
			        this.offset this.helper.offset();
			        this.position = { leftcurlefttopcurtop
				};
			        this.size this._helper ? { widthel.outerWidth(), heightel.outerHeight()
				} : { widthel.width(), heightel.height()
				};
			        this.originalSize this._helper ? { widthel.outerWidth(), heightel.outerHeight()
				} : { widthel.width(), heightel.height()
				};
			        this.originalPosition = { leftcurlefttopcurtop
				};
			        this.sizeDiff = { widthel.outerWidth() - el.width(), heightel.outerHeight() - el.height()
				};
			        this.originalMousePosition = { leftevent.pageXtopevent.pageY
				};
			        //Aspect Ratio
			        this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width this.originalSize.height) || 1);
			        var cursor = $('.ui-resizable-' this.axis).css('cursor');
			        $('body').css('cursor'cursor == 'auto' this.axis '-resize' cursor);
			        el.addClass("ui-resizable-resizing");
			        this._propagate("start"event);
			        return true;
			    },
		    _mouseDrag: function(event) {
			        //Increase performance, avoid regex
			        var el this.helperthis.optionsprops {},
			            self thissmp this.originalMousePositionthis.axis;
			        var dx = (event.pageX-smp.left)||0dy = (event.pageY-smp.top)||0;
			        var trigger this._change[a];
			        if (!trigger) return false;
			        // Calculate the attrs that will be change
			        var data trigger.apply(this, [eventdxdy]), ie6 = $.browser.msie && $.browser.version 7csdif this.sizeDiff;
			        if (this._aspectRatio || event.shiftKey)
			            data this._updateRatio(dataevent);
			        data this._respectSize(dataevent);
			        // plugins callbacks need to be called first
			        this._propagate("resize"event);
			        el.css({
				            topthis.position.top "px"leftthis.position.left "px",
				            widththis.size.width "px"heightthis.size.height "px"
				        });
			        if (!this._helper && this._proportionallyResizeElements.length)
			            this._proportionallyResize();
			        this._updateCache(data);
			        // calling the user callback at the end
			        this._trigger('resize'eventthis.ui());
			        return false;
			    },
		    _mouseStop: function(event) {
			        this.resizing false;
			        var this.optionsself this;
			        if(this._helper) {
				            var pr this._proportionallyResizeElementsista pr.length && (/textarea/i).test(pr[0].nodeName),
				                        soffseth ista && $.ui.hasScroll(pr[0], 'left'/* TODO - jump height */ self.sizeDiff.height,
				                            soffsetw ista self.sizeDiff.width;
				            var = { width: (self.size.width soffsetw), height: (self.size.height soffseth)
					},
				                left = (parseInt(self.element.css('left'), 10) + (self.position.left self.originalPosition.left)) || null,
				                top = (parseInt(self.element.css('top'), 10) + (self.position.top self.originalPosition.top)) || null;
				            if (!o.animate)
				                this.element.css($.extend(s, { toptopleftleft
					}));
				            self.helper.height(self.size.height);
				            self.helper.width(self.size.width);
				            if (this._helper && !o.animatethis._proportionallyResize();
				        }
			        $('body').css('cursor''auto');
			        this.element.removeClass("ui-resizable-resizing");
			        this._propagate("stop"event);
			        if (this._helperthis.helper.remove();
			        return false;
			    },
		    _updateCache: function(data) {
			        var this.options;
			        this.offset this.helper.offset();
			        if (isNumber(data.left)) this.position.left data.left;
			        if (isNumber(data.top)) this.position.top data.top;
			        if (isNumber(data.height)) this.size.height data.height;
			        if (isNumber(data.width)) this.size.width data.width;
			    },
		    _updateRatio: function(dataevent) {
			        var this.optionscpos this.positioncsize this.sizethis.axis;
			        if (data.heightdata.width = (csize.height this.aspectRatio);
			        else if (data.widthdata.height = (csize.width this.aspectRatio);
			        if (== 'sw') {
				            data.left cpos.left + (csize.width data.width);
				            data.top null;
				        }
			        if (== 'nw') {
				            data.top cpos.top + (csize.height data.height);
				            data.left cpos.left + (csize.width data.width);
				        }
			        return data;
			    },
		    _respectSize: function(dataevent) {
			        var el this.helperthis.optionspRatio this._aspectRatio || event.shiftKeythis.axis,
			                ismaxw isNumber(data.width) && o.maxWidth && (o.maxWidth data.width), ismaxh isNumber(data.height) && o.maxHeight && (o.maxHeight data.height),
			                    isminw isNumber(data.width) && o.minWidth && (o.minWidth data.width), isminh isNumber(data.height) && o.minHeight && (o.minHeight data.height);
			        if (isminwdata.width o.minWidth;
			        if (isminhdata.height o.minHeight;
			        if (ismaxwdata.width o.maxWidth;
			        if (ismaxhdata.height o.maxHeight;
			        var dw this.originalPosition.left this.originalSize.widthdh this.position.top this.size.height;
			        var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
			        if (isminw && cwdata.left dw o.minWidth;
			        if (ismaxw && cwdata.left dw o.maxWidth;
			        if (isminh && ch)    data.top dh o.minHeight;
			        if (ismaxh && ch)    data.top dh o.maxHeight;
			        // fixing jump error on top/left - bug #2330
			        var isNotwh = !data.width && !data.height;
			        if (isNotwh && !data.left && data.topdata.top null;
			        else if (isNotwh && !data.top && data.leftdata.left null;
			        return data;
			    },
		    _proportionallyResize: function() {
			        var this.options;
			        if (!this._proportionallyResizeElements.length) return;
			        var element this.helper || this.element;
			        for (var i=0;
			 this._proportionallyResizeElements.length;
			 i++) {
				            var prel this._proportionallyResizeElements[i];
				            if (!this.borderDif) {
					                var = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
					                    = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
					                this.borderDif = $.map(b, function(vi) {
						                    var border parseInt(v,10)||0padding parseInt(p[i],10)||0;
						                    return border padding;
						                });
					            }
				            if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length)))
				                continue;
				            prel.css({
					                height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
					                width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
					            });
				        };
			    },
		    _renderProxy: function() {
			        var el this.elementthis.options;
			        this.elementOffset el.offset();
			        if(this._helper) {
				            this.helper this.helper || $('<div style="overflow:hidden;
				"></div>');
				            // fix ie6 offset TODO: This seems broken
				            var ie6 = $.browser.msie && $.browser.version 7ie6offset = (ie6 0),
				            pxyoffset = ( ie6 : -);
				            this.helper.addClass(this._helper).css({
					                widththis.element.outerWidth() + pxyoffset,
					                heightthis.element.outerHeight() + pxyoffset,
					                position'absolute',
					                leftthis.elementOffset.left ie6offset +'px',
					                topthis.elementOffset.top ie6offset +'px',
					                zIndex: ++o.zIndex //TODO: Don't modify option
					            });
				            this.helper
				                .appendTo("body")
				                .disableSelection();
				        } else {
				            this.helper this.element;
				        }
			    },
		    _change: {
			        e: function(eventdxdy) {
				            return { widththis.originalSize.width dx
					};
				        },
			        w: function(eventdxdy) {
				            var this.optionscs this.originalSizesp this.originalPosition;
				            return { leftsp.left dxwidthcs.width dx
					};
				        },
			        n: function(eventdxdy) {
				            var this.optionscs this.originalSizesp this.originalPosition;
				            return { topsp.top dyheightcs.height dy
					};
				        },
			        s: function(eventdxdy) {
				            return { heightthis.originalSize.height dy
					};
				        },
			        se: function(eventdxdy) {
				            return $.extend(this._change.s.apply(thisarguments), this._change.e.apply(this, [eventdxdy]));
				        },
			        sw: function(eventdxdy) {
				            return $.extend(this._change.s.apply(thisarguments), this._change.w.apply(this, [eventdxdy]));
				        },
			        ne: function(eventdxdy) {
				            return $.extend(this._change.n.apply(thisarguments), this._change.e.apply(this, [eventdxdy]));
				        },
			        nw: function(eventdxdy) {
				            return $.extend(this._change.n.apply(thisarguments), this._change.w.apply(this, [eventdxdy]));
				        }
			    },
		    _propagate: function(nevent) {
			        $.ui.plugin.call(thisn, [eventthis.ui()]);
			        (!= "resize" && this._trigger(neventthis.ui()));
			    },
		    plugins{},
		    ui: function() {
			        return {
				            originalElementthis.originalElement,
				            elementthis.element,
				            helperthis.helper,
				            positionthis.position,
				            sizethis.size,
				            originalSizethis.originalSize,
				            originalPositionthis.originalPosition
				        };
			    }
		});
	$.extend($.ui.resizable, {
		    version"1.8.5"
		});
	/*
	 * Resizable Extensions
	 */
	$.ui.plugin.add("resizable""alsoResize", {
		    start: function (eventui) {
			        var self = $(this).data("resizable"), self.options;
			        var _store = function (exp) {
				            $(exp).each(function() {
					                var el = $(this);
					                el.data("resizable-alsoresize", {
						                    widthparseInt(el.width(), 10), heightparseInt(el.height(), 10),
						                    leftparseInt(el.css('left'), 10), topparseInt(el.css('top'), 10),
						                    positionel.css('position'// to reset Opera on stop()
						                });
					            });
				        };
			        if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
				            if (o.alsoResize.length) {
					o.alsoResize o.alsoResize[0];
					 _store(o.alsoResize);
					}
				            else { $.each(o.alsoResize, function (exp) {
						_store(exp);
						});
					}
				        }else{
				            _store(o.alsoResize);
				        }
			    },
		    resize: function (eventui) {
			        var self = $(this).data("resizable"), self.optionsos self.originalSizeop self.originalPosition;
			        var delta = {
				            height: (self.size.height os.height) || 0width: (self.size.width os.width) || 0,
				            top: (self.position.top op.top) || 0left: (self.position.left op.left) || 0
				        },
			        _alsoResize = function (expc) {
				            $(exp).each(function() {
					                var el = $(this), start = $(this).data("resizable-alsoresize"), style {}, 
					                    css && c.length el.parents(ui.originalElement[0]).length ? ['width''height'] : ['width''height''top''left'];
					                $.each(css, function (iprop) {
						                    var sum = (start[prop]||0) + (delta[prop]||0);
						                    if (sum && sum >= 0)
						                        style[prop] = sum || null;
						                });
					                // Opera fixing relative position
					                if ($.browser.opera && /relative/.test(el.css('position'))) {
						                    self._revertToRelativePosition true;
						                    el.css({ position'absolute'top'auto'left'auto'
							});
						                }
					                el.css(style);
					            });
				        };
			        if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
				            $.each(o.alsoResize, function (expc) {
					_alsoResize(expc);
					});
				        }else{
				            _alsoResize(o.alsoResize);
				        }
			    },
		    stop: function (eventui) {
			        var self = $(this).data("resizable"), self.options;
			        var _reset = function (exp) {
				            $(exp).each(function() {
					                var el = $(this);
					                // reset position for Opera - no need to verify it was changed
					                el.css({ positionel.data("resizable-alsoresize").position
						});
					            });
				        };
			        if (self._revertToRelativePosition) {
				            self._revertToRelativePosition false;
				            if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
					                $.each(o.alsoResize, function (exp) {
						_reset(exp);
						});
					            }else{
					                _reset(o.alsoResize);
					            }
				        }
			        $(this).removeData("resizable-alsoresize");
			    }
		});
	$.ui.plugin.add("resizable""animate", {
		    stop: function(eventui) {
			        var self = $(this).data("resizable"), self.options;
			        var pr self._proportionallyResizeElementsista pr.length && (/textarea/i).test(pr[0].nodeName),
			                    soffseth ista && $.ui.hasScroll(pr[0], 'left'/* TODO - jump height */ self.sizeDiff.height,
			                        soffsetw ista self.sizeDiff.width;
			        var style = { width: (self.size.width soffsetw), height: (self.size.height soffseth)
				},
			                    left = (parseInt(self.element.css('left'), 10) + (self.position.left self.originalPosition.left)) || null,
			                        top = (parseInt(self.element.css('top'), 10) + (self.position.top self.originalPosition.top)) || null;
			        self.element.animate(
			            $.extend(styletop && left ? { toptopleftleft
				} : {}), {
				                durationo.animateDuration,
				                easingo.animateEasing,
				                step: function() {
					                    var data = {
						                        widthparseInt(self.element.css('width'), 10),
						                        heightparseInt(self.element.css('height'), 10),
						                        topparseInt(self.element.css('top'), 10),
						                        leftparseInt(self.element.css('left'), 10)
						                    };
					                    if (pr && pr.length) $(pr[0]).css({ widthdata.widthheightdata.height
						});
					                    // propagating resize, and updating values for each animation step
					                    self._updateCache(data);
					                    self._propagate("resize"event);
					                }
				            }
			        );
			    }
		});
	$.ui.plugin.add("resizable""containment", {
		    start: function(eventui) {
			        var self = $(this).data("resizable"), self.optionsel self.element;
			        var oc o.containment,    ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
			        if (!ce) return;
			        self.containerElement = $(ce);
			        if (/document/.test(oc) || oc == document) {
				            self.containerOffset = { left0top0
					};
				            self.containerPosition = { left0top0
					};
				            self.parentData = {
					                element: $(document), left0top0,
					                width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
					            };
				        }
			        // i'm a node, so compute top, left, right, bottom
			        else {
				            var element = $(ce), [];
				            $([ "Top""Right""Left""Bottom" ]).each(function(iname) {
					p[i] = num(element.css("padding" name));
					});
				            self.containerOffset element.offset();
				            self.containerPosition element.position();
				            self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1])
					};
				            var co self.containerOffsetch self.containerSize.height,    cw self.containerSize.width,
				                        width = ($.ui.hasScroll(ce"left") ? ce.scrollWidth cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight ch);
				            self.parentData = {
					                elementceleftco.lefttopco.topwidthwidthheightheight
					            };
				        }
			    },
		    resize: function(eventui) {
			        var self = $(this).data("resizable"), self.options,
			                ps self.containerSizeco self.containerOffsetcs self.sizecp self.position,
			                pRatio self._aspectRatio || event.shiftKeycop = { top:0left:0
				}, ce self.containerElement;
			        if (ce[0] != document && (/static/).test(ce.css('position'))) cop co;
			        if (cp.left < (self._helper co.left 0)) {
				            self.size.width self.size.width + (self._helper ? (self.position.left co.left) : (self.position.left cop.left));
				            if (pRatioself.size.height self.size.width o.aspectRatio;
				            self.position.left o.helper co.left 0;
				        }
			        if (cp.top < (self._helper co.top 0)) {
				            self.size.height self.size.height + (self._helper ? (self.position.top co.top) : self.position.top);
				            if (pRatioself.size.width self.size.height o.aspectRatio;
				            self.position.top self._helper co.top 0;
				        }
			        self.offset.left self.parentData.left+self.position.left;
			        self.offset.top self.parentData.top+self.position.top;
			        var woset Math.abs( (self._helper self.offset.left cop.left : (self.offset.left cop.left)) + self.sizeDiff.width ),
			                    hoset Math.abs( (self._helper self.offset.top cop.top : (self.offset.top co.top)) + self.sizeDiff.height );
			        var isParent self.containerElement.get(0) == self.element.parent().get(0),
			            isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));
			        if(isParent && isOffsetRelativewoset -= self.parentData.left;
			        if (woset self.size.width >= self.parentData.width) {
				            self.size.width self.parentData.width woset;
				            if (pRatioself.size.height self.size.width self.aspectRatio;
				        }
			        if (hoset self.size.height >= self.parentData.height) {
				            self.size.height self.parentData.height hoset;
				            if (pRatioself.size.width self.size.height self.aspectRatio;
				        }
			    },
		    stop: function(eventui){
			        var self = $(this).data("resizable"), self.optionscp self.position,
			                co self.containerOffsetcop self.containerPositionce self.containerElement;
			        var helper = $(self.helper), ho helper.offset(), helper.outerWidth() - self.sizeDiff.widthhelper.outerHeight() - self.sizeDiff.height;
			        if (self._helper && !o.animate && (/relative/).test(ce.css('position')))
			            $(this).css({ leftho.left cop.left co.leftwidthwheighth
				});
			        if (self._helper && !o.animate && (/static/).test(ce.css('position')))
			            $(this).css({ leftho.left cop.left co.leftwidthwheighth
				});
			    }
		});
	$.ui.plugin.add("resizable""ghost", {
		    start: function(eventui) {
			        var self = $(this).data("resizable"), self.optionscs self.size;
			        self.ghost self.originalElement.clone();
			        self.ghost
			            .css({ opacity.25display'block'position'relative'heightcs.heightwidthcs.widthmargin0left0top0
				})
			            .addClass('ui-resizable-ghost')
			            .addClass(typeof o.ghost == 'string' o.ghost '');
			        self.ghost.appendTo(self.helper);
			    },
		    resize: function(eventui){
			        var self = $(this).data("resizable"), self.options;
			        if (self.ghostself.ghost.css({ position'relative'heightself.size.heightwidthself.size.width
				});
			    },
		    stop: function(eventui){
			        var self = $(this).data("resizable"), self.options;
			        if (self.ghost && self.helperself.helper.get(0).removeChild(self.ghost.get(0));
			    }
		});
	$.ui.plugin.add("resizable""grid", {
		    resize: function(eventui) {
			        var self = $(this).data("resizable"), self.optionscs self.sizeos self.originalSizeop self.originalPositionself.axisratio o._aspectRatio || event.shiftKey;
			        o.grid typeof o.grid == "number" ? [o.grido.grid] : o.grid;
			        var ox Math.round((cs.width os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy Math.round((cs.height os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
			        if (/^(se|s|e)$/.test(a)) {
				            self.size.width os.width ox;
				            self.size.height os.height oy;
				        }
			        else if (/^(ne)$/.test(a)) {
				            self.size.width os.width ox;
				            self.size.height os.height oy;
				            self.position.top op.top oy;
				        }
			        else if (/^(sw)$/.test(a)) {
				            self.size.width os.width ox;
				            self.size.height os.height oy;
				            self.position.left op.left ox;
				        }
			        else {
				            self.size.width os.width ox;
				            self.size.height os.height oy;
				            self.position.top op.top oy;
				            self.position.left op.left ox;
				        }
			    }
		});
	var num = function(v) {
		    return parseInt(v10) || 0;
		};
	var isNumber = function(value) {
		    return !isNaN(parseInt(value10));
		};
	})(jQuery);
/*
 * jQuery UI Selectable 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Selectables
 *
 * Depends:
 *    jquery.ui.core.js
 *    jquery.ui.mouse.js
 *    jquery.ui.widget.js
 */
(function( $, undefined ) {
	$.widget("ui.selectable", $.ui.mouse, {
		    options: {
			        appendTo'body',
			        autoRefreshtrue,
			        distance0,
			        filter'*',
			        tolerance'touch'
			    },
		    _create: function() {
			        var self this;
			        this.element.addClass("ui-selectable");
			        this.dragged false;
			        // cache selectee children based on filter
			        var selectees;
			        this.refresh = function() {
				            selectees = $(self.options.filterself.element[0]);
				            selectees.each(function() {
					                var $this = $(this);
					                var pos $this.offset();
					                $.data(this"selectable-item", {
						                    elementthis,
						                    $element$this,
						                    leftpos.left,
						                    toppos.top,
						                    rightpos.left $this.outerWidth(),
						                    bottompos.top $this.outerHeight(),
						                    startselectedfalse,
						                    selected$this.hasClass('ui-selected'),
						                    selecting$this.hasClass('ui-selecting'),
						                    unselecting$this.hasClass('ui-unselecting')
						                });
					            });
				        };
			        this.refresh();
			        this.selectees selectees.addClass("ui-selectee");
			        this._mouseInit();
			        this.helper = $("<div class='ui-selectable-helper'></div>");
			    },
		    destroy: function() {
			        this.selectees
			            .removeClass("ui-selectee")
			            .removeData("selectable-item");
			        this.element
			            .removeClass("ui-selectable ui-selectable-disabled")
			            .removeData("selectable")
			            .unbind(".selectable");
			        this._mouseDestroy();
			        return this;
			    },
		    _mouseStart: function(event) {
			        var self this;
			        this.opos = [event.pageXevent.pageY];
			        if (this.options.disabled)
			            return;
			        var options this.options;
			        this.selectees = $(options.filterthis.element[0]);
			        this._trigger("start"event);
			        $(options.appendTo).append(this.helper);
			        // position helper (lasso)
			        this.helper.css({
				            "left"event.clientX,
				            "top"event.clientY,
				            "width"0,
				            "height"0
				        });
			        if (options.autoRefresh) {
				            this.refresh();
				        }
			        this.selectees.filter('.ui-selected').each(function() {
				            var selectee = $.data(this"selectable-item");
				            selectee.startselected true;
				            if (!event.metaKey) {
					                selectee.$element.removeClass('ui-selected');
					                selectee.selected false;
					                selectee.$element.addClass('ui-unselecting');
					                selectee.unselecting true;
					                // selectable UNSELECTING callback
					                self._trigger("unselecting"event, {
						                    unselectingselectee.element
						                });
					            }
				        });
			        $(event.target).parents().andSelf().each(function() {
				            var selectee = $.data(this"selectable-item");
				            if (selectee) {
					                var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected');
					                selectee.$element
					                    .removeClass(doSelect "ui-unselecting" "ui-selected")
					                    .addClass(doSelect "ui-selecting" "ui-unselecting");
					                selectee.unselecting = !doSelect;
					                selectee.selecting doSelect;
					                selectee.selected doSelect;
					                // selectable (UN)SELECTING callback
					                if (doSelect) {
						                    self._trigger("selecting"event, {
							                        selectingselectee.element
							                    });
						                } else {
						                    self._trigger("unselecting"event, {
							                        unselectingselectee.element
							                    });
						                }
					                return false;
					            }
				        });
			    },
		    _mouseDrag: function(event) {
			        var self this;
			        this.dragged true;
			        if (this.options.disabled)
			            return;
			        var options this.options;
			        var x1 this.opos[0], y1 this.opos[1], x2 event.pageXy2 event.pageY;
			        if (x1 x2) {
				var tmp x2;
				 x2 x1;
				 x1 tmp;
				}
			        if (y1 y2) {
				var tmp y2;
				 y2 y1;
				 y1 tmp;
				}
			        this.helper.css({leftx1topy1widthx2-x1heighty2-y1});
			        this.selectees.each(function() {
				            var selectee = $.data(this"selectable-item");
				            //prevent helper from being selected if appendTo: selectable
				            if (!selectee || selectee.element == self.element[0])
				                return;
				            var hit false;
				            if (options.tolerance == 'touch') {
					                hit = ( !(selectee.left x2 || selectee.right x1 || selectee.top y2 || selectee.bottom y1) );
					            } else if (options.tolerance == 'fit') {
					                hit = (selectee.left x1 && selectee.right x2 && selectee.top y1 && selectee.bottom y2);
					            }
				            if (hit) {
					                // SELECT
					                if (selectee.selected) {
						                    selectee.$element.removeClass('ui-selected');
						                    selectee.selected false;
						                }
					                if (selectee.unselecting) {
						                    selectee.$element.removeClass('ui-unselecting');
						                    selectee.unselecting false;
						                }
					                if (!selectee.selecting) {
						                    selectee.$element.addClass('ui-selecting');
						                    selectee.selecting true;
						                    // selectable SELECTING callback
						                    self._trigger("selecting"event, {
							                        selectingselectee.element
							                    });
						                }
					            } else {
					                // UNSELECT
					                if (selectee.selecting) {
						                    if (event.metaKey && selectee.startselected) {
							                        selectee.$element.removeClass('ui-selecting');
							                        selectee.selecting false;
							                        selectee.$element.addClass('ui-selected');
							                        selectee.selected true;
							                    } else {
							                        selectee.$element.removeClass('ui-selecting');
							                        selectee.selecting false;
							                        if (selectee.startselected) {
								                            selectee.$element.addClass('ui-unselecting');
								                            selectee.unselecting true;
								                        }
							                        // selectable UNSELECTING callback
							                        self._trigger("unselecting"event, {
								                            unselectingselectee.element
								                        });
							                    }
						                }
					                if (selectee.selected) {
						                    if (!event.metaKey && !selectee.startselected) {
							                        selectee.$element.removeClass('ui-selected');
							                        selectee.selected false;
							                        selectee.$element.addClass('ui-unselecting');
							                        selectee.unselecting true;
							                        // selectable UNSELECTING callback
							                        self._trigger("unselecting"event, {
								                            unselectingselectee.element
								                        });
							                    }
						                }
					            }
				        });
			        return false;
			    },
		    _mouseStop: function(event) {
			        var self this;
			        this.dragged false;
			        var options this.options;
			        $('.ui-unselecting'this.element[0]).each(function() {
				            var selectee = $.data(this"selectable-item");
				            selectee.$element.removeClass('ui-unselecting');
				            selectee.unselecting false;
				            selectee.startselected false;
				            self._trigger("unselected"event, {
					                unselectedselectee.element
					            });
				        });
			        $('.ui-selecting'this.element[0]).each(function() {
				            var selectee = $.data(this"selectable-item");
				            selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
				            selectee.selecting false;
				            selectee.selected true;
				            selectee.startselected true;
				            self._trigger("selected"event, {
					                selectedselectee.element
					            });
				        });
			        this._trigger("stop"event);
			        this.helper.remove();
			        return false;
			    }
		});
	$.extend($.ui.selectable, {
		    version"1.8.5"
		});
	})(jQuery);
/*
 * jQuery UI Sortable 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Sortables
 *
 * Depends:
 *    jquery.ui.core.js
 *    jquery.ui.mouse.js
 *    jquery.ui.widget.js
 */
(function( $, undefined ) {
	$.widget("ui.sortable", $.ui.mouse, {
		    widgetEventPrefix"sort",
		    options: {
			        appendTo"parent",
			        axisfalse,
			        connectWithfalse,
			        containmentfalse,
			        cursor'auto',
			        cursorAtfalse,
			        dropOnEmptytrue,
			        forcePlaceholderSizefalse,
			        forceHelperSizefalse,
			        gridfalse,
			        handlefalse,
			        helper"original",
			        items'> *',
			        opacityfalse,
			        placeholderfalse,
			        revertfalse,
			        scrolltrue,
			        scrollSensitivity20,
			        scrollSpeed20,
			        scope"default",
			        tolerance"intersect",
			        zIndex1000
			    },
		    _create: function() {
			        var this.options;
			        this.containerCache {};
			        this.element.addClass("ui-sortable");
			        //Get the items
			        this.refresh();
			        //Let's determine if the items are floating
			        this.floating this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;
			        //Let's determine the parent's offset
			        this.offset this.element.offset();
			        //Initialize mouse events for interaction
			        this._mouseInit();
			    },
		    destroy: function() {
			        this.element
			            .removeClass("ui-sortable ui-sortable-disabled")
			            .removeData("sortable")
			            .unbind(".sortable");
			        this._mouseDestroy();
			        for ( var this.items.length 1;
			 >= 0;
			 i-- )
			            this.items[i].item.removeData("sortable-item");
			        return this;
			    },
		    _setOption: function(keyvalue){
			        if ( key === "disabled" ) {
				            this.optionskey ] = value;
				            this.widget()
				                [ value "addClass" "removeClass"]( "ui-sortable-disabled" );
				        } else {
				            // Don't call widget base _setOption for disable as it adds ui-state-disabled class
				            $.Widget.prototype._setOption.apply(thisarguments);
				        }
			    },
		    _mouseCapture: function(eventoverrideHandle) {
			        if (this.reverting) {
				            return false;
				        }
			        if(this.options.disabled || this.options.type == 'static') return false;
			        //We have to refresh the items data once first
			        this._refreshItems(event);
			        //Find out if the clicked node (or one of its parents) is a actual item in this.items
			        var currentItem nullself thisnodes = $(event.target).parents().each(function() {
				            if($.data(this'sortable-item') == self) {
					                currentItem = $(this);
					                return false;
					            }
				        });
			        if($.data(event.target'sortable-item') == selfcurrentItem = $(event.target);
			        if(!currentItem) return false;
			        if(this.options.handle && !overrideHandle) {
				            var validHandle false;
				            $(this.options.handlecurrentItem).find("*").andSelf().each(function() {
					if(this == event.targetvalidHandle true;
					});
				            if(!validHandle) return false;
				        }
			        this.currentItem currentItem;
			        this._removeCurrentsFromItems();
			        return true;
			    },
		    _mouseStart: function(eventoverrideHandlenoActivation) {
			        var this.optionsself this;
			        this.currentContainer this;
			        //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
			        this.refreshPositions();
			        //Create and append the visible helper
			        this.helper this._createHelper(event);
			        //Cache the helper size
			        this._cacheHelperProportions();
			        /*
			         * - Position generation -
			         * This block generates everything position related - it's the core of draggables.
			         */
			        //Cache the margins of the original element
			        this._cacheMargins();
			        //Get the next scrolling parent
			        this.scrollParent this.helper.scrollParent();
			        //The element's absolute position on the page minus margins
			        this.offset this.currentItem.offset();
			        this.offset = {
				            topthis.offset.top this.margins.top,
				            leftthis.offset.left this.margins.left
				        };
			        // Only after we got the offset, we can change the helper's position to absolute
			        // TODO: Still need to figure out a way to make relative sorting possible
			        this.helper.css("position""absolute");
			        this.cssPosition this.helper.css("position");
			        $.extend(this.offset, {
				            click: { //Where the click happened, relative to the element
					                leftevent.pageX this.offset.left,
					                topevent.pageY this.offset.top
					            },
				            parentthis._getParentOffset(),
				            relativethis._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
				        });
			        //Generate the original position
			        this.originalPosition this._generatePosition(event);
			        this.originalPageX event.pageX;
			        this.originalPageY event.pageY;
			        //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
			        (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
			        //Cache the former DOM position
			        this.domPosition = { prevthis.currentItem.prev()[0], parentthis.currentItem.parent()[0]
				};
			        //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
			        if(this.helper[0] != this.currentItem[0]) {
				            this.currentItem.hide();
				        }
			        //Create the placeholder
			        this._createPlaceholder();
			        //Set a containment if given in the options
			        if(o.containment)
			            this._setContainment();
			        if(o.cursor) {
				// cursor option
				            if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
				            $('body').css("cursor"o.cursor);
				        }
			        if(o.opacity) {
				// opacity option
				            if (this.helper.css("opacity")) this._storedOpacity this.helper.css("opacity");
				            this.helper.css("opacity"o.opacity);
				        }
			        if(o.zIndex) {
				// zIndex option
				            if (this.helper.css("zIndex")) this._storedZIndex this.helper.css("zIndex");
				            this.helper.css("zIndex"o.zIndex);
				        }
			        //Prepare scrolling
			        if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
			            this.overflowOffset this.scrollParent.offset();
			        //Call callbacks
			        this._trigger("start"eventthis._uiHash());
			        //Recache the helper size
			        if(!this._preserveHelperProportions)
			            this._cacheHelperProportions();
			        //Post 'activate' events to possible containers
			        if(!noActivation) {
				             for (var this.containers.length 1;
				 >= 0;
				 i--) {
					this.containers[i]._trigger("activate"eventself._uiHash(this));
					}
				        }
			        //Prepare possible droppables
			        if($.ui.ddmanager)
			            $.ui.ddmanager.current this;
			        if ($.ui.ddmanager && !o.dropBehaviour)
			            $.ui.ddmanager.prepareOffsets(thisevent);
			        this.dragging true;
			        this.helper.addClass("ui-sortable-helper");
			        this._mouseDrag(event);
			 //Execute the drag once - this causes the helper not to be visible before getting its correct position
			        return true;
			    },
		    _mouseDrag: function(event) {
			        //Compute the helpers position
			        this.position this._generatePosition(event);
			        this.positionAbs this._convertPositionTo("absolute");
			        if (!this.lastPositionAbs) {
				            this.lastPositionAbs this.positionAbs;
				        }
			        //Do scrolling
			        if(this.options.scroll) {
				            var this.optionsscrolled false;
				            if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
					                if((this.overflowOffset.top this.scrollParent[0].offsetHeight) - event.pageY o.scrollSensitivity)
					                    this.scrollParent[0].scrollTop scrolled this.scrollParent[0].scrollTop o.scrollSpeed;
					                else if(event.pageY this.overflowOffset.top o.scrollSensitivity)
					                    this.scrollParent[0].scrollTop scrolled this.scrollParent[0].scrollTop o.scrollSpeed;
					                if((this.overflowOffset.left this.scrollParent[0].offsetWidth) - event.pageX o.scrollSensitivity)
					                    this.scrollParent[0].scrollLeft scrolled this.scrollParent[0].scrollLeft o.scrollSpeed;
					                else if(event.pageX this.overflowOffset.left o.scrollSensitivity)
					                    this.scrollParent[0].scrollLeft scrolled this.scrollParent[0].scrollLeft o.scrollSpeed;
					            } else {
					                if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
					                    scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
					                else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
					                    scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
					                if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
					                    scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
					                else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
					                    scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
					            }
				            if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
				                $.ui.ddmanager.prepareOffsets(thisevent);
				        }
			        //Regenerate the absolute position used for position checks
			        this.positionAbs this._convertPositionTo("absolute");
			        //Set the helper position
			        if(!this.options.axis || this.options.axis != "y"this.helper[0].style.left this.position.left+'px';
			        if(!this.options.axis || this.options.axis != "x"this.helper[0].style.top this.position.top+'px';
			        //Rearrange
			        for (var this.items.length 1;
			 >= 0;
			 i--) {
				            //Cache variables and intersection, continue if no intersection
				            var item this.items[i], itemElement item.item[0], intersection this._intersectsWithPointer(item);
				            if (!intersection) continue;
				            if(itemElement != this.currentItem[0//cannot intersect with itself
				                &&    this.placeholder[intersection == "next" "prev"]()[0] != itemElement //no useless actions that have been done before
				                &&    !$.ui.contains(this.placeholder[0], itemElement//no action if the item moved is the parent of the item checked
				                && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)
				                //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
				            ) {
					                this.direction intersection == "down" "up";
					                if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
						                    this._rearrange(eventitem);
						                } else {
						                    break;
						                }
					                this._trigger("change"eventthis._uiHash());
					                break;
					            }
				        }
			        //Post events to containers
			        this._contactContainers(event);
			        //Interconnect with droppables
			        if($.ui.ddmanager) $.ui.ddmanager.drag(thisevent);
			        //Call callbacks
			        this._trigger('sort'eventthis._uiHash());
			        this.lastPositionAbs this.positionAbs;
			        return false;
			    },
		    _mouseStop: function(eventnoPropagation) {
			        if(!event) return;
			        //If we are using droppables, inform the manager about the drop
			        if ($.ui.ddmanager && !this.options.dropBehaviour)
			            $.ui.ddmanager.drop(thisevent);
			        if(this.options.revert) {
				            var self this;
				            var cur self.placeholder.offset();
				            self.reverting true;
				            $(this.helper).animate({
					                leftcur.left this.offset.parent.left self.margins.left + (this.offsetParent[0] == document.body this.offsetParent[0].scrollLeft),
					                topcur.top this.offset.parent.top self.margins.top + (this.offsetParent[0] == document.body this.offsetParent[0].scrollTop)
					            }, parseInt(this.options.revert10) || 500, function() {
					                self._clear(event);
					            });
				        } else {
				            this._clear(eventnoPropagation);
				        }
			        return false;
			    },
		    cancel: function() {
			        var self this;
			        if(this.dragging) {
				            this._mouseUp();
				            if(this.options.helper == "original")
				                this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
				            else
				                this.currentItem.show();
				            //Post deactivating events to containers
				            for (var this.containers.length 1;
				 >= 0;
				 i--){
					                this.containers[i]._trigger("deactivate"nullself._uiHash(this));
					                if(this.containers[i].containerCache.over) {
						                    this.containers[i]._trigger("out"nullself._uiHash(this));
						                    this.containers[i].containerCache.over 0;
						                }
					            }
				        }
			        //$(this.placeholder[0]).remove();
			 would have been the jQuery way unfortunatelyit unbinds ALL events from the original node!
			        if(this.placeholder[0].parentNodethis.placeholder[0].parentNode.removeChild(this.placeholder[0]);
			        if(this.options.helper != "original" && this.helper && this.helper[0].parentNodethis.helper.remove();
			        $.extend(this, {
				            helpernull,
				            draggingfalse,
				            revertingfalse,
				            _noFinalSortnull
				        });
			        if(this.domPosition.prev) {
				            $(this.domPosition.prev).after(this.currentItem);
				        } else {
				            $(this.domPosition.parent).prepend(this.currentItem);
				        }
			        return this;
			    },
		    serialize: function(o) {
			        var items this._getItemsAsjQuery(&& o.connected);
			        var str [];
			 || {};
			        $(items).each(function() {
				            var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
				            if(resstr.push((o.key || res[1]+'[]')+'='+(o.key && o.expression res[1] : res[2]));
				        });
			        if(!str.length && o.key) {
				            str.push(o.key '=');
				        }
			        return str.join('&');
			    },
		    toArray: function(o) {
			        var items this._getItemsAsjQuery(&& o.connected);
			        var ret [];
			 || {};
			        items.each(function() {
				ret.push($(o.item || this).attr(o.attribute || 'id') || '');
				});
			        return ret;
			    },
		    /* Be careful with the following core functions */
		    _intersectsWith: function(item) {
			        var x1 this.positionAbs.left,
			            x2 x1 this.helperProportions.width,
			            y1 this.positionAbs.top,
			            y2 y1 this.helperProportions.height;
			        var item.left,
			            item.width,
			            item.top,
			            item.height;
			        var dyClick this.offset.click.top,
			            dxClick this.offset.click.left;
			        var isOverElement = (y1 dyClick) > && (y1 dyClick) < && (x1 dxClick) > && (x1 dxClick) < r;
			        if(       this.options.tolerance == "pointer"
			            || this.options.forcePointerForContainers
			            || (this.options.tolerance != "pointer" && this.helperProportions[this.floating 'width' 'height'] > item[this.floating 'width' 'height'])
			        ) {
				            return isOverElement;
				        } else {
				            return (x1 + (this.helperProportions.width 2// Right Half
				                && x2 - (this.helperProportions.width 2) < // Left Half
				                && y1 + (this.helperProportions.height 2// Bottom Half
				                && y2 - (this.helperProportions.height 2) < );
				 // Top Half
				        }
			    },
		    _intersectsWithPointer: function(item) {
			        var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top this.offset.click.topitem.topitem.height),
			            isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left this.offset.click.leftitem.leftitem.width),
			            isOverElement isOverElementHeight && isOverElementWidth,
			            verticalDirection this._getDragVerticalDirection(),
			            horizontalDirection this._getDragHorizontalDirection();
			        if (!isOverElement)
			            return false;
			        return this.floating ?
			            ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? )
			            : ( verticalDirection && (verticalDirection == "down" 1) );
			    },
		    _intersectsWithSides: function(item) {
			        var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top this.offset.click.topitem.top + (item.height/2), item.height),
			            isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left this.offset.click.leftitem.left + (item.width/2), item.width),
			            verticalDirection this._getDragVerticalDirection(),
			            horizontalDirection this._getDragHorizontalDirection();
			        if (this.floating && horizontalDirection) {
				            return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
				        } else {
				            return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
				        }
			    },
		    _getDragVerticalDirection: function() {
			        var delta this.positionAbs.top this.lastPositionAbs.top;
			        return delta != && (delta "down" "up");
			    },
		    _getDragHorizontalDirection: function() {
			        var delta this.positionAbs.left this.lastPositionAbs.left;
			        return delta != && (delta "right" "left");
			    },
		    refresh: function(event) {
			        this._refreshItems(event);
			        this.refreshPositions();
			        return this;
			    },
		    _connectWith: function() {
			        var options this.options;
			        return options.connectWith.constructor == String
			            ? [options.connectWith]
			            : options.connectWith;
			    },
		    _getItemsAsjQuery: function(connected) {
			        var self this;
			        var items [];
			        var queries [];
			        var connectWith this._connectWith();
			        if(connectWith && connected) {
				            for (var connectWith.length 1;
				 >= 0;
				 i--){
					                var cur = $(connectWith[i]);
					                for (var cur.length 1;
					 >= 0;
					 j--){
						                    var inst = $.data(cur[j], 'sortable');
						                    if(inst && inst != this && !inst.options.disabled) {
							                        queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.itemsinst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
							                    }
						                };
					            };
				        }
			        queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.elementnull, { optionsthis.optionsitemthis.currentItem
				}) : $(this.options.itemsthis.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
			        for (var queries.length 1;
			 >= 0;
			 i--){
				            queries[i][0].each(function() {
					                items.push(this);
					            });
				        };
			        return $(items);
			    },
		    _removeCurrentsFromItems: function() {
			        var list = this.currentItem.find(":data(sortable-item)");
			        for (var i=0;
			 this.items.length;
			 i++) {
				            for (var j=0;
				 < list.length;
				 j++) {
					                if(list[j] == this.items[i].item[0])
					                    this.items.splice(i,1);
					            };
				        };
			    },
		    _refreshItems: function(event) {
			        this.items [];
			        this.containers = [this];
			        var items this.items;
			        var self this;
			        var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { itemthis.currentItem
				}) : $(this.options.itemsthis.element), this]];
			        var connectWith this._connectWith();
			        if(connectWith) {
				            for (var connectWith.length 1;
				 >= 0;
				 i--){
					                var cur = $(connectWith[i]);
					                for (var cur.length 1;
					 >= 0;
					 j--){
						                    var inst = $.data(cur[j], 'sortable');
						                    if(inst && inst != this && !inst.options.disabled) {
							                        queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { itemthis.currentItem
								}) : $(inst.options.itemsinst.element), inst]);
							                        this.containers.push(inst);
							                    }
						                };
					            };
				        }
			        for (var queries.length 1;
			 >= 0;
			 i--) {
				            var targetData queries[i][1];
				            var _queries queries[i][0];
				            for (var j=0queriesLength _queries.length;
				 queriesLength;
				 j++) {
					                var item = $(_queries[j]);
					                item.data('sortable-item'targetData);
					 // Data for target checking (mouse manager)
					                items.push({
						                    itemitem,
						                    instancetargetData,
						                    width0height0,
						                    left0top0
						                });
					            };
				        };
			    },
		    refreshPositions: function(fast) {
			        //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
			        if(this.offsetParent && this.helper) {
				            this.offset.parent this._getParentOffset();
				        }
			        for (var this.items.length 1;
			 >= 0;
			 i--){
				            var item this.items[i];
				            var this.options.toleranceElement ? $(this.options.toleranceElementitem.item) : item.item;
				            if (!fast) {
					                item.width t.outerWidth();
					                item.height t.outerHeight();
					            }
				            var t.offset();
				            item.left p.left;
				            item.top p.top;
				        };
			        if(this.options.custom && this.options.custom.refreshContainers) {
				            this.options.custom.refreshContainers.call(this);
				        } else {
				            for (var this.containers.length 1;
				 >= 0;
				 i--){
					                var this.containers[i].element.offset();
					                this.containers[i].containerCache.left p.left;
					                this.containers[i].containerCache.top p.top;
					                this.containers[i].containerCache.width    this.containers[i].element.outerWidth();
					                this.containers[i].containerCache.height this.containers[i].element.outerHeight();
					            };
				        }
			        return this;
			    },
		    _createPlaceholder: function(that) {
			        var self that || thisself.options;
			        if(!o.placeholder |