Вход Регистрация
Файл: vsime.com/js/jquery-ui-1.10.1.custom.js
Строк: 17833
<?php
/*! jQuery UI - v1.10.1 - 2013-02-16
* http://jqueryui.com
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js, jquery.ui.effect.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js
* Copyright (c) 2013 jQuery Foundation and other contributors Licensed MIT */

(function( $, undefined ) {

var 
uuid 0,
    
runiqueId = /^ui-id-d+$/;

// 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.10.1",

    
keyCode: {
        
BACKSPACE8,
        
COMMA188,
        
DELETE46,
        
DOWN40,
        
END35,
        
ENTER13,
        
ESCAPE27,
        
HOME36,
        
LEFT37,
        
NUMPAD_ADD107,
        
NUMPAD_DECIMAL110,
        
NUMPAD_DIVIDE111,
        
NUMPAD_ENTER108,
        
NUMPAD_MULTIPLY106,
        
NUMPAD_SUBTRACT109,
        
PAGE_DOWN34,
        
PAGE_UP33,
        
PERIOD190,
        
RIGHT39,
        
SPACE32,
        
TAB9,
        
UP38
    
}
});

// plugins
$.fn.extend({
    
_focus: $.fn.focus,
    
focus: function( delay, fn ) {
        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 (($.
ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) {
            
scrollParent this.parents().filter(function() {
                return (/(
relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
            }).
eq(0);
        } else {
            
scrollParent this.parents().filter(function() {
                return (/(
auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
            }).
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-index: 0;"></div></div>
                    
value parseIntelem.css"zIndex" ), 10 );
                    if ( !
isNaNvalue ) && value !== ) {
                        return 
value;
                    }
                }
                
elem elem.parent();
            }
        }

        return 
0;
    },

    
uniqueId: function() {
        return 
this.each(function() {
            if ( !
this.id ) {
                
this.id "ui-id-" + (++uuid);
            }
        });
    },

    
removeUniqueId: function() {
        return 
this.each(function() {
            if ( 
runiqueId.testthis.id ) ) {
                $( 
this ).removeAttr"id" );
            }
        });
    }
});

// selectors
function focusableelementisTabIndexNotNaN ) {
    var 
mapmapNameimg,
        
nodeName element.nodeName.toLowerCase();
    if ( 
"area" === nodeName ) {
        
map element.parentNode;
        
mapName map.name;
        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 || isTabIndexNotNaN :
            
isTabIndexNotNaN) &&
        
// the element and all of its ancestors must be visible
        
visibleelement );
}

function 
visibleelement ) {
    return $.
expr.filters.visibleelement ) &&
        !$( 
element ).parents().addBack().filter(function() {
            return $.
cssthis"visibility" ) === "hidden";
        }).
length;
}

$.
extend( $.expr":" ], {
    
data: $.expr.createPseudo ?
        $.
expr.createPseudo(function( dataName ) {
            return function( 
elem ) {
                return !!$.
dataelemdataName );
            };
        }) :
        
// support: jQuery <1.8
        
function( elemimatch ) {
            return !!$.
dataelemmatch] );
        },

    
focusable: function( element ) {
        return 
focusableelement, !isNaN( $.attrelement"tabindex" ) ) );
    },

    
tabbable: function( element ) {
        var 
tabIndex = $.attrelement"tabindex" ),
            
isTabIndexNaN isNaNtabIndex );
        return ( 
isTabIndexNaN || tabIndex >= ) && focusableelement, !isTabIndexNaN );
    }
});

// support: jQuery <1.8
if ( !$( "<a>" ).outerWidth).jquery ) {
    $.
each( [ "Width""Height" ], function( iname ) {
        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 
reduceelemsizebordermargin ) {
            $.
eachside, function() {
                
size -= parseFloat( $.csselem"padding" this ) ) || 0;
                if ( 
border ) {
                    
size -= parseFloat( $.csselem"border" this "Width" ) ) || 0;
                }
                if ( 
margin ) {
                    
size -= parseFloat( $.csselem"margin" this ) ) || 0;
                }
            });
            return 
size;
        }

        $.fn[ 
"inner" name ] = function( size ) {
            if ( 
size === undefined ) {
                return 
orig"inner" name ].callthis );
            }

            return 
this.each(function() {
                $( 
this ).csstypereducethissize ) + "px" );
            });
        };

        $.fn[ 
"outer" name] = function( sizemargin ) {
            if ( 
typeof size !== "number" ) {
                return 
orig"outer" name ].callthissize );
            }

            return 
this.each(function() {
                $( 
this).csstypereducethissizetruemargin ) + "px" );
            });
        };
    });
}

// support: jQuery <1.8
if ( !$.fn.addBack ) {
    $.fn.
addBack = function( selector ) {
        return 
this.addselector == null ?
            
this.prevObject this.prevObject.filterselector )
        );
    };
}

// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
if ( $( "<a>" ).data"a-b""a" ).removeData"a-b" ).data"a-b" ) ) {
    $.fn.
removeData = (function( removeData ) {
        return function( 
key ) {
            if ( 
arguments.length ) {
                return 
removeData.callthis, $.camelCasekey ) );
            } else {
                return 
removeData.callthis );
            }
        };
    })( $.fn.
removeData );
}





// deprecated
$.ui.ie = !!/msie [w.]+/.execnavigator.userAgent.toLowerCase() );

$.
support.selectstart "onselectstart" in document.createElement"div" );
$.fn.
extend({
    
disableSelection: function() {
        return 
this.bind( ( $.support.selectstart "selectstart" "mousedown" ) +
            
".ui-disableSelection", function( event ) {
                
event.preventDefault();
            });
    },

    
enableSelection: function() {
        return 
this.unbind".ui-disableSelection" );
    }
});

$.
extend( $.ui, {
    
// $.ui.plugin is deprecated.  Use the proxy pattern instead.
    
plugin: {
        
add: function( moduleoptionset ) {
            var 
i,
                
proto = $.uimodule ].prototype;
            for ( 
i in set ) {
                
proto.plugins] = proto.plugins] || [];
                
proto.plugins].push( [ optionset] ] );
            }
        },
        
call: function( instancenameargs ) {
            var 
i,
                
set instance.pluginsname ];
            if ( !
set || !instance.element].parentNode || instance.element].parentNode.nodeType === 11 ) {
                return;
            }

            for ( 
0set.lengthi++ ) {
                if ( 
instance.optionsset][ ] ] ) {
                    
set][ ].applyinstance.elementargs );
                }
            }
        }
    },

    
// 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;
    }
});

})( 
jQuery );
(function( $, 
undefined ) {

var 
uuid 0,
    
slice = Array.prototype.slice,
    
_cleanData = $.cleanData;
$.
cleanData = function( elems ) {
    for ( var 
0elem; (elem elems[i]) != nulli++ ) {
        try {
            $( 
elem ).triggerHandler"remove" );
        
// http://bugs.jquery.com/ticket/8235
        
} catch( ) {}
    }
    
_cleanDataelems );
};

$.
widget = function( namebaseprototype ) {
    var 
fullNameexistingConstructorconstructorbasePrototype,
        
// proxiedPrototype allows the provided prototype to remain unmodified
        // so that it can be used as a mixin for multiple widgets (#8876)
        
proxiedPrototype = {},
        namespace = 
name.split"." )[ ];

    
name name.split"." )[ ];
    
fullName = namespace + "-" name;

    if ( !
prototype ) {
        
prototype base;
        
base = $.Widget;
    }

    
// create selector for plugin
    
$.expr":" ][ fullName.toLowerCase() ] = function( elem ) {
        return !!$.
dataelemfullName );
    };

    $[ namespace ] = $[ namespace ] || {};
    
existingConstructor = $[ namespace ][ name ];
    
constructor = $[ namespace ][ name ] = function( optionselement ) {
        
// allow instantiation without "new" keyword
        
if ( !this._createWidget ) {
            return new 
constructoroptionselement );
        }

        
// allow instantiation without initializing for simple inheritance
        // must use "new" keyword (the code above always passes args)
        
if ( arguments.length ) {
            
this._createWidgetoptionselement );
        }
    };
    
// extend with the existing constructor to carry over any static properties
    
$.extendconstructorexistingConstructor, {
        
versionprototype.version,
        
// copy the object used to create the prototype in case we need to
        // redefine the widget later
        
_proto: $.extend( {}, prototype ),
        
// track widgets that inherit from this widget in case this widget is
        // redefined after a widget inherits from it
        
_childConstructors: []
    });

    
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
    
basePrototype.options = $.widget.extend( {}, basePrototype.options );
    $.
eachprototype, function( propvalue ) {
        if ( !$.
isFunctionvalue ) ) {
            
proxiedPrototypeprop ] = value;
            return;
        }
        
proxiedPrototypeprop ] = (function() {
            var 
_super = function() {
                    return 
base.prototypeprop ].applythisarguments );
                },
                
_superApply = function( args ) {
                    return 
base.prototypeprop ].applythisargs );
                };
            return function() {
                var 
__super this._super,
                    
__superApply this._superApply,
                    
returnValue;

                
this._super _super;
                
this._superApply _superApply;

                
returnValue value.applythisarguments );

                
this._super __super;
                
this._superApply __superApply;

                return 
returnValue;
            };
        })();
    });
    
constructor.prototype = $.widget.extendbasePrototype, {
        
// TODO: remove support for widgetEventPrefix
        // always use the name + a colon as the prefix, e.g., draggable:start
        // don't prefix for widgets that aren't DOM-based
        
widgetEventPrefixexistingConstructor basePrototype.widgetEventPrefix name
    
}, proxiedPrototype, {
        
constructorconstructor,
        namespace: namespace,
        
widgetNamename,
        
widgetFullNamefullName
    
});

    
// If this widget is being redefined then we need to find all widgets that
    // are inheriting from it and redefine all of them so that they inherit from
    // the new version of this widget. We're essentially trying to replace one
    // level in the prototype chain.
    
if ( existingConstructor ) {
        $.
eachexistingConstructor._childConstructors, function( ichild ) {
            var 
childPrototype child.prototype;

            
// redefine the child widget using the same prototype that was
            // originally used, but inherit from the new version of the base
            
$.widgetchildPrototype.namespace + "." childPrototype.widgetNameconstructorchild._proto );
        });
        
// remove the list of existing child constructors from the old constructor
        // so the old child constructors can be garbage collected
        
delete existingConstructor._childConstructors;
    } else {
        
base._childConstructors.pushconstructor );
    }

    $.
widget.bridgenameconstructor );
};

$.
widget.extend = function( target ) {
    var 
input slice.callarguments),
        
inputIndex 0,
        
inputLength input.length,
        
key,
        
value;
    for ( ; 
inputIndex inputLengthinputIndex++ ) {
        for ( 
key in inputinputIndex ] ) {
            
value inputinputIndex ][ key ];
            if ( 
inputinputIndex ].hasOwnPropertykey ) && value !== undefined ) {
                
// Clone objects
                
if ( $.isPlainObjectvalue ) ) {
                    
targetkey ] = $.isPlainObjecttargetkey ] ) ?
                        $.
widget.extend( {}, targetkey ], value ) :
                        
// Don't extend strings, arrays, etc. with objects
                        
$.widget.extend( {}, value );
                
// Copy everything else by reference
                
} else {
                    
targetkey ] = value;
                }
            }
        }
    }
    return 
target;
};

$.
widget.bridge = function( nameobject ) {
    var 
fullName object.prototype.widgetFullName || name;
    $.fn[ 
name ] = function( options ) {
        var 
isMethodCall typeof options === "string",
            
args slice.callarguments),
            
returnValue this;

        
// allow multiple hashes to be passed on init
        
options = !isMethodCall && args.length ?
            $.
widget.extend.applynull, [ options ].concat(args) ) :
            
options;

        if ( 
isMethodCall ) {
            
this.each(function() {
                var 
methodValue,
                    
instance = $.datathisfullName );
                if ( !
instance ) {
                    return $.
error"cannot call methods on " name " prior to initialization; " +
                        
"attempted to call method '" options "'" );
                }
                if ( !$.
isFunctioninstance[options] ) || options.charAt) === "_" ) {
                    return $.
error"no such method '" options "' for " name " widget instance" );
                }
                
methodValue instanceoptions ].applyinstanceargs );
                if ( 
methodValue !== instance && methodValue !== undefined ) {
                    
returnValue methodValue && methodValue.jquery ?
                        
returnValue.pushStackmethodValue.get() ) :
                        
methodValue;
                    return 
false;
                }
            });
        } else {
            
this.each(function() {
                var 
instance = $.datathisfullName );
                if ( 
instance ) {
                    
instance.optionoptions || {} )._init();
                } else {
                    $.
datathisfullName, new objectoptionsthis ) );
                }
            });
        }

        return 
returnValue;
    };
};

$.
Widget = function( /* options, element */ ) {};
$.
Widget._childConstructors = [];

$.
Widget.prototype = {
    
widgetName"widget",
    
widgetEventPrefix"",
    
defaultElement"<div>",
    
options: {
        
disabledfalse,

        
// callbacks
        
createnull
    
},
    
_createWidget: function( optionselement ) {
        
element = $( element || this.defaultElement || this )[ ];
        
this.element = $( element );
        
this.uuid uuid++;
        
this.eventNamespace "." this.widgetName this.uuid;
        
this.options = $.widget.extend( {},
            
this.options,
            
this._getCreateOptions(),
            
options );

        
this.bindings = $();
        
this.hoverable = $();
        
this.focusable = $();

        if ( 
element !== this ) {
            $.
dataelementthis.widgetFullNamethis );
            
this._ontruethis.element, {
                
remove: function( event ) {
                    if ( 
event.target === element ) {
                        
this.destroy();
                    }
                }
            });
            
this.document = $( element.style ?
                
// element within the document
                
element.ownerDocument :
                
// element is window or document
                
element.document || element );
            
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
        }

        
this._create();
        
this._trigger"create"nullthis._getCreateEventData() );
        
this._init();
    },
    
_getCreateOptions: $.noop,
    
_getCreateEventData: $.noop,
    
_create: $.noop,
    
_init: $.noop,

    
destroy: function() {
        
this._destroy();
        
// we can probably remove the unbind calls in 2.0
        // all event bindings should go through this._on()
        
this.element
            
.unbindthis.eventNamespace )
            
// 1.9 BC for #7810
            // TODO remove dual storage
            
.removeDatathis.widgetName )
            .
removeDatathis.widgetFullName )
            
// support: jquery <1.6.3
            // http://bugs.jquery.com/ticket/9413
            
.removeData( $.camelCasethis.widgetFullName ) );
        
this.widget()
            .
unbindthis.eventNamespace )
            .
removeAttr"aria-disabled" )
            .
removeClass(
                
this.widgetFullName "-disabled " +
                
"ui-state-disabled" );

        
// clean up events and states
        
this.bindings.unbindthis.eventNamespace );
        
this.hoverable.removeClass"ui-state-hover" );
        
this.focusable.removeClass"ui-state-focus" );
    },
    
_destroy: $.noop,

    
widget: function() {
        return 
this.element;
    },

    
option: function( keyvalue ) {
        var 
options key,
            
parts,
            
curOption,
            
i;

        if ( 
arguments.length === ) {
            
// don't return a reference to the internal hash
            
return $.widget.extend( {}, this.options );
        }

        if ( 
typeof key === "string" ) {
            
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
            
options = {};
            
parts key.split"." );
            
key parts.shift();
            if ( 
parts.length ) {
                
curOption optionskey ] = $.widget.extend( {}, this.optionskey ] );
                for ( 
0parts.length 1i++ ) {
                    
curOptionparts] ] = curOptionparts] ] || {};
                    
curOption curOptionparts] ];
                }
                
key parts.pop();
                if ( 
value === undefined ) {
                    return 
curOptionkey ] === undefined null curOptionkey ];
                }
                
curOptionkey ] = value;
            } else {
                if ( 
value === undefined ) {
                    return 
this.optionskey ] === undefined null this.optionskey ];
                }
                
optionskey ] = value;
            }
        }

        
this._setOptionsoptions );

        return 
this;
    },
    
_setOptions: function( options ) {
        var 
key;

        for ( 
key in options ) {
            
this._setOptionkeyoptionskey ] );
        }

        return 
this;
    },
    
_setOption: function( keyvalue ) {
        
this.optionskey ] = value;

        if ( 
key === "disabled" ) {
            
this.widget()
                .
toggleClassthis.widgetFullName "-disabled ui-state-disabled", !!value )
                .
attr"aria-disabled"value );
            
this.hoverable.removeClass"ui-state-hover" );
            
this.focusable.removeClass"ui-state-focus" );
        }

        return 
this;
    },

    
enable: function() {
        return 
this._setOption"disabled"false );
    },
    
disable: function() {
        return 
this._setOption"disabled"true );
    },

    
_on: function( suppressDisabledCheckelementhandlers ) {
        var 
delegateElement,
            
instance this;

        
// no suppressDisabledCheck flag, shuffle arguments
        
if ( typeof suppressDisabledCheck !== "boolean" ) {
            
handlers element;
            
element suppressDisabledCheck;
            
suppressDisabledCheck false;
        }

        
// no element argument, shuffle and use this.element
        
if ( !handlers ) {
            
handlers element;
            
element this.element;
            
delegateElement this.widget();
        } else {
            
// accept selectors, DOM elements
            
element delegateElement = $( element );
            
this.bindings this.bindings.addelement );
        }

        $.
eachhandlers, function( eventhandler ) {
            function 
handlerProxy() {
                
// allow widgets to customize the disabled handling
                // - disabled as an array instead of boolean
                // - disabled class as method for disabling individual parts
                
if ( !suppressDisabledCheck &&
                        ( 
instance.options.disabled === true ||
                            $( 
this ).hasClass"ui-state-disabled" ) ) ) {
                    return;
                }
                return ( 
typeof handler === "string" instancehandler ] : handler )
                    .
applyinstancearguments );
            }

            
// copy the guid so direct unbinding works
            
if ( typeof handler !== "string" ) {
                
handlerProxy.guid handler.guid =
                    
handler.guid || handlerProxy.guid || $.guid++;
            }

            var 
match event.match( /^(w+)s*(.*)$/ ),
                
eventName match[1] + instance.eventNamespace,
                
selector match[2];
            if ( 
selector ) {
                
delegateElement.delegateselectoreventNamehandlerProxy );
            } else {
                
element.bindeventNamehandlerProxy );
            }
        });
    },

    
_off: function( elementeventName ) {
        
eventName = (eventName || "").split" " ).jointhis.eventNamespace " " ) + this.eventNamespace;
        
element.unbindeventName ).undelegateeventName );
    },

    
_delay: function( handlerdelay ) {
        function 
handlerProxy() {
            return ( 
typeof handler === "string" instancehandler ] : handler )
                .
applyinstancearguments );
        }
        var 
instance this;
        return 
setTimeouthandlerProxydelay || );
    },

    
_hoverable: function( element ) {
        
this.hoverable this.hoverable.addelement );
        
this._onelement, {
            
mouseenter: function( event ) {
                $( 
event.currentTarget ).addClass"ui-state-hover" );
            },
            
mouseleave: function( event ) {
                $( 
event.currentTarget ).removeClass"ui-state-hover" );
            }
        });
    },

    
_focusable: function( element ) {
        
this.focusable this.focusable.addelement );
        
this._onelement, {
            
focusin: function( event ) {
                $( 
event.currentTarget ).addClass"ui-state-focus" );
            },
            
focusout: function( event ) {
                $( 
event.currentTarget ).removeClass"ui-state-focus" );
            }
        });
    },

    
_trigger: function( typeeventdata ) {
        var 
proporig,
            
callback this.optionstype ];

        
data data || {};
        
event = $.Eventevent );
        
event.type = ( type === this.widgetEventPrefix ?
            
type :
            
this.widgetEventPrefix type ).toLowerCase();
        
// the original event may come from any element
        // so we need to reset the target on the new event
        
event.target this.element];

        
// copy original event properties over to the new event
        
orig event.originalEvent;
        if ( 
orig ) {
            for ( 
prop in orig ) {
                if ( !( 
prop in event ) ) {
                    
eventprop ] = origprop ];
                }
            }
        }

        
this.element.triggereventdata );
        return !( $.
isFunctioncallback ) &&
            
callback.applythis.element[0], [ event ].concatdata ) ) === false ||
            
event.isDefaultPrevented() );
    }
};

$.
each( { show"fadeIn"hide"fadeOut" }, function( methoddefaultEffect ) {
    $.
Widget.prototype"_" method ] = function( elementoptionscallback ) {
        if ( 
typeof options === "string" ) {
            
options = { effectoptions };
        }
        var 
hasOptions,
            
effectName = !options ?
                
method :
                
options === true || typeof options === "number" ?
                    
defaultEffect :
                    
options.effect || defaultEffect;
        
options options || {};
        if ( 
typeof options === "number" ) {
            
options = { durationoptions };
        }
        
hasOptions = !$.isEmptyObjectoptions );
        
options.complete callback;
        if ( 
options.delay ) {
            
element.delayoptions.delay );
        }
        if ( 
hasOptions && $.effects && $.effects.effecteffectName ] ) {
            
elementmethod ]( options );
        } else if ( 
effectName !== method && elementeffectName ] ) {
            
elementeffectName ]( options.durationoptions.easingcallback );
        } else {
            
element.queue(function( next ) {
                $( 
this )[ method ]();
                if ( 
callback ) {
                    
callback.callelement] );
                }
                
next();
            });
        }
    };
});

})( 
jQuery );
(function( $, 
undefined ) {

var 
mouseHandled false;
$( 
document ).mouseup( function() {
    
mouseHandled false;
});

$.
widget("ui.mouse", {
    
version"1.10.1",
    
options: {
        
cancel"input,textarea,button,select,option",
        
distance1,
        
delay0
    
},
    
_mouseInit: function() {
        var 
that this;

        
this.element
            
.bind("mousedown."+this.widgetName, function(event) {
                return 
that._mouseDown(event);
            })
            .
bind("click."+this.widgetName, function(event) {
                if (
true === $.data(event.targetthat.widgetName ".preventClickEvent")) {
                    $.
removeData(event.targetthat.widgetName ".preventClickEvent");
                    
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);
        if ( 
this._mouseMoveDelegate ) {
            $(
document)
                .
unbind("mousemove."+this.widgetNamethis._mouseMoveDelegate)
                .
unbind("mouseup."+this.widgetNamethis._mouseUpDelegate);
        }
    },

    
_mouseDown: function(event) {
        
// don't let more than one widget handle mouseStart
        
if( mouseHandled ) { return; }

        
// we may have missed mouseup (out of window)
        
(this._mouseStarted && this._mouseUp(event));

        
this._mouseDownEvent event;

        var 
that this,
            
btnIsLeft = (event.which === 1),
            
// event.target.nodeName works around a bug in IE 8 with
            // disabled inputs (#7620)
            
elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(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() {
                
that.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;
            }
        }

        
// Click event may never have fired (Gecko & Opera)
        
if (true === $.data(event.targetthis.widgetName ".preventClickEvent")) {
            $.
removeData(event.targetthis.widgetName ".preventClickEvent");
        }

        
// these delegates are required to keep context
        
this._mouseMoveDelegate = function(event) {
            return 
that._mouseMove(event);
        };
        
this._mouseUpDelegate = function(event) {
            return 
that._mouseUp(event);
        };
        $(
document)
            .
bind("mousemove."+this.widgetNamethis._mouseMoveDelegate)
            .
bind("mouseup."+this.widgetNamethis._mouseUpDelegate);

        
event.preventDefault();

        
mouseHandled true;
        return 
true;
    },

    
_mouseMove: function(event) {
        
// IE mouseup check - mouseup happened when mouse was out of window
        
if ($.ui.ie && ( !document.documentMode || document.documentMode ) && !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;

            if (
event.target === this._mouseDownEvent.target) {
                $.
data(event.targetthis.widgetName ".preventClickEvent"true);
            }

            
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);
(function( $, 
undefined ) {

$.
ui = $.ui || {};

var 
cachedScrollbarWidth,
    
max Math.max,
    
abs Math.abs,
    
round Math.round,
    
rhorizontal = /left|center|right/,
    
rvertical = /top|center|bottom/,
    
roffset = /[+-]d+(.[d]+)?%?/,
    
rposition = /^w+/,
    
rpercent = /%$/,
    
_position = $.fn.position;

function 
getOffsetsoffsetswidthheight ) {
    return [
        
parseFloatoffsets] ) * ( rpercent.testoffsets] ) ? width 100 ),
        
parseFloatoffsets] ) * ( rpercent.testoffsets] ) ? height 100 )
    ];
}

function 
parseCsselementproperty ) {
    return 
parseInt( $.csselementproperty ), 10 ) || 0;
}

function 
getDimensionselem ) {
    var 
raw elem[0];
    if ( 
raw.nodeType === ) {
        return {
            
widthelem.width(),
            
heightelem.height(),
            
offset: { top0left}
        };
    }
    if ( $.
isWindowraw ) ) {
        return {
            
widthelem.width(),
            
heightelem.height(),
            
offset: { topelem.scrollTop(), leftelem.scrollLeft() }
        };
    }
    if ( 
raw.preventDefault ) {
        return {
            
width0,
            
height0,
            
offset: { topraw.pageYleftraw.pageX }
        };
    }
    return {
        
widthelem.outerWidth(),
        
heightelem.outerHeight(),
        
offsetelem.offset()
    };
}

$.
position = {
    
scrollbarWidth: function() {
        if ( 
cachedScrollbarWidth !== undefined ) {
            return 
cachedScrollbarWidth;
        }
        var 
w1w2,
            
div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
            
innerDiv div.children()[0];

        $( 
"body" ).appenddiv );
        
w1 innerDiv.offsetWidth;
        
div.css"overflow""scroll" );

        
w2 innerDiv.offsetWidth;

        if ( 
w1 === w2 ) {
            
w2 div[0].clientWidth;
        }

        
div.remove();

        return (
cachedScrollbarWidth w1 w2);
    },
    
getScrollInfo: function( within ) {
        var 
overflowX within.isWindow "" within.element.css"overflow-x" ),
            
overflowY within.isWindow "" within.element.css"overflow-y" ),
            
hasOverflowX overflowX === "scroll" ||
                ( 
overflowX === "auto" && within.width within.element[0].scrollWidth ),
            
hasOverflowY overflowY === "scroll" ||
                ( 
overflowY === "auto" && within.height within.element[0].scrollHeight );
        return {
            
widthhasOverflowX ? $.position.scrollbarWidth() : 0,
            
heighthasOverflowY ? $.position.scrollbarWidth() : 0
        
};
    },
    
getWithinInfo: function( element ) {
        var 
withinElement = $( element || window ),
            
isWindow = $.isWindowwithinElement[0] );
        return {
            
elementwithinElement,
            
isWindowisWindow,
            
offsetwithinElement.offset() || { left0top},
            
scrollLeftwithinElement.scrollLeft(),
            
scrollTopwithinElement.scrollTop(),
            
widthisWindow withinElement.width() : withinElement.outerWidth(),
            
heightisWindow withinElement.height() : withinElement.outerHeight()
        };
    }
};

$.fn.
position = function( options ) {
    if ( !
options || !options.of ) {
        return 
_position.applythisarguments );
    }

    
// make a copy, we don't want to modify arguments
    
options = $.extend( {}, options );

    var 
atOffsettargetWidthtargetHeighttargetOffsetbasePositiondimensions,
        
target = $( options.of ),
        
within = $.position.getWithinInfooptions.within ),
        
scrollInfo = $.position.getScrollInfowithin ),
        
collision = ( options.collision || "flip" ).split" " ),
        
offsets = {};

    
dimensions getDimensionstarget );
    if ( 
target[0].preventDefault ) {
        
// force left top to allow flipping
        
options.at "left top";
    }
    
targetWidth dimensions.width;
    
targetHeight dimensions.height;
    
targetOffset dimensions.offset;
    
// clone to reuse original targetOffset later
    
basePosition = $.extend( {}, targetOffset );

    
// force my and at to have valid horizontal and vertical positions
    // if a value is missing or invalid, it will be converted to center
    
$.each( [ "my""at" ], function() {
        var 
pos = ( optionsthis ] || "" ).split" " ),
            
horizontalOffset,
            
verticalOffset;

        if ( 
pos.length === 1) {
            
pos rhorizontal.testpos] ) ?
                
pos.concat( [ "center" ] ) :
                
rvertical.testpos] ) ?
                    [ 
"center" ].concatpos ) :
                    [ 
"center""center" ];
        }
        
pos] = rhorizontal.testpos] ) ? pos] : "center";
        
pos] = rvertical.testpos] ) ? pos] : "center";

        
// calculate offsets
        
horizontalOffset roffset.execpos] );
        
verticalOffset roffset.execpos] );
        
offsetsthis ] = [
            
horizontalOffset horizontalOffset] : 0,
            
verticalOffset verticalOffset] : 0
        
];

        
// reduce to just the positions without the offsets
        
optionsthis ] = [
            
rposition.execpos] )[ ],
            
rposition.execpos] )[ ]
        ];
    });

    
// normalize collision option
    
if ( collision.length === ) {
        
collision] = collision];
    }

    if ( 
options.at] === "right" ) {
        
basePosition.left += targetWidth;
    } else if ( 
options.at] === "center" ) {
        
basePosition.left += targetWidth 2;
    }

    if ( 
options.at] === "bottom" ) {
        
basePosition.top += targetHeight;
    } else if ( 
options.at] === "center" ) {
        
basePosition.top += targetHeight 2;
    }

    
atOffset getOffsetsoffsets.attargetWidthtargetHeight );
    
basePosition.left += atOffset];
    
basePosition.top += atOffset];

    return 
this.each(function() {
        var 
collisionPositionusing,
            
elem = $( this ),
            
elemWidth elem.outerWidth(),
            
elemHeight elem.outerHeight(),
            
marginLeft parseCssthis"marginLeft" ),
            
marginTop parseCssthis"marginTop" ),
            
collisionWidth elemWidth marginLeft parseCssthis"marginRight" ) + scrollInfo.width,
            
collisionHeight elemHeight marginTop parseCssthis"marginBottom" ) + scrollInfo.height,
            
position = $.extend( {}, basePosition ),
            
myOffset getOffsetsoffsets.myelem.outerWidth(), elem.outerHeight() );

        if ( 
options.my] === "right" ) {
            
position.left -= elemWidth;
        } else if ( 
options.my] === "center" ) {
            
position.left -= elemWidth 2;
        }

        if ( 
options.my] === "bottom" ) {
            
position.top -= elemHeight;
        } else if ( 
options.my] === "center" ) {
            
position.top -= elemHeight 2;
        }

        
position.left += myOffset];
        
position.top += myOffset];

        
// if the browser doesn't support fractions, then round for consistent results
        
if ( !$.support.offsetFractions ) {
            
position.left roundposition.left );
            
position.top roundposition.top );
        }

        
collisionPosition = {
            
marginLeftmarginLeft,
            
marginTopmarginTop
        
};

        $.
each( [ "left""top" ], function( idir ) {
            if ( $.
ui.positioncollision] ] ) {
                $.
ui.positioncollision] ][ dir ]( position, {
                    
targetWidthtargetWidth,
                    
targetHeighttargetHeight,
                    
elemWidthelemWidth,
                    
elemHeightelemHeight,
                    
collisionPositioncollisionPosition,
                    
collisionWidthcollisionWidth,
                    
collisionHeightcollisionHeight,
                    
offset: [ atOffset] + myOffset], atOffset ] + myOffset] ],
                    
myoptions.my,
                    
atoptions.at,
                    
withinwithin,
                    
elem elem
                
});
            }
        });

        if ( 
options.using ) {
            
// adds feedback as second argument to using callback, if present
            
using = function( props ) {
                var 
left targetOffset.left position.left,
                    
right left targetWidth elemWidth,
                    
top targetOffset.top position.top,
                    
bottom top targetHeight elemHeight,
                    
feedback = {
                        
target: {
                            
elementtarget,
                            
lefttargetOffset.left,
                            
toptargetOffset.top,
                            
widthtargetWidth,
                            
heighttargetHeight
                        
},
                        
element: {
                            
elementelem,
                            
leftposition.left,
                            
topposition.top,
                            
widthelemWidth,
                            
heightelemHeight
                        
},
                        
horizontalright "left" left "right" "center",
                        
verticalbottom "top" top "bottom" "middle"
                    
};
                if ( 
targetWidth elemWidth && absleft right ) < targetWidth ) {
                    
feedback.horizontal "center";
                }
                if ( 
targetHeight elemHeight && abstop bottom ) < targetHeight ) {
                    
feedback.vertical "middle";
                }
                if ( 
maxabsleft ), absright ) ) > maxabstop ), absbottom ) ) ) {
                    
feedback.important "horizontal";
                } else {
                    
feedback.important "vertical";
                }
                
options.using.callthispropsfeedback );
            };
        }

        
elem.offset( $.extendposition, { usingusing } ) );
    });
};

$.
ui.position = {
    
fit: {
        
left: function( positiondata ) {
            var 
within data.within,
                
withinOffset within.isWindow within.scrollLeft within.offset.left,
                
outerWidth within.width,
                
collisionPosLeft position.left data.collisionPosition.marginLeft,
                
overLeft withinOffset collisionPosLeft,
                
overRight collisionPosLeft data.collisionWidth outerWidth withinOffset,
                
newOverRight;

            
// element is wider than within
            
if ( data.collisionWidth outerWidth ) {
                
// element is initially over the left side of within
                
if ( overLeft && overRight <= ) {
                    
newOverRight position.left overLeft data.collisionWidth outerWidth withinOffset;
                    
position.left += overLeft newOverRight;
                
// element is initially over right side of within
                
} else if ( overRight && overLeft <= ) {
                    
position.left withinOffset;
                
// element is initially over both left and right sides of within
                
} else {
                    if ( 
overLeft overRight ) {
                        
position.left withinOffset outerWidth data.collisionWidth;
                    } else {
                        
position.left withinOffset;
                    }
                }
            
// too far left -> align with left edge
            
} else if ( overLeft ) {
                
position.left += overLeft;
            
// too far right -> align with right edge
            
} else if ( overRight ) {
                
position.left -= overRight;
            
// adjust based on position and margin
            
} else {
                
position.left maxposition.left collisionPosLeftposition.left );
            }
        },
        
top: function( positiondata ) {
            var 
within data.within,
                
withinOffset within.isWindow within.scrollTop within.offset.top,
                
outerHeight data.within.height,
                
collisionPosTop position.top data.collisionPosition.marginTop,
                
overTop withinOffset collisionPosTop,
                
overBottom collisionPosTop data.collisionHeight outerHeight withinOffset,
                
newOverBottom;

            
// element is taller than within
            
if ( data.collisionHeight outerHeight ) {
                
// element is initially over the top of within
                
if ( overTop && overBottom <= ) {
                    
newOverBottom position.top overTop data.collisionHeight outerHeight withinOffset;
                    
position.top += overTop newOverBottom;
                
// element is initially over bottom of within
                
} else if ( overBottom && overTop <= ) {
                    
position.top withinOffset;
                
// element is initially over both top and bottom of within
                
} else {
                    if ( 
overTop overBottom ) {
                        
position.top withinOffset outerHeight data.collisionHeight;
                    } else {
                        
position.top withinOffset;
                    }
                }
            
// too far up -> align with top
            
} else if ( overTop ) {
                
position.top += overTop;
            
// too far down -> align with bottom edge
            
} else if ( overBottom ) {
                
position.top -= overBottom;
            
// adjust based on position and margin
            
} else {
                
position.top maxposition.top collisionPosTopposition.top );
            }
        }
    },
    
flip: {
        
left: function( positiondata ) {
            var 
within data.within,
                
withinOffset within.offset.left within.scrollLeft,
                
outerWidth within.width,
                
offsetLeft within.isWindow within.scrollLeft within.offset.left,
                
collisionPosLeft position.left data.collisionPosition.marginLeft,
                
overLeft collisionPosLeft offsetLeft,
                
overRight collisionPosLeft data.collisionWidth outerWidth offsetLeft,
                
myOffset data.my] === "left" ?
                    -
data.elemWidth :
                    
data.my] === "right" ?
                        
data.elemWidth :
                        
0,
                
atOffset data.at] === "left" ?
                    
data.targetWidth :
                    
data.at] === "right" ?
                        -
data.targetWidth :
                        
0,
                
offset = -data.offset],
                
newOverRight,
                
newOverLeft;

            if ( 
overLeft ) {
                
newOverRight position.left myOffset atOffset offset data.collisionWidth outerWidth withinOffset;
                if ( 
newOverRight || newOverRight absoverLeft ) ) {
                    
position.left += myOffset atOffset offset;
                }
            }
            else if ( 
overRight ) {
                
newOverLeft position.left data.collisionPosition.marginLeft myOffset atOffset offset offsetLeft;
                if ( 
newOverLeft || absnewOverLeft ) < overRight ) {
                    
position.left += myOffset atOffset offset;
                }
            }
        },
        
top: function( positiondata ) {
            var 
within data.within,
                
withinOffset within.offset.top within.scrollTop,
                
outerHeight within.height,
                
offsetTop within.isWindow within.scrollTop within.offset.top,
                
collisionPosTop position.top data.collisionPosition.marginTop,
                
overTop collisionPosTop offsetTop,
                
overBottom collisionPosTop data.collisionHeight outerHeight offsetTop,
                
top data.my] === "top",
                
myOffset top ?
                    -
data.elemHeight :
                    
data.my] === "bottom" ?
                        
data.elemHeight :
                        
0,
                
atOffset data.at] === "top" ?
                    
data.targetHeight :
                    
data.at] === "bottom" ?
                        -
data.targetHeight :
                        
0,
                
offset = -data.offset],
                
newOverTop,
                
newOverBottom;
            if ( 
overTop ) {
                
newOverBottom position.top myOffset atOffset offset data.collisionHeight outerHeight withinOffset;
                if ( ( 
position.top myOffset atOffset offset) > overTop && ( newOverBottom || newOverBottom absoverTop ) ) ) {
                    
position.top += myOffset atOffset offset;
                }
            }
            else if ( 
overBottom ) {
                
newOverTop position.top -  data.collisionPosition.marginTop myOffset atOffset offset offsetTop;
                if ( ( 
position.top myOffset atOffset offset) > overBottom && ( newOverTop || absnewOverTop ) < overBottom ) ) {
                    
position.top += myOffset atOffset offset;
                }
            }
        }
    },
    
flipfit: {
        
left: function() {
            $.
ui.position.flip.left.applythisarguments );
            $.
ui.position.fit.left.applythisarguments );
        },
        
top: function() {
            $.
ui.position.flip.top.applythisarguments );
            $.
ui.position.fit.top.applythisarguments );
        }
    }
};

// fraction support test
(function () {
    var 
testElementtestElementParenttestElementStyleoffsetLefti,
        
body document.getElementsByTagName"body" )[ ],
        
div document.createElement"div" );

    
//Create a "fake body" for testing based on method used in jQuery.support
    
testElement document.createElementbody "div" "body" );
    
testElementStyle = {
        
visibility"hidden",
        
width0,
        
height0,
        
border0,
        
margin0,
        
background"none"
    
};
    if ( 
body ) {
        $.
extendtestElementStyle, {
            
position"absolute",
            
left"-1000px",
            
top"-1000px"
        
});
    }
    for ( 
i in testElementStyle ) {
        
testElement.style] = testElementStyle];
    }
    
testElement.appendChilddiv );
    
testElementParent body || document.documentElement;
    
testElementParent.insertBeforetestElementtestElementParent.firstChild );

    
div.style.cssText "position: absolute; left: 10.7432222px;";

    
offsetLeft = $( div ).offset().left;
    $.
support.offsetFractions offsetLeft 10 && offsetLeft 11;

    
testElement.innerHTML "";
    
testElementParent.removeChildtestElement );
})();

}( 
jQuery ) );
(function( $, 
undefined ) {

$.
widget("ui.draggable", $.ui.mouse, {
    
version"1.10.1",
    
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,

        
// callbacks
        
dragnull,
        
startnull,
        
stopnull
    
},
    
_create: function() {

        if (
this.options.helper === "original" && !(/^(?:r|a|f)/).test(this.element.css("position"))) {
            
this.element[0].style.position "relative";
        }
        if (
this.options.addClasses){
            
this.element.addClass("ui-draggable");
        }
        if (
this.options.disabled){
            
this.element.addClass("ui-draggable-disabled");
        }

        
this._mouseInit();

    },

    
_destroy: function() {
        
this.element.removeClass"ui-draggable ui-draggable-dragging ui-draggable-disabled" );
        
this._mouseDestroy();
    },

    
_mouseCapture: function(event) {

        var 
this.options;

        
// among others, prevent a drag on a resizable-handle
        
if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length 0) {
            return 
false;
        }

        
//Quit if we're not on a valid handle
        
this.handle this._getHandle(event);
        if (!
this.handle) {
            return 
false;
        }

        $(
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");
        });

        return 
true;

    },

    
_mouseStart: function(event) {

        var 
this.options;

        
//Create and append the visible helper
        
this.helper this._createHelper(event);

        
this.helper.addClass("ui-draggable-dragging");

        
//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._mouseDrag(eventtrue); //Execute the drag once - this causes the helper not to be visible before getting its correct position

        //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
        
if ( $.ui.ddmanager ) {
            $.
ui.ddmanager.dragStart(thisevent);
        }

        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 element,
            
that this,
            
elementInDom false,
            
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 no longer in the DOM don't bother to continue (see #8269)
        
element this.element[0];
        while ( 
element && (element element.parentNode) ) {
            if (
element === document ) {
                
elementInDom true;
            }
        }
        if ( !
elementInDom && this.options.helper === "original" ) {
            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))) {
            $(
this.helper).animate(this.originalPositionparseInt(this.options.revertDuration10), function() {
                if(
that._trigger("stop"event) !== false) {
                    
that._clear();
                }
            });
        } else {
            if(
this._trigger("stop"event) !== false) {
                
this._clear();
            }
        }

        return 
false;
    },

    
_mouseUp: function(event) {
        
//Remove frame helpers
        
$("div.ui-draggable-iframeFix").each(function() {
            
this.parentNode.removeChild(this);
        });

        
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
        
if( $.ui.ddmanager ) {
            $.
ui.ddmanager.dragStop(thisevent);
        }

        return $.
ui.mouse.prototype._mouseUp.call(thisevent);
    },

    
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("*")
            .
addBack()
            .
each(function() {
                if(
this === event.target) {
                    
handle true;
                }
            });

        return 
handle;

    },

    
_createHelper: function(event) {

        var 
this.options,
            
helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper === "clone" this.element.clone().removeAttr("id") : 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 && $.contains(this.scrollParent[0], this.offsetParent[0])) {
            
po.left += this.scrollParent.scrollLeft();
            
po.top += this.scrollParent.scrollTop();
        }

        
//This needs to be actually done for all browsers, since pageX/pageY includes this information
        //Ugly IE fix
        
if((this.offsetParent[0] === document.body) ||
            (
this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
            
po = { top0left};
        }

        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 { 
top0left};
        }

    },

    
_cacheMargins: function() {
        
this.margins = {
            
left: (parseInt(this.element.css("marginLeft"),10) || 0),
            
top: (parseInt(this.element.css("marginTop"),10) || 0),
            
right: (parseInt(this.element.css("marginRight"),10) || 0),
            
bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
        };
    },

    
_cacheHelperProportions: function() {
        
this.helperProportions = {
            
widththis.helper.outerWidth(),
            
heightthis.helper.outerHeight()
        };
    },

    
_setContainment: function() {

        var 
overcce,
            
this.options;

        if(
o.containment === "parent") {
            
o.containment this.helper[0].parentNode;
        }
        if(
o.containment === "document" || o.containment === "window") {
            
this.containment = [
                
o.containment === "document" : $(window).scrollLeft() - this.offset.relative.left this.offset.parent.left,
                
o.containment === "document" : $(window).scrollTop() - this.offset.relative.top this.offset.parent.top,
                (
o.containment === "document" : $(window).scrollLeft()) + $(o.containment === "document" document window).width() - this.helperProportions.width this.margins.left,
                (
o.containment === "document" : $(window).scrollTop()) + ($(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) {
            
= $(o.containment);
            
ce c[0];

            if(!
ce) {
                return;
            }

            
over = ($(ce).css("overflow") !== "hidden");

            
this.containment = [
                (
parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
                (
parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
                (
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 this.margins.right,
                (
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  this.margins.bottom
            
];
            
this.relative_container c;

        } else if(
o.containment.constructor === Array) {
            
this.containment o.containment;
        }

    },

    
_convertPositionTo: function(dpos) {

        if(!
pos) {
            
pos this.position;
        }

        var 
mod === "absolute" : -1,
            
scroll this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.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)
                
( ( 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)
                
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode scroll.scrollLeft() ) * mod)
            )
        };

    },

    
_generatePosition: function(event) {

        var 
containmentcotopleft,
            
this.options,
            
scroll this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent this.scrollParent,
            
scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName),
            
pageX event.pageX,
            
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 (
this.relative_container){
                
co this.relative_container.offset();
                
containment = [ this.containment[0] + co.left,
                    
this.containment[1] + co.top,
                    
this.containment[2] + co.left,
                    
this.containment[3] + co.top ];
            }
            else {
                
containment this.containment;
            }

                if(
event.pageX this.offset.click.left containment[0]) {
                    
pageX containment[0] + this.offset.click.left;
                }
                if(
event.pageY this.offset.click.top containment[1]) {
                    
pageY containment[1] + this.offset.click.top;
                }
                if(
event.pageX this.offset.click.left containment[2]) {
                    
pageX containment[2] + this.offset.click.left;
                }
                if(
event.pageY this.offset.click.top containment[3]) {
                    
pageY containment[3] + this.offset.click.top;
                }
            }

            if(
o.grid) {
                
//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
                
top o.grid[1] ? this.originalPageY Math.round((pageY this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
                
pageY containment ? ((top this.offset.click.top >= containment[1] || top this.offset.click.top containment[3]) ? top : ((top this.offset.click.top >= containment[1]) ? top o.grid[1] : top o.grid[1])) : top;

                
left o.grid[0] ? this.originalPageX Math.round((pageX this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
                
pageX containment ? ((left this.offset.click.left >= containment[0] || left this.offset.click.left containment[2]) ? left : ((left this.offset.click.left >= containment[0]) ? left o.grid[0] : left o.grid[0])) : left;
            }

        }

        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)
                
( ( 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)
                
( ( 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.cancelHelperRemoval) {
            
this.helper.remove();
        }
        
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]);
        
//The absolute position has to be recalculated after plugins
        
if(type === "drag") {
            
this.positionAbs this._convertPositionTo("absolute");
        }
        return $.
Widget.prototype._trigger.call(thistypeeventui);
    },

    
plugins: {},

    
_uiHash: function() {
        return {
            
helperthis.helper,
            
positionthis.position,
            
originalPositionthis.originalPosition,
            
offsetthis.positionAbs
        
};
    }

});

$.
ui.plugin.add("draggable""connectToSortable", {
    
start: function(eventui) {

        var 
inst = $(this).data("ui-draggable"), inst.options,
            
uiSortable = $.extend({}, ui, { iteminst.element });
        
inst.sortables = [];
        $(
o.connectToSortable).each(function() {
            var 
sortable = $.data(this"ui-sortable");
            if (
sortable && !sortable.options.disabled) {
                
inst.sortables.push({
                    
instancesortable,
                    
shouldRevertsortable.options.revert
                
});
                
sortable.refreshPositions();    // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
                
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("ui-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.shouldRevert) {
                    
this.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("ui-draggable"), that this;

        $.
each(inst.sortables, function() {

            var 
innermostIntersecting false,
                
thisSortable this;

            
//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)) {
                
innermostIntersecting true;
                $.
each(inst.sortables, function () {
                    
this.instance.positionAbs inst.positionAbs;
                    
this.instance.helperProportions inst.helperProportions;
                    
this.instance.offset.click inst.offset.click;
                    if (
this !== thisSortable &&
                        
this.instance._intersectsWith(this.instance.containerCache) &&
                        $.
contains(thisSortable.instance.element[0], this.instance.element[0])
                    ) {
                        
innermostIntersecting false;
                    }
                    return 
innermostIntersecting;
                });
            }


            if(
innermostIntersecting) {
                
//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 = $(that).clone().removeAttr("id").appendTo(this.instance.element).data("ui-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.currentItem) {
                    
this.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.placeholder) {
                        
this.instance.placeholder.remove();
                    }

                    
inst._trigger("fromSortable"event);
                    
inst.dropped false//draggable revert needs that
                
}

            }

        });

    }
});

$.
ui.plugin.add("draggable""cursor", {
    
start: function() {
        var 
= $("body"), = $(this).data("ui-draggable").options;
        if (
t.css("cursor")) {
            
o._cursor t.css("cursor");
        }
        
t.css("cursor"o.cursor);
    },
    
stop: function() {
        var 
= $(this).data("ui-draggable").options;
        if (
o._cursor) {
            $(
"body").css("cursor"o._cursor);
        }
    }
});

$.
ui.plugin.add("draggable""opacity", {
    
start: function(eventui) {
        var 
= $(ui.helper), = $(this).data("ui-draggable").options;
        if(
t.css("opacity")) {
            
o._opacity t.css("opacity");
        }
        
t.css("opacity"o.opacity);
    },
    
stop: function(eventui) {
        var 
= $(this).data("ui-draggable").options;
        if(
o._opacity) {
            $(
ui.helper).css("opacity"o._opacity);
        }
    }
});

$.
ui.plugin.add("draggable""scroll", {
    
start: function() {
        var 
= $(this).data("ui-draggable");
        if(
i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") {
            
i.overflowOffset i.scrollParent.offset();
        }
    },
    
drag: function( event ) {

        var 
= $(this).data("ui-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() {

        var 
= $(this).data("ui-draggable"),
            
i.options;

        
i.snapElements = [];

        $(
o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
            var 
$t = $(this),
                
$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 
tsbslsrslrtbifirst,
            
inst = $(this).data("ui-draggable"),
            
inst.options,
            
o.snapTolerance,
            
x1 ui.offset.leftx2 x1 inst.helperProportions.width,
            
y1 ui.offset.topy2 y1 inst.helperProportions.height;

        for (
inst.snapElements.length 1>= 0i--){

            
inst.snapElements[i].left;
            
inst.snapElements[i].width;
            
inst.snapElements[i].top;
            
inst.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") {
                
ts Math.abs(y2) <= d;
                
bs Math.abs(y1) <= d;
                
ls Math.abs(x2) <= d;
                
rs Math.abs(x1) <= d;
                if(
ts) {
                    
ui.position.top inst._convertPositionTo("relative", { topinst.helperProportions.heightleft}).top inst.margins.top;
                }
                if(
bs) {
                    
ui.position.top inst._convertPositionTo("relative", { topbleft}).top inst.margins.top;
                }
                if(
ls) {
                    
ui.position.left inst._convertPositionTo("relative", { top0leftinst.helperProportions.width }).left inst.margins.left;
                }
                if(
rs) {
                    
ui.position.left inst._convertPositionTo("relative", { top0left}).left inst.margins.left;
                }
            }

            
first = (ts || bs || ls || rs);

            if(
o.snapMode !== "outer") {
                
ts Math.abs(y1) <= d;
                
bs Math.abs(y2) <= d;
                
ls Math.abs(x1) <= d;
                
rs Math.abs(x2) <= d;
                if(
ts) {
                    
ui.position.top inst._convertPositionTo("relative", { toptleft}).top inst.margins.top;
                }
                if(
bs) {
                    
ui.position.top inst._convertPositionTo("relative", { topinst.helperProportions.heightleft}).top inst.margins.top;
                }
                if(
ls) {
                    
ui.position.left inst._convertPositionTo("relative", { top0left}).left inst.margins.left;
                }
                if(
rs) {
                    
ui.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() {
        var 
min,
            
this.data("ui-draggable").options,
            
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; }

        
min parseInt($(group[0]).css("zIndex"), 10) || 0;
        $(
group).each(function(i) {
            $(
this).css("zIndex"min i);
        });
        
this.css("zIndex", (min group.length));
    }
});

$.
ui.plugin.add("draggable""zIndex", {
    
start: function(eventui) {
        var 
= $(ui.helper), = $(this).data("ui-draggable").options;
        if(
t.css("zIndex")) {
            
o._zIndex t.css("zIndex");
        }
        
t.css("zIndex"o.zIndex);
    },
    
stop: function(eventui) {
        var 
= $(this).data("ui-draggable").options;
        if(
o._zIndex) {
            $(
ui.helper).css("zIndex"o._zIndex);
        }
    }
});

})(
jQuery);
(function( $, 
undefined ) {

function 
isOverAxisxreferencesize ) {
    return ( 
reference ) && ( < ( reference size ) );
}

$.
widget("ui.droppable", {
    
version"1.10.1",
    
widgetEventPrefix"drop",
    
options: {
        
accept"*",
        
activeClassfalse,
        
addClassestrue,
        
greedyfalse,
        
hoverClassfalse,
        
scope"default",
        
tolerance"intersect",

        
// callbacks
        
activatenull,
        
deactivatenull,
        
dropnull,
        
outnull,
        
overnull
    
},
    
_create: function() {

        var 
this.options,
            
accept o.accept;

        
this.isover false;
        
this.isout true;

        
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 
0,
            
drop = $.ui.ddmanager.droppables[this.options.scope];

        for ( ; 
drop.lengthi++ ) {
            if ( 
drop[i] === this ) {
                
drop.splice(i1);
            }
        }

        
this.element.removeClass("ui-droppable ui-droppable-disabled");
    },

    
_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.activeClass) {
            
this.element.addClass(this.options.activeClass);
        }
        if(
draggable){
            
this._trigger("activate"eventthis.ui(draggable));
        }
    },

    
_deactivate: function(event) {
        var 
draggable = $.ui.ddmanager.current;
        if(
this.options.activeClass) {
            
this.element.removeClass(this.options.activeClass);
        }
        if(
draggable){
            
this._trigger("deactivate"eventthis.ui(draggable));
        }
    },

    
_over: function(event) {

        var 
draggable = $.ui.ddmanager.current;

        
// Bail if draggable and droppable are same element
        
if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
            return;
        }

        if (
this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
            if(
this.options.hoverClass) {
                
this.element.addClass(this.options.hoverClass);
            }
            
this._trigger("over"eventthis.ui(draggable));
        }

    },

    
_out: function(event) {

        var 
draggable = $.ui.ddmanager.current;

        
// Bail if draggable and droppable are same element
        
if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
            return;
        }

        if (
this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
            if(
this.options.hoverClass) {
                
this.element.removeClass(this.options.hoverClass);
            }
            
this._trigger("out"eventthis.ui(draggable));
        }

    },

    
_drop: function(event,custom) {

        var 
draggable custom || $.ui.ddmanager.current,
            
childrenIntersection false;

        
// Bail if draggable and droppable are same element
        
if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
            return 
false;
        }

        
this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() {
            var 
inst = $.data(this"ui-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.activeClass) {
                
this.element.removeClass(this.options.activeClass);
            }
            if(
this.options.hoverClass) {
                
this.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
        
};
    }

});

$.
ui.intersect = function(draggabledroppabletoleranceMode) {

    if (!
droppable.offset) {
        return 
false;
    }

    var 
draggableLeftdraggableTop,
        
x1 = (draggable.positionAbs || draggable.position.absolute).leftx2 x1 draggable.helperProportions.width,
        
y1 = (draggable.positionAbs || draggable.position.absolute).topy2 y1 draggable.helperProportions.height,
        
droppable.offset.leftdroppable.proportions.width,
        
droppable.offset.topdroppable.proportions.height;

    switch (
toleranceMode) {
        case 
"fit":
            return (
<= x1 && x2 <= && <= y1 && y2 <= b);
        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
        
case "pointer":
            
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);
            return 
isOverAxisdraggableToptdroppable.proportions.height ) && isOverAxisdraggableLeftldroppable.proportions.width );
        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
            
);
        default:
            return 
false;
        }

};

/*
    This manager tracks offsets of draggables and droppables
*/
$.ui.ddmanager = {
    
currentnull,
    
droppables: { "default": [] },
    
prepareOffsets: function(tevent) {

        var 
ij,
            
= $.ui.ddmanager.droppables[t.options.scope] || [],
            
type event event.type null// workaround for #2317
            
list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack();

        
droppablesLoop: for (0m.lengthi++) {

            
//No disabled and non-accepted
            
if(m[i].options.disabled || (&& !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) {
                continue;
            }

            
// Filter out elements in the current dragged item
            
for (j=0< list.lengthj++) {
                if(list[
j] === m[i].element[0]) {
                    
m[i].proportions.height 0;
                    continue 
droppablesLoop;
                }
            }

            
m[i].visible m[i].element.css("display") !== "none";
            if(!
m[i].visible) {
                continue;
            }

            
//Activate the droppable if used directly from draggables
            
if(type === "mousedown") {
                
m[i]._activate.call(m[i], event);
            }

            
m[i].offset m[i].element.offset();
            
m[i].proportions = { widthm[i].element[0].offsetWidthheightm[i].element[0].offsetHeight };

        }

    },
    
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 this._drop.call(thisevent) || dropped;
            }

            if (!
this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
                
this.isout true;
                
this.isover false;
                
this._deactivate.call(thisevent);
            }

        });
        return 
dropped;

    },
    
dragStart: function( draggableevent ) {
        
//Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
        
draggable.element.parentsUntil"body" ).bind"scroll.droppable", function() {
            if( !
draggable.options.refreshPositions ) {
                $.
ui.ddmanager.prepareOffsetsdraggableevent );
            }
        });
    },
    
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 
parentInstancescopeparent,
                
intersects = $.ui.intersect(draggablethisthis.options.tolerance),
                
= !intersects && this.isover "isout" : (intersects && !this.isover "isover" null);
            if(!
c) {
                return;
            }

            if (
this.options.greedy) {
                
// find droppable parents with same scope
                
scope this.options.scope;
                
parent this.element.parents(":data(ui-droppable)").filter(function () {
                    return $.
data(this"ui-droppable").options.scope === scope;
                });

                if (
parent.length) {
                    
parentInstance = $.data(parent[0], "ui-droppable");
                    
parentInstance.greedyChild = (=== "isover");
                }
            }

            
// we just moved into a greedy child
            
if (parentInstance && === "isover") {
                
parentInstance.isover false;
                
parentInstance.isout true;
                
parentInstance._out.call(parentInstanceevent);
            }

            
this[c] = true;
            
this[=== "isout" "isover" "isout"] = false;
            
this[=== "isover" "_over" "_out"].call(thisevent);

            
// we just moved out of a greedy child
            
if (parentInstance && === "isout") {
                
parentInstance.isout false;
                
parentInstance.isover true;
                
parentInstance._over.call(parentInstanceevent);
            }
        });

    },
    
dragStop: function( draggableevent ) {
        
draggable.element.parentsUntil"body" ).unbind"scroll.droppable" );
        
//Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
        
if( !draggable.options.refreshPositions ) {
            $.
ui.ddmanager.prepareOffsetsdraggableevent );
        }
    }
};

})(
jQuery);
(function( $, 
undefined ) {

function 
num(v) {
    return 
parseInt(v10) || 0;
}

function 
isNumber(value) {
    return !
isNaN(parseInt(value10));
}

$.
widget("ui.resizable", $.ui.mouse, {
    
version"1.10.1",
    
widgetEventPrefix"resize",
    
options: {
        
alsoResizefalse,
        
animatefalse,
        
animateDuration"slow",
        
animateEasing"swing",
        
aspectRatiofalse,
        
autoHidefalse,
        
containmentfalse,
        
ghostfalse,
        
gridfalse,
        
handles"e,s,se",
        
helperfalse,
        
maxHeightnull,
        
maxWidthnull,
        
minHeight10,
        
minWidth10,
        
// See #7960
        
zIndex90,

        
// callbacks
        
resizenull,
        
startnull,
        
stopnull
    
},
    
_create: function() {

        var 
nihandleaxishname,
            
that this,
            
this.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)) {

            
//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(
                
"ui-resizable"this.element.data("ui-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";
            }

            
this.handles.split(",");
            
this.handles = {};

            for(
0n.lengthi++) {

                
handle = $.trim(n[i]);
                
hname "ui-resizable-"+handle;
                
axis = $("<div class='ui-resizable-handle " hname "'></div>");

                
// Apply zIndex to all handles - see #7960
                
axis.css({ zIndexo.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) {

            var 
iaxispadPospadWrapper;

            
target target || this.element;

            for(
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)) {

                    
axis = $(this.handles[i], this.element);

                    
//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...
                    
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 (!
that.resizing) {
                if (
this.className) {
                    
axis this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
                }
                
//Axis, default = se
                
that.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")
                .
mouseenter(function() {
                    if (
o.disabled) {
                        return;
                    }
                    $(
this).removeClass("ui-resizable-autohide");
                    
that._handles.show();
                })
                .
mouseleave(function(){
                    if (
o.disabled) {
                        return;
                    }
                    if (!
that.resizing) {
                        $(
this).addClass("ui-resizable-autohide");
                        
that._handles.hide();
                    }
                });
        }

        
//Initialize the mouse interaction
        
this._mouseInit();

    },

    
_destroy: function() {

        
this._mouseDestroy();

        var 
wrapper,
            
_destroy = function(exp) {
                $(
exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
                    .
removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove();
            };

        
//TODO: Unwrap at same DOM position
        
if (this.elementIsWrapper) {
            
_destroy(this.element);
            
wrapper this.element;
            
this.originalElement.css({
                
positionwrapper.css("position"),
                
widthwrapper.outerWidth(),
                
heightwrapper.outerHeight(),
                
topwrapper.css("top"),
                
leftwrapper.css("left")
            }).
insertAfterwrapper );
            
wrapper.remove();
        }

        
this.originalElement.css("resize"this.originalResizeStyle);
        
_destroy(this.originalElement);

        return 
this;
    },

    
_mouseCapture: function(event) {
        var 
ihandle,
            
capture false;

        for (
i in this.handles) {
            
handle = $(this.handles[i])[0];
            if (
handle === event.target || $.contains(handleevent.target)) {
                
capture true;
            }
        }

        return !
this.options.disabled && capture;
    },

    
_mouseStart: function(event) {

        var 
curleftcurtopcursor,
            
this.options,
            
iniPos this.element.position(),
            
el this.element;

        
this.resizing true;

        
// bugfix for http://dev.jquery.com/ticket/1749
        
if ( (/absolute/).testel.css("position") ) ) {
            
el.css({ position"absolute"topel.css("top"), leftel.css("left") });
        } else if (
el.is(".ui-draggable")) {
            
el.css({ position"absolute"topiniPos.topleftiniPos.left });
        }

        
this._renderProxy();

        
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);

        
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 data,
            
el this.helperprops = {},
            
smp this.originalMousePosition,
            
this.axis,
            
prevTop this.position.top,
            
prevLeft this.position.left,
            
prevWidth this.size.width,
            
prevHeight this.size.height,
            
dx = (event.pageX-smp.left)||0,
            
dy = (event.pageY-smp.top)||0,
            
trigger this._change[a];

        if (!
trigger) {
            return 
false;
        }

        
// Calculate the attrs that will be change
        
data trigger.apply(this, [eventdxdy]);

        
// Put this in the mouseDrag handler since the user can start pressing shift while resizing
        
this._updateVirtualBoundaries(event.shiftKey);
        if (
this._aspectRatio || event.shiftKey) {
            
data this._updateRatio(dataevent);
        }

        
data this._respectSize(dataevent);

        
this._updateCache(data);

        
// plugins callbacks need to be called first
        
this._propagate("resize"event);

        if (
this.position.top !== prevTop) {
            
props.top this.position.top "px";
        }
        if (
this.position.left !== prevLeft) {
            
props.left this.position.left "px";
        }
        if (
this.size.width !== prevWidth) {
            
props.width this.size.width "px";
        }
        if (
this.size.height !== prevHeight) {
            
props.height this.size.height "px";
        }
        
el.css(props);

        if (!
this._helper && this._proportionallyResizeElements.length) {
            
this._proportionallyResize();
        }

        
// Call the user callback if the element was resized
        
if ( ! $.isEmptyObject(props) ) {
            
this._trigger("resize"eventthis.ui());
        }

        return 
false;
    },

    
_mouseStop: function(event) {

        
this.resizing false;
        var 
pristasoffsethsoffsetwslefttop,
            
this.optionsthat this;

        if(
this._helper) {

            
pr this._proportionallyResizeElements;
            
ista pr.length && (/textarea/i).test(pr[0].nodeName);
            
soffseth ista && $.ui.hasScroll(pr[0], "left"/* TODO - jump height */ that.sizeDiff.height;
            
soffsetw ista that.sizeDiff.width;

            
= { width: (that.helper.width()  - soffsetw), height: (that.helper.height() - soffseth) };
            
left = (parseInt(that.element.css("left"), 10) + (that.position.left that.originalPosition.left)) || null;
            
top = (parseInt(that.element.css("top"), 10) + (that.position.top that.originalPosition.top)) || null;

            if (!
o.animate) {
                
this.element.css($.extend(s, { toptopleftleft }));
            }

            
that.helper.height(that.size.height);
            
that.helper.width(that.size.width);

            if (
this._helper && !o.animate) {
                
this._proportionallyResize();
            }
        }

        $(
"body").css("cursor""auto");

        
this.element.removeClass("ui-resizable-resizing");

        
this._propagate("stop"event);

        if (
this._helper) {
            
this.helper.remove();
        }

        return 
false;

    },

    
_updateVirtualBoundaries: function(forceAspectRatio) {
        var 
pMinWidthpMaxWidthpMinHeightpMaxHeightb,
            
this.options;

        
= {
            
minWidthisNumber(o.minWidth) ? o.minWidth 0,
            
maxWidthisNumber(o.maxWidth) ? o.maxWidth Infinity,
            
minHeightisNumber(o.minHeight) ? o.minHeight 0,
            
maxHeightisNumber(o.maxHeight) ? o.maxHeight Infinity
        
};

        if(
this._aspectRatio || forceAspectRatio) {
            
// We want to create an enclosing box whose aspect ration is the requested one
            // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
            
pMinWidth b.minHeight this.aspectRatio;
            
pMinHeight b.minWidth this.aspectRatio;
            
pMaxWidth b.maxHeight this.aspectRatio;
            
pMaxHeight b.maxWidth this.aspectRatio;

            if(
pMinWidth b.minWidth) {
                
b.minWidth pMinWidth;
            }
            if(
pMinHeight b.minHeight) {
                
b.minHeight pMinHeight;
            }
            if(
pMaxWidth b.maxWidth) {
                
b.maxWidth pMaxWidth;
            }
            if(
pMaxHeight b.maxHeight) {
                
b.maxHeight pMaxHeight;
            }
        }
        
this._vBoundaries b;
    },

    
_updateCache: function(data) {
        
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( data ) {

        var 
cpos this.position,
            
csize this.size,
            
this.axis;

        if (
isNumber(data.height)) {
            
data.width = (data.height this.aspectRatio);
        } else if (
isNumber(data.width)) {
            
data.height = (data.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( data ) {

        var 
this._vBoundaries,
            
this.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),
            
dw this.originalPosition.left this.originalSize.width,
            
dh this.position.top this.size.height,
            
cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
        if (
isminw) {
            
data.width o.minWidth;
        }
        if (
isminh) {
            
data.height o.minHeight;
        }
        if (
ismaxw) {
            
data.width o.maxWidth;
        }
        if (
ismaxh) {
            
data.height o.maxHeight;
        }

        if (
isminw && cw) {
            
data.left dw o.minWidth;
        }
        if (
ismaxw && cw) {
            
data.left dw o.maxWidth;
        }
        if (
isminh && ch) {
            
data.top dh o.minHeight;
        }
        if (
ismaxh && ch) {
            
data.top dh o.maxHeight;
        }

        
// fixing jump error on top/left - bug #2330
        
if (!data.width && !data.height && !data.left && data.top) {
            
data.top null;
        } else if (!
data.width && !data.height && !data.top && data.left) {
            
data.left null;
        }

        return 
data;
    },

    
_proportionallyResize: function() {

        if (!
this._proportionallyResizeElements.length) {
            return;
        }

        var 
ijborderspaddingsprel,
            
element this.helper || this.element;

        for ( 
i=0this._proportionallyResizeElements.lengthi++) {

            
prel this._proportionallyResizeElements[i];

            if (!
this.borderDif) {
                
this.borderDif = [];
                
borders = [prel.css("borderTopWidth"), prel.css("borderRightWidth"), prel.css("borderBottomWidth"), prel.css("borderLeftWidth")];
                
paddings = [prel.css("paddingTop"), prel.css("paddingRight"), prel.css("paddingBottom"), prel.css("paddingLeft")];

                for ( 
0borders.lengthj++ ) {
                    
this.borderDif] = ( parseIntborders], 10 ) || ) + ( parseIntpaddings], 10 ) || );
                }
            }

            
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>");

            
this.helper.addClass(this._helper).css({
                
widththis.element.outerWidth() - 1,
                
heightthis.element.outerHeight() - 1,
                
position"absolute",
                
leftthis.elementOffset.left +"px",
                
topthis.elementOffset.top +"px",
                
zIndex: ++o.zIndex //TODO: Don't modify option
            
});

            
this.helper
                
.appendTo("body")
                .
disableSelection();

        } else {
            
this.helper this.element;
        }

    },

    
_change: {
        
e: function(eventdx) {
            return { 
widththis.originalSize.width dx };
        },
        
w: function(eventdx) {
            var 
cs this.originalSizesp this.originalPosition;
            return { 
leftsp.left dxwidthcs.width dx };
        },
        
n: function(eventdxdy) {
            var 
cs 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
        
};
    }

});

/*
 * Resizable Extensions
 */

$.ui.plugin.add("resizable""animate", {

    
stop: function( event ) {
        var 
that = $(this).data("ui-resizable"),
            
that.options,
            
pr that._proportionallyResizeElements,
            
ista pr.length && (/textarea/i).test(pr[0].nodeName),
            
soffseth ista && $.ui.hasScroll(pr[0], "left"/* TODO - jump height */ that.sizeDiff.height,
            
soffsetw ista that.sizeDiff.width,
            
style = { width: (that.size.width soffsetw), height: (that.size.height soffseth) },
            
left = (parseInt(that.element.css("left"), 10) + (that.position.left that.originalPosition.left)) || null,
            
top = (parseInt(that.element.css("top"), 10) + (that.position.top that.originalPosition.top)) || null;

        
that.element.animate(
            $.
extend(styletop && left ? { toptopleftleft } : {}), {
                
durationo.animateDuration,
                
easingo.animateEasing,
                
step: function() {

                    var 
data = {
                        
widthparseInt(that.element.css("width"), 10),
                        
heightparseInt(that.element.css("height"), 10),
                        
topparseInt(that.element.css("top"), 10),
                        
leftparseInt(that.element.css("left"), 10)
                    };

                    if (
pr && pr.length) {
                        $(
pr[0]).css({ widthdata.widthheightdata.height });
                    }

                    
// propagating resize, and updating values for each animation step
                    
that._updateCache(data);
                    
that._propagate("resize"event);

                }
            }
        );
    }

});

$.
ui.plugin.add("resizable""containment", {

    
start: function() {
        var 
elementpcochcwwidthheight,
            
that = $(this).data("ui-resizable"),
            
that.options,
            
el that.element,
            
oc o.containment,
            
ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;

        if (!
ce) {
            return;
        }

        
that.containerElement = $(ce);

        if (/
document/.test(oc) || oc === document) {
            
that.containerOffset = { left0top};
            
that.containerPosition = { left0top};

            
that.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 {
            
element = $(ce);
            
= [];
            $([ 
"Top""Right""Left""Bottom" ]).each(function(iname) { p[i] = num(element.css("padding" name)); });

            
that.containerOffset element.offset();
            
that.containerPosition element.position();
            
that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };

            
co that.containerOffset;
            
ch that.containerSize.height;
            
cw that.containerSize.width;
            
width = ($.ui.hasScroll(ce"left") ? ce.scrollWidth cw );
            
height = ($.ui.hasScroll(ce) ? ce.scrollHeight ch);

            
that.parentData = {
                
elementceleftco.lefttopco.topwidthwidthheightheight
            
};
        }
    },

    
resize: function( event ) {
        var 
wosethosetisParentisOffsetRelative,
            
that = $(this).data("ui-resizable"),
            
that.options,
            
co that.containerOffsetcp that.position,
            
pRatio that._aspectRatio || event.shiftKey,
            
cop = { top:0left:}, ce that.containerElement;

        if (
ce[0] !== document && (/static/).test(ce.css("position"))) {
            
cop co;
        }

        if (
cp.left < (that._helper co.left 0)) {
            
that.size.width that.size.width + (that._helper ? (that.position.left co.left) : (that.position.left cop.left));
            if (
pRatio) {
                
that.size.height that.size.width that.aspectRatio;
            }
            
that.position.left o.helper co.left 0;
        }

        if (
cp.top < (that._helper co.top 0)) {
            
that.size.height that.size.height + (that._helper ? (that.position.top co.top) : that.position.top);
            if (
pRatio) {
                
that.size.width that.size.height that.aspectRatio;
            }
            
that.position.top that._helper co.top 0;
        }

        
that.offset.left that.parentData.left+that.position.left;
        
that.offset.top that.parentData.top+that.position.top;

        
woset Math.abs( (that._helper that.offset.left cop.left : (that.offset.left cop.left)) + that.sizeDiff.width );
        
hoset Math.abs( (that._helper that.offset.top cop.top : (that.offset.top co.top)) + that.sizeDiff.height );

        
isParent that.containerElement.get(0) === that.element.parent().get(0);
        
isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position"));

        if(
isParent && isOffsetRelative) {
            
woset -= that.parentData.left;
        }

        if (
woset that.size.width >= that.parentData.width) {
            
that.size.width that.parentData.width woset;
            if (
pRatio) {
                
that.size.height that.size.width that.aspectRatio;
            }
        }

        if (
hoset that.size.height >= that.parentData.height) {
            
that.size.height that.parentData.height hoset;
            if (
pRatio) {
                
that.size.width that.size.height that.aspectRatio;
            }
        }
    },

    
stop: function(){
        var 
that = $(this).data("ui-resizable"),
            
that.options,
            
co that.containerOffset,
            
cop that.containerPosition,
            
ce that.containerElement,
            
helper = $(that.helper),
            
ho helper.offset(),
            
helper.outerWidth() - that.sizeDiff.width,
            
helper.outerHeight() - that.sizeDiff.height;

        if (
that._helper && !o.animate && (/relative/).test(ce.css("position"))) {
            $(
this).css({ leftho.left cop.left co.leftwidthwheight});
        }

        if (
that._helper && !o.animate && (/static/).test(ce.css("position"))) {
            $(
this).css({ leftho.left cop.left co.leftwidthwheight});
        }

    }
});

$.
ui.plugin.add("resizable""alsoResize", {

    
start: function () {
        var 
that = $(this).data("ui-resizable"),
            
that.options,
            
_store = function (exp) {
                $(
exp).each(function() {
                    var 
el = $(this);
                    
el.data("ui-resizable-alsoresize", {
                        
widthparseInt(el.width(), 10), heightparseInt(el.height(), 10),
                        
leftparseInt(el.css("left"), 10), topparseInt(el.css("top"), 10)
                    });
                });
            };

        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 
that = $(this).data("ui-resizable"),
            
that.options,
            
os that.originalSize,
            
op that.originalPosition,
            
delta = {
                
height: (that.size.height os.height) || 0width: (that.size.width os.width) || 0,
                
top: (that.position.top op.top) || 0left: (that.position.left op.left) || 0
            
},

            
_alsoResize = function (expc) {
                $(
exp).each(function() {
                    var 
el = $(this), start = $(this).data("ui-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;
                        }
                    });

                    
el.css(style);
                });
            };

        if (
typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) {
            $.
each(o.alsoResize, function (expc) { _alsoResize(expc); });
        }else{
            
_alsoResize(o.alsoResize);
        }
    },

    
stop: function () {
        $(
this).removeData("resizable-alsoresize");
    }
});

$.
ui.plugin.add("resizable""ghost", {

    
start: function() {

        var 
that = $(this).data("ui-resizable"), that.optionscs that.size;

        
that.ghost that.originalElement.clone();
        
that.ghost
            
.css({ opacity0.25display"block"position"relative"heightcs.heightwidthcs.widthmargin0left0top})
            .
addClass("ui-resizable-ghost")
            .
addClass(typeof o.ghost === "string" o.ghost "");

        
that.ghost.appendTo(that.helper);

    },

    
resize: function(){
        var 
that = $(this).data("ui-resizable");
        if (
that.ghost) {
            
that.ghost.css({ position"relative"heightthat.size.heightwidththat.size.width });
        }
    },

    
stop: function() {
        var 
that = $(this).data("ui-resizable");
        if (
that.ghost && that.helper) {
            
that.helper.get(0).removeChild(that.ghost.get(0));
        }
    }

});

$.
ui.plugin.add("resizable""grid", {

    
resize: function() {
        var 
that = $(this).data("ui-resizable"),
            
that.options,
            
cs that.size,
            
os that.originalSize,
            
op that.originalPosition,
            
that.axis,
            
grid typeof o.grid === "number" ? [o.grido.grid] : o.grid,
            
gridX = (grid[0]||1),
            
gridY = (grid[1]||1),
            
ox Math.round((cs.width os.width) / gridX) * gridX,
            
oy Math.round((cs.height os.height) / gridY) * gridY,
            
newWidth os.width ox,
            
newHeight os.height oy,
            
isMaxWidth o.maxWidth && (o.maxWidth newWidth),
            
isMaxHeight o.maxHeight && (o.maxHeight newHeight),
            
isMinWidth o.minWidth && (o.minWidth newWidth),
            
isMinHeight o.minHeight && (o.minHeight newHeight);

        
o.grid grid;

        if (
isMinWidth) {
            
newWidth newWidth gridX;
        }
        if (
isMinHeight) {
            
newHeight newHeight gridY;
        }
        if (
isMaxWidth) {
            
newWidth newWidth gridX;
        }
        if (
isMaxHeight) {
            
newHeight newHeight gridY;
        }

        if (/^(
se|s|e)$/.test(a)) {
            
that.size.width newWidth;
            
that.size.height newHeight;
        } else if (/^(
ne)$/.test(a)) {
            
that.size.width newWidth;
            
that.size.height newHeight;
            
that.position.top op.top oy;
        } else if (/^(
sw)$/.test(a)) {
            
that.size.width newWidth;
            
that.size.height newHeight;
            
that.position.left op.left ox;
        } else {
            
that.size.width newWidth;
            
that.size.height newHeight;
            
that.position.top op.top oy;
            
that.position.left op.left ox;
        }
    }

});

})(
jQuery);
(function( $, 
undefined ) {

$.
widget("ui.selectable", $.ui.mouse, {
    
version"1.10.1",
    
options: {
        
appendTo"body",
        
autoRefreshtrue,
        
distance0,
        
filter"*",
        
tolerance"touch",

        
// callbacks
        
selectednull,
        
selectingnull,
        
startnull,
        
stopnull,
        
unselectednull,
        
unselectingnull
    
},
    
_create: function() {
        var 
selectees,
            
that this;

        
this.element.addClass("ui-selectable");

        
this.dragged false;

        
// cache selectee children based on filter
        
this.refresh = function() {
            
selectees = $(that.options.filterthat.element[0]);
            
selectees.addClass("ui-selectee");
            
selectees.each(function() {
                var 
$this = $(this),
                    
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");
        
this._mouseDestroy();
    },

    
_mouseStart: function(event) {
        var 
that this,
            
options this.options;

        
this.opos = [event.pageXevent.pageY];

        if (
this.options.disabled) {
            return;
        }

        
this.selectees = $(options.filterthis.element[0]);

        
this._trigger("start"event);

        $(
options.appendTo).append(this.helper);
        
// position helper (lasso)
        
this.helper.css({
            
"left"event.pageX,
            
"top"event.pageY,
            
"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 && !event.ctrlKey) {
                
selectee.$element.removeClass("ui-selected");
                
selectee.selected false;
                
selectee.$element.addClass("ui-unselecting");
                
selectee.unselecting true;
                
// selectable UNSELECTING callback
                
that._trigger("unselecting"event, {
                    
unselectingselectee.element
                
});
            }
        });

        $(
event.target).parents().addBack().each(function() {
            var 
doSelect,
                
selectee = $.data(this"selectable-item");
            if (
selectee) {
                
doSelect = (!event.metaKey && !event.ctrlKey) || !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) {
                    
that._trigger("selecting"event, {
                        
selectingselectee.element
                    
});
                } else {
                    
that._trigger("unselecting"event, {
                        
unselectingselectee.element
                    
});
                }
                return 
false;
            }
        });

    },

    
_mouseDrag: function(event) {

        
this.dragged true;

        if (
this.options.disabled) {
            return;
        }

        var 
tmp,
            
that this,
            
options this.options,
            
x1 this.opos[0],
            
y1 this.opos[1],
            
x2 event.pageX,
            
y2 event.pageY;

        if (
x1 x2) { tmp x2x2 x1x1 tmp; }
        if (
y1 y2) { tmp y2y2 y1y1 tmp; }
        
this.helper.css({leftx1topy1widthx2-x1heighty2-y1});

        
this.selectees.each(function() {
            var 
selectee = $.data(this"selectable-item"),
                
hit false;

            
//prevent helper from being selected if appendTo: selectable
            
if (!selectee || selectee.element === that.element[0]) {
                return;
            }

            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
                    
that._trigger("selecting"event, {
                        
selectingselectee.element
                    
});
                }
            } else {
                
// UNSELECT
                
if (selectee.selecting) {
                    if ((
event.metaKey || event.ctrlKey) && 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
                        
that._trigger("unselecting"event, {
                            
unselectingselectee.element
                        
});
                    }
                }
                if (
selectee.selected) {
                    if (!
event.metaKey && !event.ctrlKey && !selectee.startselected) {
                        
selectee.$element.removeClass("ui-selected");
                        
selectee.selected false;

                        
selectee.$element.addClass("ui-unselecting");
                        
selectee.unselecting true;
                        
// selectable UNSELECTING callback
                        
that._trigger("unselecting"event, {
                            
unselectingselectee.element
                        
});
                    }
                }
            }
        });

        return 
false;
    },

    
_mouseStop: function(event) {
        var 
that this;

        
this.dragged false;

        $(
".ui-unselecting"this.element[0]).each(function() {
            var 
selectee = $.data(this"selectable-item");
            
selectee.$element.removeClass("ui-unselecting");
            
selectee.unselecting false;
            
selectee.startselected false;
            
that._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;
            
that._trigger("selected"event, {
                
selectedselectee.element
            
});
        });
        
this._trigger("stop"event);

        
this.helper.remove();

        return 
false;
    }

});

})(
jQuery);
(function( $, 
undefined ) {

/*jshint loopfunc: true */

function isOverAxisxreferencesize ) {
    return ( 
reference ) && ( < ( reference size ) );
}

$.
widget("ui.sortable", $.ui.mouse, {
    
version"1.10.1",
    
widgetEventPrefix"sort",
    
readyfalse,
    
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,

        
// callbacks
        
activatenull,
        
beforeStopnull,
        
changenull,
        
deactivatenull,
        
outnull,
        
overnull,
        
receivenull,
        
removenull,
        
sortnull,
        
startnull,
        
stopnull,
        
updatenull
    
},
    
_create: function() {

        var 
this.options;
        
this.containerCache = {};
        
this.element.addClass("ui-sortable");

        
//Get the items
        
this.refresh();

        
//Let's determine if the items are being displayed horizontally
        
this.floating this.items.length o.axis === "x" || (/left|right/).test(this.items[0].item.css("float")) || (/inline|table-cell/).test(this.items[0].item.css("display")) : false;

        
//Let's determine the parent's offset
        
this.offset this.element.offset();

        
//Initialize mouse events for interaction
        
this._mouseInit();

        
//We're ready to go
        
this.ready true;

    },

    
_destroy: function() {
        
this.element
            
.removeClass("ui-sortable ui-sortable-disabled");
        
this._mouseDestroy();

        for ( var 
this.items.length 1>= 0i-- ) {
            
this.items[i].item.removeData(this.widgetName "-item");
        }

        return 
this;
    },

    
_setOption: function(keyvalue){
        if ( 
key === "disabled" ) {
            
this.optionskey ] = value;

            
this.widget().toggleClass"ui-sortable-disabled", !!value );
        } else {
            
// Don't call widget base _setOption for disable as it adds ui-state-disabled class
            
$.Widget.prototype._setOption.apply(thisarguments);
        }
    },

    
_mouseCapture: function(eventoverrideHandle) {
        var 
currentItem null,
            
validHandle false,
            
that this;

        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
        
$(event.target).parents().each(function() {
            if($.
data(thisthat.widgetName "-item") === that) {
                
currentItem = $(this);
                return 
false;
            }
        });
        if($.
data(event.targetthat.widgetName "-item") === that) {
            
currentItem = $(event.target);
        }

        if(!
currentItem) {
            return 
false;
        }
        if(
this.options.handle && !overrideHandle) {
            $(
this.options.handlecurrentItem).find("*").addBack().each(function() {
                if(
this === event.target) {
                    
validHandle true;
                }
            });
            if(!
validHandle) {
                return 
false;
            }
        }

        
this.currentItem currentItem;
        
this._removeCurrentsFromItems();
        return 
true;

    },

    
_mouseStart: function(eventoverrideHandlenoActivation) {

        var 
i,
            
this.options;

        
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
        
};

        $.
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
        
});

        
// 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");

        
//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 ( 
this.containers.length 1>= 0i-- ) {
                
this.containers]._trigger"activate"eventthis._uiHashthis ) );
            }
        }

        
//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) {
        var 
iitemitemElementintersection,
            
this.options,
            
scrolled false;

        
//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) {
            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 (this.items.length 1>= 0i--) {

            
//Cache variables and intersection, continue if no intersection
            
item this.items[i];
            
itemElement item.item[0];
            
intersection this._intersectsWithPointer(item);
            if (!
intersection) {
                continue;
            }

            
// Only put the placeholder inside the current Container, skip all
            // items form other containers. This works because when moving
            // an item from one container to another the
            // currentContainer is switched before the placeholder is moved.
            //
            // Without this moving items in "sub-sortables" can cause the placeholder to jitter
            // beetween the outer and inner container.
            
if (item.instance !== this.currentContainer) {
                continue;
            }

            
// cannot intersect with itself
            // no useless actions that have been done before
            // no action if the item moved is the parent of the item checked
            
if (itemElement !== this.currentItem[0] &&
                
this.placeholder[intersection === "next" "prev"]()[0] !== itemElement &&
                !$.
contains(this.placeholder[0], itemElement) &&
                (
this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
            ) {

                
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 
that this,
                
cur this.placeholder.offset();

            
this.reverting true;

            $(
this.helper).animate({
                
leftcur.left this.offset.parent.left this.margins.left + (this.offsetParent[0] === document.body this.offsetParent[0].scrollLeft),
                
topcur.top this.offset.parent.top this.margins.top + (this.offsetParent[0] === document.body this.offsetParent[0].scrollTop)
            }, 
parseInt(this.options.revert10) || 500, function() {
                
that._clear(event);
            });
        } else {
            
this._clear(eventnoPropagation);
        }

        return 
false;

    },

    
cancel: function() {

        if(
this.dragging) {

            
this._mouseUp({ targetnull });

            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>= 0i--){
                
this.containers[i]._trigger("deactivate"nullthis._uiHash(this));
                if(
this.containers[i].containerCache.over) {
                    
this.containers[i]._trigger("out"nullthis._uiHash(this));
                    
this.containers[i].containerCache.over 0;
                }
            }

        }

        if (
this.placeholder) {
            
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
            
if(this.placeholder[0].parentNode) {
                
this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
            }
            if(
this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
                
this.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),
            
str = [];
        
|| {};

        $(
items).each(function() {
            var 
res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[-=_](.+)/));
            if (
res) {
                
str.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),
            
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,
            
item.left,
            
item.width,
            
item.top,
            
item.height,
            
dyClick this.offset.click.top,
            
dxClick this.offset.click.left,
            
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 = (this.options.axis === "x") || isOverAxis(this.positionAbs.top this.offset.click.topitem.topitem.height),
            
isOverElementWidth = (this.options.axis === "y") || 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 isOverAxis(this.positionAbs.top this.offset.click.topitem.top + (item.height/2), item.height),
            
isOverRightHalf 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 
ijcurinst,
            
items = [],
            
queries = [],
            
connectWith this._connectWith();

        if(
connectWith && connected) {
            for (
connectWith.length 1>= 0i--){
                
cur = $(connectWith[i]);
                for ( 
cur.length 1>= 0j--){
                    
inst = $.data(cur[j], this.widgetFullName);
                    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 (
queries.length 1>= 0i--){
            
queries[i][0].each(function() {
                
items.push(this);
            });
        }

        return $(
items);

    },

    
_removeCurrentsFromItems: function() {

        var list = 
this.currentItem.find(":data(" this.widgetName "-item)");

        
this.items = $.grep(this.items, function (item) {
            for (var 
j=0< list.lengthj++) {
                if(list[
j] === item.item[0]) {
                    return 
false;
                }
            }
            return 
true;
        });

    },

    
_refreshItems: function(event) {

        
this.items = [];
        
this.containers = [this];

        var 
ijcurinsttargetData_queriesitemqueriesLength,
            
items this.items,
            
queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { itemthis.currentItem }) : $(this.options.itemsthis.element), this]],
            
connectWith this._connectWith();

        if(
connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
            
for (connectWith.length 1>= 0i--){
                
cur = $(connectWith[i]);
                for (
cur.length 1>= 0j--){
                    
inst = $.data(cur[j], this.widgetFullName);
                    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 (
queries.length 1>= 0i--) {
            
targetData queries[i][1];
            
_queries queries[i][0];

            for (
j=0queriesLength _queries.lengthqueriesLengthj++) {
                
item = $(_queries[j]);

                
item.data(this.widgetName "-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();
        }

        var 
iitemtp;

        for (
this.items.length 1>= 0i--){
            
item this.items[i];

            
//We ignore calculating positions of all connected containers when we're not over them
            
if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
                continue;
            }

            
this.options.toleranceElement ? $(this.options.toleranceElementitem.item) : item.item;

            if (!
fast) {
                
item.width t.outerWidth();
                
item.height t.outerHeight();
            }

            
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 (
this.containers.length 1>= 0i--){
                
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) {
        
that that || this;
        var 
className,
            
that.options;

        if(!
o.placeholder || o.placeholder.constructor === String) {
            
className o.placeholder;
            
o.placeholder = {
                
element: function() {

                    var 
el = $(document.createElement(that.currentItem[0].nodeName))
                        .
addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
                        .
removeClass("ui-sortable-helper")[0];

                    if(!
className) {
                        
el.style.visibility "hidden";
                    }

                    return 
el;
                },
                
update: function(containerp) {

                    
// 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
                    // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
                    
if(className && !o.forcePlaceholderSize) {
                        return;
                    }

                    
//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
                    
if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||010) - parseInt(that.currentItem.css("paddingBottom")||010)); }
                    if(!
p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||010) - parseInt(that.currentItem.css("paddingRight")||010)); }
                }
            };
        }

        
//Create the placeholder
        
that.placeholder = $(o.placeholder.element.call(that.elementthat.currentItem));

        
//Append it after the actual current item
        
that.currentItem.after(that.placeholder);

        
//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
        
o.placeholder.update(thatthat.placeholder);

    },

    
_contactContainers: function(event) {
        var 
ijdistitemWithLeastDistanceposPropertysizePropertybasecurnearBottom,
            
innermostContainer null,
            
innermostIndex null;

        
// get innermost container that intersects with item
        
for (this.containers.length 1>= 0i--) {

            
// never consider a container that's located within the item itself
            
if($.contains(this.currentItem[0], this.containers[i].element[0])) {
                continue;
            }

            if(
this._intersectsWith(this.containers[i].containerCache)) {

                
// if we've already found a container and it's more "inner" than this, then continue
                
if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
                    continue;
                }

                
innermostContainer this.containers[i];
                
innermostIndex i;

            } else {
                
// container doesn't intersect. trigger "out" event if necessary
                
if(this.containers[i].containerCache.over) {
                    
this.containers[i]._trigger("out"eventthis._uiHash(this));
                    
this.containers[i].containerCache.over 0;
                }
            }

        }

        
// if no intersecting containers found, return
        
if(!innermostContainer) {
            return;
        }

        
// move the item into the container if it's not there already
        
if(this.containers.length === 1) {
            
this.containers[innermostIndex]._trigger("over"eventthis._uiHash(this));
            
this.containers[innermostIndex].containerCache.over 1;
        } else {

            
//When entering a new container, we will find the item with the least distance and append our item near it
            
dist 10000;
            
itemWithLeastDistance null;
            
posProperty this.containers[innermostIndex].floating "left" "top";
            
sizeProperty this.containers[innermostIndex].floating "width" "height";
            
base this.positionAbs[posProperty] + this.offset.click[posProperty];
            for (
this.items.length 1>= 0j--) {
                if(!$.
contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
                    continue;
                }
                if(
this.items[j].item[0] === this.currentItem[0]) {
                    continue;
                }
                
cur this.items[j].item.offset()[posProperty];
                
nearBottom false;
                if(
Math.abs(cur base) > Math.abs(cur this.items[j][sizeProperty] - base)){
                    
nearBottom true;
                    
cur += this.items[j][sizeProperty];
                }

                if(
Math.abs(cur base) < dist) {
                    
dist Math.abs(cur base); itemWithLeastDistance this.items[j];
                    
this.direction nearBottom "up""down";
                }
            }

            
//Check if dropOnEmpty is enabled
            
if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
                return;
            }

            
this.currentContainer this.containers[innermostIndex];
            
itemWithLeastDistance this._rearrange(eventitemWithLeastDistancenulltrue) : this._rearrange(eventnullthis.containers[innermostIndex].elementtrue);
            
this._trigger("change"eventthis._uiHash());
            
this.containers[innermostIndex]._trigger("change"eventthis._uiHash(this));

            
//Update the placeholder
            
this.options.placeholder.update(this.currentContainerthis.placeholder);

            
this.containers[innermostIndex]._trigger("over"eventthis._uiHash(this));
            
this.containers[innermostIndex].containerCache.over 1;
        }


    },

    
_createHelper: function(event) {

        var 
this.options,
            
helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [eventthis.currentItem])) : (o.helper === "clone" this.currentItem.clone() : this.currentItem);

        
//Add the helper to the DOM if that didn't happen already
        
if(!helper.parents("body").length) {
            $(
o.appendTo !== "parent" o.appendTo this.currentItem[0].parentNode)[0].appendChild(helper[0]);
        }

        if(
helper[0] === this.currentItem[0]) {
            
this._storedCSS = { widththis.currentItem[0].style.widthheightthis.currentItem[0].style.heightpositionthis.currentItem.css("position"), topthis.currentItem.css("top"), leftthis.currentItem.css("left") };
        }

        if(!
helper[0].style.width || o.forceHelperSize) {
            
helper.width(this.currentItem.width());
        }
        if(!
helper[0].style.height || o.forceHelperSize) {
            
helper.height(this.currentItem.height());
        }

        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 && $.contains(this.scrollParent[0], this.offsetParent[0])) {
            
po.left += this.scrollParent.scrollLeft();
            
po.top += this.scrollParent.scrollTop();
        }

        
// This needs to be actually done for all browsers, since pageX/pageY includes this information
        // with an ugly IE fix
        
if( this.offsetParent[0] === document.body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
            
po = { top0left};
        }

        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.currentItem.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 { 
top0left};
        }

    },

    
_cacheMargins: function() {
        
this.margins = {
            
left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
            
top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
        };
    },

    
_cacheHelperProportions: function() {
        
this.helperProportions = {
            
widththis.helper.outerWidth(),
            
heightthis.helper.outerHeight()
        };
    },

    
_setContainment: function() {

        var 
cecoover,
            
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)) {
            
ce = $(o.containment)[0];
            
co = $(o.containment).offset();
            
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
            
];
        }

    },

    
_convertPositionTo: function(dpos) {

        if(!
pos) {
            
pos this.position;
        }
        var 
mod === "absolute" : -1,
            
scroll this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent this.scrollParent,
            
scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);

        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)
                
( ( 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)
                
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode scroll.scrollLeft() ) * mod)
            )
        };

    },

    
_generatePosition: function(event) {

        var 
topleft,
            
this.options,
            
pageX event.pageX,
            
pageY event.pageY,
            
scroll this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent this.scrollParentscrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);

        
// This is another very weird special case that only happens for relative elements:
        // 1. If the css position is relative
        // 2. and the scroll parent is the document or similar to the offset parent
        // we have to refresh the relative offset during the scroll so there are no jumps
        
if(this.cssPosition === "relative" && !(this.scrollParent[0] !== document && this.scrollParent[0] !== this.offsetParent[0])) {
            
this.offset.relative this._getRelativeOffset();
        }

        
/*
         * - 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) {
                
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;

                
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)
                
( ( 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)
                
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode scroll.scrollLeft() ))
            )
        };

    },

    
_rearrange: function(eventiahardRefresh) {

        
a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" i.item[0] : i.item[0].nextSibling));

        
//Various things done here to improve the performance:
        // 1. we create a setTimeout, that calls refreshPositions
        // 2. on the instance, we have a counter variable, that get's higher after every append
        // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
        // 4. this lets only the last addition to the timeout stack through
        
this.counter this.counter ? ++this.counter 1;
        var 
counter this.counter;

        
this._delay(function() {
            if(
counter === this.counter) {
                
this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
            
}
        });

    },

    
_clear: function(eventnoPropagation) {

        
this.reverting false;
        
// We delay all events that have to be triggered to after the point where the placeholder has been removed and
        // everything else normalized again
        
var i,
            
delayedTriggers = [];

        
// We first have to update the dom position of the actual currentItem
        // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
        
if(!this._noFinalSort && this.currentItem.parent().length) {
            
this.placeholder.before(this.currentItem);
        }
        
this._noFinalSort null;

        if(
this.helper[0] === this.currentItem[0]) {
            for(
i in this._storedCSS) {
                if(
this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
                    
this._storedCSS[i] = "";
                }
            }
            
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
        } else {
            
this.currentItem.show();
        }

        if(
this.fromOutside && !noPropagation) {
            
delayedTriggers.push(function(event) { this._trigger("receive"eventthis._uiHash(this.fromOutside)); });
        }
        if((
this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
            
delayedTriggers.push(function(event) { this._trigger("update"eventthis._uiHash()); }); //Trigger update callback if the DOM position has changed
        
}

        
// Check if the items Container has Changed and trigger appropriate
        // events.
        
if (this !== this.currentContainer) {
            if(!
noPropagation) {
                
delayedTriggers.push(function(event) { this._trigger("remove"eventthis._uiHash()); });
                
delayedTriggers.push((function(c) { return function(event) { c._trigger("receive"eventthis._uiHash(this)); };  }).call(thisthis.currentContainer));
                
delayedTriggers.push((function(c) { return function(event) { c._trigger("update"eventthis._uiHash(this));  }; }).call(thisthis.currentContainer));
            }
        }


        
//Post events to containers
        
for (this.containers.length 1>= 0i--){
            if(!
noPropagation) {
                
delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate"eventthis._uiHash(this)); };  }).call(thisthis.containers[i]));
            }
            if(
this.containers[i].containerCache.over) {
                
delayedTriggers.push((function(c) { return function(event) { c._trigger("out"eventthis._uiHash(this)); };  }).call(thisthis.containers[i]));
                
this.containers[i].containerCache.over 0;
            }
        }

        
//Do what was originally in plugins
        
if(this._storedCursor) {
            $(
"body").css("cursor"this._storedCursor);
        }
        if(
this._storedOpacity) {
            
this.helper.css("opacity"this._storedOpacity);
        }
        if(
this._storedZIndex) {
            
this.helper.css("zIndex"this._storedZIndex === "auto" "" this._storedZIndex);
        }

        
this.dragging false;
        if(
this.cancelHelperRemoval) {
            if(!
noPropagation) {
                
this._trigger("beforeStop"eventthis._uiHash());
                for (
i=0delayedTriggers.lengthi++) {
                    
delayedTriggers[i].call(thisevent);
                } 
//Trigger all delayed events
                
this._trigger("stop"eventthis._uiHash());
            }

            
this.fromOutside false;
            return 
false;
        }

        if(!
noPropagation) {
            
this._trigger("beforeStop"eventthis._uiHash());
        }

        
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
        
this.placeholder[0].parentNode.removeChild(this.placeholder[0]);

        if(
this.helper[0] !== this.currentItem[0]) {
            
this.helper.remove();
        }
        
this.helper null;

        if(!
noPropagation) {
            for (
i=0delayedTriggers.lengthi++) {
                
delayedTriggers[i].call(thisevent);
            } 
//Trigger all delayed events
            
this._trigger("stop"eventthis._uiHash());
        }

        
this.fromOutside false;
        return 
true;

    },

    
_trigger: function() {
        if ($.
Widget.prototype._trigger.apply(thisarguments) === false) {
            
this.cancel();
        }
    },

    
_uiHash: function(_inst) {
        var 
inst _inst || this;
        return {
            
helperinst.helper,
            
placeholderinst.placeholder || $([]),
            
positioninst.position,
            
originalPositioninst.originalPosition,
            
offsetinst.positionAbs,
            
iteminst.currentItem,
            
sender_inst _inst.element null
        
};
    }

});

})(
jQuery);
(function( $, 
undefined ) {

var 
uid 0,
    
hideProps = {},
    
showProps = {};

hideProps.height hideProps.paddingTop hideProps.paddingBottom =
    
hideProps.borderTopWidth hideProps.borderBottomWidth "hide";
showProps.height showProps.paddingTop showProps.paddingBottom =
    
showProps.borderTopWidth showProps.borderBottomWidth "show";

$.
widget"ui.accordion", {
    
version"1.10.1",
    
options: {
        
active0,
        
animate: {},
        
collapsiblefalse,
        
event"click",
        
header"> li > :first-child,> :not(li):even",
        
heightStyle"auto",
        
icons: {
            
activeHeader"ui-icon-triangle-1-s",
            
header"ui-icon-triangle-1-e"
        
},

        
// callbacks
        
activatenull,
        
beforeActivatenull
    
},

    
_create: function() {
        var 
options this.options;
        
this.prevShow this.prevHide = $();
        
this.element.addClass"ui-accordion ui-widget ui-helper-reset" )
            
// ARIA
            
.attr"role""tablist" );

        
// don't allow collapsible: false and active: false / null
        
if ( !options.collapsible && (options.active === false || options.active == null) ) {
            
options.active 0;
        }

        
this._processPanels();
        
// handle negative values
        
if ( options.active ) {
            
options.active += this.headers.length;
        }
        
this._refresh();
    },

    
_getCreateEventData: function() {
        return {
            
headerthis.active,
            
panel: !this.active.length ? $() : this.active.next(),
            
content: !this.active.length ? $() : this.active.next()
        };
    },

    
_createIcons: function() {
        var 
icons this.options.icons;
        if ( 
icons ) {
            $( 
"<span>" )
                .
addClass"ui-accordion-header-icon ui-icon " icons.header )
                .
prependTothis.headers );
            
this.active.children".ui-accordion-header-icon" )
                .
removeClassicons.header )
                .
addClassicons.activeHeader );
            
this.headers.addClass"ui-accordion-icons" );
        }
    },

    
_destroyIcons: function() {
        
this.headers
            
.removeClass"ui-accordion-icons" )
            .
children".ui-accordion-header-icon" )
                .
remove();
    },

    
_destroy: function() {
        var 
contents;

        
// clean up main element
        
this.element
            
.removeClass"ui-accordion ui-widget ui-helper-reset" )
            .
removeAttr"role" );

        
// clean up headers
        
this.headers
            
.removeClass"ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
            .
removeAttr"role" )
            .
removeAttr"aria-selected" )
            .
removeAttr"aria-controls" )
            .
removeAttr"tabIndex" )
            .
each(function() {
                if ( /^
ui-accordion/.testthis.id ) ) {
                    
this.removeAttribute"id" );
                }
            });
        
this._destroyIcons();

        
// clean up content panels
        
contents this.headers.next()
            .
css"display""" )
            .
removeAttr"role" )
            .
removeAttr"aria-expanded" )
            .
removeAttr"aria-hidden" )
            .
removeAttr"aria-labelledby" )
            .
removeClass"ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" )
            .
each(function() {
                if ( /^
ui-accordion/.testthis.id ) ) {
                    
this.removeAttribute"id" );
                }
            });
        if ( 
this.options.heightStyle !== "content" ) {
            
contents.css"height""" );
        }
    },

    
_setOption: function( keyvalue ) {
        if ( 
key === "active" ) {
            
// _activate() will handle invalid values and update this.options
            
this._activatevalue );
            return;
        }

        if ( 
key === "event" ) {
            if ( 
this.options.event ) {
                
this._offthis.headersthis.options.event );
            }
            
this._setupEventsvalue );
        }

        
this._superkeyvalue );

        
// setting collapsible: false while collapsed; open first panel
        
if ( key === "collapsible" && !value && this.options.active === false ) {
            
this._activate);
        }

        if ( 
key === "icons" ) {
            
this._destroyIcons();
            if ( 
value ) {
                
this._createIcons();
            }
        }

        
// #5332 - opacity doesn't cascade to positioned elements in IE
        // so we need to add the disabled class to the headers and panels
        
if ( key === "disabled" ) {
            
this.headers.addthis.headers.next() )
                .
toggleClass"ui-state-disabled", !!value );
        }
    },

    
_keydown: function( event ) {
        
/*jshint maxcomplexity:15*/
        
if ( event.altKey || event.ctrlKey ) {
            return;
        }

        var 
keyCode = $.ui.keyCode,
            
length this.headers.length,
            
currentIndex this.headers.indexevent.target ),
            
toFocus false;

        switch ( 
event.keyCode ) {
            case 
keyCode.RIGHT:
            case 
keyCode.DOWN:
                
toFocus this.headers[ ( currentIndex ) % length ];
                break;
            case 
keyCode.LEFT:
            case 
keyCode.UP:
                
toFocus this.headers[ ( currentIndex length ) % length ];
                break;
            case 
keyCode.SPACE:
            case 
keyCode.ENTER:
                
this._eventHandlerevent );
                break;
            case 
keyCode.HOME:
                
toFocus this.headers];
                break;
            case 
keyCode.END:
                
toFocus this.headerslength ];
                break;
        }

        if ( 
toFocus ) {
            $( 
event.target ).attr"tabIndex", -);
            $( 
toFocus ).attr"tabIndex");
            
toFocus.focus();
            
event.preventDefault();
        }
    },

    
_panelKeyDown : function( event ) {
        if ( 
event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
            $( 
event.currentTarget ).prev().focus();
        }
    },

    
refresh: function() {
        var 
options this.options;
        
this._processPanels();

        
// was collapsed or no panel
        
if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) {
            
options.active false;
            
this.active = $();
        
// active false only when collapsible is true
        
} if ( options.active === false ) {
            
this._activate);
        
// was active, but active panel is gone
        
} else if ( this.active.length && !$.containsthis.element], this.active] ) ) {
            
// all remaining panel are disabled
            
if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) {
                
options.active false;
                
this.active = $();
            
// activate previous panel
            
} else {
                
this._activateMath.max0options.active ) );
            }
        
// was active, active panel still exists
        
} else {
            
// make sure active index is correct
            
options.active this.headers.indexthis.active );
        }

        
this._destroyIcons();

        
this._refresh();
    },

    
_processPanels: function() {
        
this.headers this.element.findthis.options.header )
            .
addClass"ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" );

        
this.headers.next()
            .
addClass"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
            .
filter(":not(.ui-accordion-content-active)")
            .
hide();
    },

    
_refresh: function() {
        var 
maxHeight,
            
options this.options,
            
heightStyle options.heightStyle,
            
parent this.element.parent(),
            
accordionId this.accordionId "ui-accordion-" +
                (
this.element.attr"id" ) || ++uid);

        
this.active this._findActiveoptions.active )
            .
addClass"ui-accordion-header-active ui-state-active ui-corner-top" )
            .
removeClass"ui-corner-all" );
        
this.active.next()
            .
addClass"ui-accordion-content-active" )
            .
show();

        
this.headers
            
.attr"role""tab" )
            .
each(function( ) {
                var 
header = $( this ),
                    
headerId header.attr"id" ),
                    
panel header.next(),
                    
panelId panel.attr"id" );
                if ( !
headerId ) {
                    
headerId accordionId "-header-" i;
                    
header.attr"id"headerId );
                }
                if ( !
panelId ) {
                    
panelId accordionId "-panel-" i;
                    
panel.attr"id"panelId );
                }
                
header.attr"aria-controls"panelId );
                
panel.attr"aria-labelledby"headerId );
            })
            .
next()
                .
attr"role""tabpanel" );

        
this.headers
            
.notthis.active )
            .
attr({
                
"aria-selected""false",
                
tabIndex: -1
            
})
            .
next()
                .
attr({
                    
"aria-expanded""false",
                    
"aria-hidden""true"
                
})
                .
hide();

        
// make sure at least one header is in the tab order
        
if ( !this.active.length ) {
            
this.headers.eq).attr"tabIndex");
        } else {
            
this.active.attr({
                
"aria-selected""true",
                
tabIndex0
            
})
            .
next()
                .
attr({
                    
"aria-expanded""true",
                    
"aria-hidden""false"
                
});
        }

        
this._createIcons();

        
this._setupEventsoptions.event );

        if ( 
heightStyle === "fill" ) {
            
maxHeight parent.height();
            
this.element.siblings":visible" ).each(function() {
                var 
elem = $( this ),
                    
position elem.css"position" );

                if ( 
position === "absolute" || position === "fixed" ) {
                    return;
                }
                
maxHeight -= elem.outerHeighttrue );
            });

            
this.headers.each(function() {
                
maxHeight -= $( this ).outerHeighttrue );
            });

            
this.headers.next()
                .
each(function() {
                    $( 
this ).heightMath.max0maxHeight -
                        $( 
this ).innerHeight() + $( this ).height() ) );
                })
                .
css"overflow""auto" );
        } else if ( 
heightStyle === "auto" ) {
            
maxHeight 0;
            
this.headers.next()
                .
each(function() {
                    
maxHeight Math.maxmaxHeight, $( this ).css"height""" ).height() );
                })
                .
heightmaxHeight );
        }
    },

    
_activate: function( index ) {
        var 
active this._findActiveindex )[ ];

        
// trying to activate the already active panel
        
if ( active === this.active] ) {
            return;
        }

        
// trying to collapse, simulate a click on the currently active header
        
active active || this.active];

        
this._eventHandler({
            
targetactive,
            
currentTargetactive,
            
preventDefault: $.noop
        
});
    },

    
_findActive: function( selector ) {
        return 
typeof selector === "number" this.headers.eqselector ) : $();
    },

    
_setupEvents: function( event ) {
        var 
events = {
            
keydown"_keydown"
        
};
        if ( 
event ) {
            $.
eachevent.split(" "), function( indexeventName ) {
                
eventseventName ] = "_eventHandler";
            });
        }

        
this._offthis.headers.addthis.headers.next() ) );
        
this._onthis.headersevents );
        
this._onthis.headers.next(), { keydown"_panelKeyDown" });
        
this._hoverablethis.headers );
        
this._focusablethis.headers );
    },

    
_eventHandler: function( event ) {
        var 
options this.options,
            
active this.active,
            
clicked = $( event.currentTarget ),
            
clickedIsActive clicked] === active],
            
collapsing clickedIsActive && options.collapsible,
            
toShow collapsing ? $() : clicked.next(),
            
toHide active.next(),
            
eventData = {
                
oldHeaderactive,
                
oldPaneltoHide,
                
newHeadercollapsing ? $() : clicked,
                
newPaneltoShow
            
};

        
event.preventDefault();

        if (
                
// click on active header, but not collapsible
                
clickedIsActive && !options.collapsible ) ||
                
// allow canceling activation
                
this._trigger"beforeActivate"eventeventData ) === false ) ) {
            return;
        }

        
options.active collapsing false this.headers.indexclicked );

        
// when the call to ._toggle() comes after the class changes
        // it causes a very odd bug in IE 8 (see #6720)
        
this.active clickedIsActive ? $() : clicked;
        
this._toggleeventData );

        
// switch classes
        // corner classes on the previously active header stay after the animation
        
active.removeClass"ui-accordion-header-active ui-state-active" );
        if ( 
options.icons ) {
            
active.children".ui-accordion-header-icon" )
                .
removeClassoptions.icons.activeHeader )
                .
addClassoptions.icons.header );
        }

        if ( !
clickedIsActive ) {
            
clicked
                
.removeClass"ui-corner-all" )
                .
addClass"ui-accordion-header-active ui-state-active ui-corner-top" );
            if ( 
options.icons ) {
                
clicked.children".ui-accordion-header-icon" )
                    .
removeClassoptions.icons.header )
                    .
addClassoptions.icons.activeHeader );
            }

            
clicked
                
.next()
                .
addClass"ui-accordion-content-active" );
        }
    },

    
_toggle: function( data ) {
        var 
toShow data.newPanel,
            
toHide this.prevShow.length this.prevShow data.oldPanel;

        
// handle activating a panel during the animation for another activation
        
this.prevShow.addthis.prevHide ).stoptruetrue );
        
this.prevShow toShow;
        
this.prevHide toHide;

        if ( 
this.options.animate ) {
            
this._animatetoShowtoHidedata );
        } else {
            
toHide.hide();
            
toShow.show();
            
this._toggleCompletedata );
        }

        
toHide.attr({
            
"aria-expanded""false",
            
"aria-hidden""true"
        
});
        
toHide.prev().attr"aria-selected""false" );
        
// if we're switching panels, remove the old header from the tab order
        // if we're opening from collapsed state, remove the previous header from the tab order
        // if we're collapsing, then keep the collapsing header in the tab order
        
if ( toShow.length && toHide.length ) {
            
toHide.prev().attr"tabIndex", -);
        } else if ( 
toShow.length ) {
            
this.headers.filter(function() {
                return $( 
this ).attr"tabIndex" ) === 0;
            })
            .
attr"tabIndex", -);
        }

        
toShow
            
.attr({
                
"aria-expanded""true",
                
"aria-hidden""false"
            
})
            .
prev()
                .
attr({
                    
"aria-selected""true",
                    
tabIndex0
                
});
    },

    
_animate: function( toShowtoHidedata ) {
        var 
totaleasingduration,
            
that this,
            
adjust 0,
            
down toShow.length &&
                ( !
toHide.length || ( toShow.index() < toHide.index() ) ),
            
animate this.options.animate || {},
            
options down && animate.down || animate,
            
complete = function() {
                
that._toggleCompletedata );
            };

        if ( 
typeof options === "number" ) {
            
duration options;
        }
        if ( 
typeof options === "string" ) {
            
easing options;
        }
        
// fall back from options to animation in case of partial down settings
        
easing easing || options.easing || animate.easing;
        
duration duration || options.duration || animate.duration;

        if ( !
toHide.length ) {
            return 
toShow.animateshowPropsdurationeasingcomplete );
        }
        if ( !
toShow.length ) {
            return 
toHide.animatehidePropsdurationeasingcomplete );
        }

        
total toShow.show().outerHeight();
        
toHide.animatehideProps, {
            
durationduration,
            
easingeasing,
            
step: function( nowfx ) {
                
fx.now Math.roundnow );
            }
        });
        
toShow
            
.hide()
            .
animateshowProps, {
                
durationduration,
                
easingeasing,
                
completecomplete,
                
step: function( nowfx ) {
                    
fx.now Math.roundnow );
                    if ( 
fx.prop !== "height" ) {
                        
adjust += fx.now;
                    } else if ( 
that.options.heightStyle !== "content" ) {
                        
fx.now Math.roundtotal toHide.outerHeight() - adjust );
                        
adjust 0;
                    }
                }
            });
    },

    
_toggleComplete: function( data ) {
        var 
toHide data.oldPanel;

        
toHide
            
.removeClass"ui-accordion-content-active" )
            .
prev()
                .
removeClass"ui-corner-top" )
                .
addClass"ui-corner-all" );

        
// Work around for rendering bug in IE (#5421)
        
if ( toHide.length ) {
            
toHide.parent()[0].className toHide.parent()[0].className;
        }

        
this._trigger"activate"nulldata );
    }
});

})( 
jQuery );
(function( $, 
undefined ) {

// used to prevent race conditions with remote data sources
var requestIndex 0;

$.
widget"ui.autocomplete", {
    
version"1.10.1",
    
defaultElement"<input>",
    
options: {
        
appendTonull,
        
autoFocusfalse,
        
delay300,
        
minLength1,
        
position: {
            
my"left top",
            
at"left bottom",
            
collision"none"
        
},
        
sourcenull,

        
// callbacks
        
changenull,
        
closenull,
        
focusnull,
        
opennull,
        
responsenull,
        
searchnull,
        
selectnull
    
},

    
pending0,

    
_create: function() {
        
// Some browsers only repeat keydown events, not keypress events,
        // so we use the suppressKeyPress flag to determine if we've already
        // handled the keydown event. #7269
        // Unfortunately the code for & in keypress is the same as the up arrow,
        // so we use the suppressKeyPressRepeat flag to avoid handling keypress
        // events when we know the keydown event was used to modify the
        // search term. #7799
        
var suppressKeyPresssuppressKeyPressRepeatsuppressInput,
            
nodeName this.element[0].nodeName.toLowerCase(),
            
isTextarea nodeName === "textarea",
            
isInput nodeName === "input";

        
this.isMultiLine =
            
// Textareas are always multi-line
            
isTextarea true :
            
// Inputs are always single-line, even if inside a contentEditable element
            // IE also treats inputs as contentEditable
            
isInput false :
            
// All other element types are determined by whether or not they're contentEditable
            
this.element.prop"isContentEditable" );

        
this.valueMethod this.elementisTextarea || isInput "val" "text" ];
        
this.isNewMenu true;

        
this.element
            
.addClass"ui-autocomplete-input" )
            .
attr"autocomplete""off" );

        
this._onthis.element, {
            
keydown: function( event ) {
                
/*jshint maxcomplexity:15*/
                
if ( this.element.prop"readOnly" ) ) {
                    
suppressKeyPress true;
                    
suppressInput true;
                    
suppressKeyPressRepeat true;
                    return;
                }

                
suppressKeyPress false;
                
suppressInput false;
                
suppressKeyPressRepeat false;
                var 
keyCode = $.ui.keyCode;
                switch( 
event.keyCode ) {
                case 
keyCode.PAGE_UP:
                    
suppressKeyPress true;
                    
this._move"previousPage"event );
                    break;
                case 
keyCode.PAGE_DOWN:
                    
suppressKeyPress true;
                    
this._move"nextPage"event );
                    break;
                case 
keyCode.UP:
                    
suppressKeyPress true;
                    
this._keyEvent"previous"event );
                    break;
                case 
keyCode.DOWN:
                    
suppressKeyPress true;
                    
this._keyEvent"next"event );
                    break;
                case 
keyCode.ENTER:
                case 
keyCode.NUMPAD_ENTER:
                    
// when menu is open and has focus
                    
if ( this.menu.active ) {
                        
// #6055 - Opera still allows the keypress to occur
                        // which causes forms to submit
                        
suppressKeyPress true;
                        
event.preventDefault();
                        
this.menu.selectevent );
                    }
                    break;
                case 
keyCode.TAB:
                    if ( 
this.menu.active ) {
                        
this.menu.selectevent );
                    }
                    break;
                case 
keyCode.ESCAPE:
                    if ( 
this.menu.element.is":visible" ) ) {
                        
this._valuethis.term );
                        
this.closeevent );
                        
// Different browsers have different default behavior for escape
                        // Single press can mean undo or clear
                        // Double press in IE means clear the whole form
                        
event.preventDefault();
                    }
                    break;
                default:
                    
suppressKeyPressRepeat true;
                    
// search timeout should be triggered before the input value is changed
                    
this._searchTimeoutevent );
                    break;
                }
            },
            
keypress: function( event ) {
                if ( 
suppressKeyPress ) {
                    
suppressKeyPress false;
                    
event.preventDefault();
                    return;
                }
                if ( 
suppressKeyPressRepeat ) {
                    return;
                }

                
// replicate some key handlers to allow them to repeat in Firefox and Opera
                
var keyCode = $.ui.keyCode;
                switch( 
event.keyCode ) {
                case 
keyCode.PAGE_UP:
                    
this._move"previousPage"event );
                    break;
                case 
keyCode.PAGE_DOWN:
                    
this._move"nextPage"event );
                    break;
                case 
keyCode.UP:
                    
this._keyEvent"previous"event );
                    break;
                case 
keyCode.DOWN:
                    
this._keyEvent"next"event );
                    break;
                }
            },
            
input: function( event ) {
                if ( 
suppressInput ) {
                    
suppressInput false;
                    
event.preventDefault();
                    return;
                }
                
this._searchTimeoutevent );
            },
            
focus: function() {
                
this.selectedItem null;
                
this.previous this._value();
            },
            
blur: function( event ) {
                if ( 
this.cancelBlur ) {
                    
delete this.cancelBlur;
                    return;
                }

                
clearTimeoutthis.searching );
                
this.closeevent );
                
this._changeevent );
            }
        });

        
this._initSource();
        
this.menu = $( "<ul>" )
            .
addClass"ui-autocomplete ui-front" )
            .
appendTothis._appendTo() )
            .
menu({
                
// custom key handling for now
                
input: $(),
                
// disable ARIA support, the live region takes care of that
                
rolenull
            
})
            .
hide()
            .
data"ui-menu" );

        
this._onthis.menu.element, {
            
mousedown: function( event ) {
                
// prevent moving focus out of the text field
                
event.preventDefault();

                
// IE doesn't prevent moving focus even with event.preventDefault()
                // so we set a flag to know when we should ignore the blur event
                
this.cancelBlur true;
                
this._delay(function() {
                    
delete this.cancelBlur;
                });

                
// clicking on the scrollbar causes focus to shift to the body
                // but we can't detect a mouseup or a click immediately afterward
                // so we have to track the next mousedown and close the menu if
                // the user clicks somewhere outside of the autocomplete
                
var menuElement this.menu.element];
                if ( !$( 
event.target ).closest".ui-menu-item" ).length ) {
                    
this._delay(function() {
                        var 
that this;
                        
this.document.one"mousedown", function( event ) {
                            if ( 
event.target !== that.element] &&
                                    
event.target !== menuElement &&
                                    !$.
containsmenuElementevent.target ) ) {
                                
that.close();
                            }
                        });
                    });
                }
            },
            
menufocus: function( eventui ) {
                
// #7024 - Prevent accidental activation of menu items in Firefox
                
if ( this.isNewMenu ) {
                    
this.isNewMenu false;
                    if ( 
event.originalEvent && /^mouse/.testevent.originalEvent.type ) ) {
                        
this.menu.blur();

                        
this.document.one"mousemove", function() {
                            $( 
event.target ).triggerevent.originalEvent );
                        });

                        return;
                    }
                }

                var 
item ui.item.data"ui-autocomplete-item" );
                if ( 
false !== this._trigger"focus"event, { itemitem } ) ) {
                    
// use value to match what will end up in the input, if it was a key event
                    
if ( event.originalEvent && /^key/.testevent.originalEvent.type ) ) {
                        
this._valueitem.value );
                    }
                } else {
                    
// Normally the input is populated with the item's value as the
                    // menu is navigated, causing screen readers to notice a change and
                    // announce the item. Since the focus event was canceled, this doesn't
                    // happen, so we update the live region so that screen readers can
                    // still notice the change and announce it.
                    
this.liveRegion.textitem.value );
                }
            },
            
menuselect: function( eventui ) {
                var 
item ui.item.data"ui-autocomplete-item" ),
                    
previous this.previous;

                
// only trigger when focus was lost (click on menu)
                
if ( this.element[0] !== this.document[0].activeElement ) {
                    
this.element.focus();
                    
this.previous previous;
                    
// #6109 - IE triggers two focus events and the second
                    // is asynchronous, so we need to reset the previous
                    // term synchronously and asynchronously :-(
                    
this._delay(function() {
                        
this.previous previous;
                        
this.selectedItem item;
                    });
                }

                if ( 
false !== this._trigger"select"event, { itemitem } ) ) {
                    
this._valueitem.value );
                }
                
// reset the term after the select event
                // this allows custom select handling to work properly
                
this.term this._value();

                
this.closeevent );
                
this.selectedItem item;
            }
        });

        
this.liveRegion = $( "<span>", {
                
role"status",
                
"aria-live""polite"
            
})
            .
addClass"ui-helper-hidden-accessible" )
            .
insertAfterthis.element );

        
// turning off autocomplete prevents the browser from remembering the
        // value when navigating through history, so we re-enable autocomplete
        // if the page is unloaded before the widget is destroyed. #7790
        
this._onthis.window, {
            
beforeunload: function() {
                
this.element.removeAttr"autocomplete" );
            }
        });
    },

    
_destroy: function() {
        
clearTimeoutthis.searching );
        
this.element
            
.removeClass"ui-autocomplete-input" )
            .
removeAttr"autocomplete" );
        
this.menu.element.remove();
        
this.liveRegion.remove();
    },

    
_setOption: function( keyvalue ) {
        
this._superkeyvalue );
        if ( 
key === "source" ) {
            
this._initSource();
        }
        if ( 
key === "appendTo" ) {
            
this.menu.element.appendTothis._appendTo() );
        }
        if ( 
key === "disabled" && value && this.xhr ) {
            
this.xhr.abort();
        }
    },

    
_appendTo: function() {
        var 
element this.options.appendTo;

        if ( 
element ) {
            
element element.jquery || element.nodeType ?
                $( 
element ) :
                
this.document.findelement ).eq);
        }

        if ( !
element ) {
            
element this.element.closest".ui-front" );
        }

        if ( !
element.length ) {
            
element this.document[0].body;
        }

        return 
element;
    },

    
_initSource: function() {
        var array, 
url,
            
that this;
        if ( $.
isArray(this.options.source) ) {
            array = 
this.options.source;
            
this.source = function( requestresponse ) {
                
response( $.ui.autocomplete.filter( array, request.term ) );
            };
        } else if ( 
typeof this.options.source === "string" ) {
            
url this.options.source;
            
this.source = function( requestresponse ) {
                if ( 
that.xhr ) {
                    
that.xhr.abort();
                }
                
that.xhr = $.ajax({
                    
urlurl,
                    
datarequest,
                    
dataType"json",
                    
success: function( data ) {
                        
responsedata );
                    },
                    
error: function() {
                        
response( [] );
                    }
                });
            };
        } else {
            
this.source this.options.source;
        }
    },

    
_searchTimeout: function( event ) {
        
clearTimeoutthis.searching );
        
this.searching this._delay(function() {
            
// only search if the value has changed
            
if ( this.term !== this._value() ) {
                
this.selectedItem null;
                
this.searchnullevent );
            }
        }, 
this.options.delay );
    },

    
search: function( valueevent ) {
        
value value != null value this._value();

        
// always save the actual value, not the one passed as an argument
        
this.term this._value();

        if ( 
value.length this.options.minLength ) {
            return 
this.closeevent );
        }

        if ( 
this._trigger"search"event ) === false ) {
            return;
        }

        return 
this._searchvalue );
    },

    
_search: function( value ) {
        
this.pending++;
        
this.element.addClass"ui-autocomplete-loading" );
        
this.cancelSearch false;

        
this.source( { termvalue }, this._response() );
    },

    
_response: function() {
        var 
that this,
            
index = ++requestIndex;

        return function( 
content ) {
            if ( 
index === requestIndex ) {
                
that.__responsecontent );
            }

            
that.pending--;
            if ( !
that.pending ) {
                
that.element.removeClass"ui-autocomplete-loading" );
            }
        };
    },

    
__response: function( content ) {
        if ( 
content ) {
            
content this._normalizecontent );
        }
        
this._trigger"response"null, { contentcontent } );
        if ( !
this.options.disabled && content && content.length && !this.cancelSearch ) {
            
this._suggestcontent );
            
this._trigger"open" );
        } else {
            
// use ._close() instead of .close() so we don't cancel future searches
            
this._close();
        }
    },

    
close: function( event ) {
        
this.cancelSearch true;
        
this._closeevent );
    },

    
_close: function( event ) {
        if ( 
this.menu.element.is":visible" ) ) {
            
this.menu.element.hide();
            
this.menu.blur();
            
this.isNewMenu true;
            
this._trigger"close"event );
        }
    },

    
_change: function( event ) {
        if ( 
this.previous !== this._value() ) {
            
this._trigger"change"event, { itemthis.selectedItem } );
        }
    },

    
_normalize: function( items ) {
        
// assume all items have the right format when the first item is complete
        
if ( items.length && items[0].label && items[0].value ) {
            return 
items;
        }
        return $.
mapitems, function( item ) {
            if ( 
typeof item === "string" ) {
                return {
                    
labelitem,
                    
valueitem
                
};
            }
            return $.
extend({
                
labelitem.label || item.value,
                
valueitem.value || item.label
            
}, item );
        });
    },

    
_suggest: function( items ) {
        var 
ul this.menu.element.empty();
        
this._renderMenuulitems );
        
this.menu.refresh();

        
// size and position menu
        
ul.show();
        
this._resizeMenu();
        
ul.position( $.extend({
            
ofthis.element
        
}, this.options.position ));

        if ( 
this.options.autoFocus ) {
            
this.menu.next();
        }
    },

    
_resizeMenu: function() {
        var 
ul this.menu.element;
        
ul.outerWidthMath.max(
            
// Firefox wraps long text (possibly a rounding bug)
            // so we add 1px to avoid the wrapping (#7513)
            
ul.width"" ).outerWidth() + 1,
            
this.element.outerWidth()
        ) );
    },

    
_renderMenu: function( ulitems ) {
        var 
that this;
        $.
eachitems, function( indexitem ) {
            
that._renderItemDataulitem );
        });
    },

    
_renderItemData: function( ulitem ) {
        return 
this._renderItemulitem ).data"ui-autocomplete-item"item );
    },

    
_renderItem: function( ulitem ) {
        return $( 
"<li>" )
            .
append( $( "<a>" ).textitem.label ) )
            .
appendToul );
    },

    
_move: function( directionevent ) {
        if ( !
this.menu.element.is":visible" ) ) {
            
this.searchnullevent );
            return;
        }
        if ( 
this.menu.isFirstItem() && /^previous/.testdirection ) ||
                
this.menu.isLastItem() && /^next/.testdirection ) ) {
            
this._valuethis.term );
            
this.menu.blur();
            return;
        }
        
this.menudirection ]( event );
    },

    
widget: function() {
        return 
this.menu.element;
    },

    
_value: function() {
        return 
this.valueMethod.applythis.elementarguments );
    },

    
_keyEvent: function( keyEventevent ) {
        if ( !
this.isMultiLine || this.menu.element.is":visible" ) ) {
            
this._movekeyEventevent );

            
// prevents moving cursor to beginning/end of the text field in some browsers
            
event.preventDefault();
        }
    }
});

$.
extend( $.ui.autocomplete, {
    
escapeRegex: function( value ) {
        return 
value.replace(/[-[]{}()*+?.,\^$|#s]/g, "\$&");
    
},
    
filter: function(array, term) {
        var 
matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
        return $.
grep( array, function(value) {
            return 
matcher.testvalue.label || value.value || value );
        });
    }
});


// live region extension, adding a `messages` option
// NOTE: This is an experimental API. We are still investigating
// a full solution for string manipulation and internationalization.
$.widget"ui.autocomplete", $.ui.autocomplete, {
    
options: {
        
messages: {
            
noResults"No search results.",
            
results: function( amount ) {
                return 
amount + ( amount " results are" " result is" ) +
                    
" available, use up and down arrow keys to navigate.";
            }
        }
    },

    
__response: function( content ) {
        var 
message;
        
this._superApplyarguments );
        if ( 
this.options.disabled || this.cancelSearch ) {
            return;
        }
        if ( 
content && content.length ) {
            
message this.options.messages.resultscontent.length );
        } else {
            
message this.options.messages.noResults;
        }
        
this.liveRegion.textmessage );
    }
});

}( 
jQuery ));
(function( $, 
undefined ) {

var 
lastActivestartXPosstartYPosclickDragged,
    
baseClasses "ui-button ui-widget ui-state-default ui-corner-all",
    
stateClasses "ui-state-hover ui-state-active ",
    
typeClasses "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
    
formResetHandler = function() {
        var 
buttons = $( this ).find":ui-button" );
        
setTimeout(function() {
            
buttons.button"refresh" );
        }, 
);
    },
    
radioGroup = function( radio ) {
        var 
name radio.name,
            
form radio.form,
            
radios = $( [] );
        if ( 
name ) {
            
name name.replace( /'/g, "\'" );
            if ( form ) {
                radios = $( form ).find( "[name='" + name + "']" );
            } else {
                radios = $( "[name='" + name + "']", radio.ownerDocument )
                    .filter(function() {
                        return !this.form;
                    });
            }
        }
        return radios;
    };

$.widget( "ui.button", {
    version: "1.10.1",
    defaultElement: "<button>",
    options: {
        disabled: null,
        text: true,
        label: null,
        icons: {
            primary: null,
            secondary: null
        }
    },
    _create: function() {
        this.element.closest( "form" )
            .unbind( "reset" + this.eventNamespace )
            .bind( "reset" + this.eventNamespace, formResetHandler );

        if ( typeof this.options.disabled !== "boolean" ) {
            this.options.disabled = !!this.element.prop( "disabled" );
        } else {
            this.element.prop( "disabled", this.options.disabled );
        }

        this._determineButtonType();
        this.hasTitle = !!this.buttonElement.attr( "title" );

        var that = this,
            options = this.options,
            toggleButton = this.type === "checkbox" || this.type === "radio",
            activeClass = !toggleButton ? "ui-state-active" : "",
            focusClass = "ui-state-focus";

        if ( options.label === null ) {
            options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
        }

        this._hoverable( this.buttonElement );

        this.buttonElement
            .addClass( baseClasses )
            .attr( "role", "button" )
            .bind( "mouseenter" + this.eventNamespace, function() {
                if ( options.disabled ) {
                    return;
                }
                if ( this === lastActive ) {
                    $( this ).addClass( "ui-state-active" );
                }
            })
            .bind( "mouseleave" + this.eventNamespace, function() {
                if ( options.disabled ) {
                    return;
                }
                $( this ).removeClass( activeClass );
            })
            .bind( "click" + this.eventNamespace, function( event ) {
                if ( options.disabled ) {
                    event.preventDefault();
                    event.stopImmediatePropagation();
                }
            });

        this.element
            .bind( "focus" + this.eventNamespace, function() {
                // no need to check disabled, focus won'
t be triggered anyway
                that
.buttonElement.addClassfocusClass );
            })
            .
bind"blur" this.eventNamespace, function() {
                
that.buttonElement.removeClassfocusClass );
            });

        if ( 
toggleButton ) {
            
this.element.bind"change" this.eventNamespace, function() {
                if ( 
clickDragged ) {
                    return;
                }
                
that.refresh();
            });
            
// if mouse moves between mousedown and mouseup (drag) set clickDragged flag
            // prevents issue where button state changes but checkbox/radio checked state
            // does not in Firefox (see ticket #6970)
            
this.buttonElement
                
.bind"mousedown" this.eventNamespace, function( event ) {
                    if ( 
options.disabled ) {
                        return;
                    }
                    
clickDragged false;
                    
startXPos event.pageX;
                    
startYPos event.pageY;
                })
                .
bind"mouseup" this.eventNamespace, function( event ) {
                    if ( 
options.disabled ) {
                        return;
                    }
                    if ( 
startXPos !== event.pageX || startYPos !== event.pageY ) {
                        
clickDragged true;
                    }
            });
        }

        if ( 
this.type === "checkbox" ) {
            
this.buttonElement.bind"click" this.eventNamespace, function() {
                if ( 
options.disabled || clickDragged ) {
                    return 
false;
                }
            });
        } else if ( 
this.type === "radio" ) {
            
this.buttonElement.bind"click" this.eventNamespace, function() {
                if ( 
options.disabled || clickDragged ) {
                    return 
false;
                }
                $( 
this ).addClass"ui-state-active" );
                
that.buttonElement.attr"aria-pressed""true" );

                var 
radio that.element];
                
radioGroupradio )
                    .
notradio )
                    .
map(function() {
                        return $( 
this ).button"widget" )[ ];
                    })
                    .
removeClass"ui-state-active" )
                    .
attr"aria-pressed""false" );
            });
        } else {
            
this.buttonElement
                
.bind"mousedown" this.eventNamespace, function() {
                    if ( 
options.disabled ) {
                        return 
false;
                    }
                    $( 
this ).addClass"ui-state-active" );
                    
lastActive this;
                    
that.document.one"mouseup", function() {
                        
lastActive null;
                    });
                })
                .
bind"mouseup" this.eventNamespace, function() {
                    if ( 
options.disabled ) {
                        return 
false;
                    }
                    $( 
this ).removeClass"ui-state-active" );
                })
                .
bind"keydown" this.eventNamespace, function(event) {
                    if ( 
options.disabled ) {
                        return 
false;
                    }
                    if ( 
event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
                        $( 
this ).addClass"ui-state-active" );
                    }
                })
                
// see #8559, we bind to blur here in case the button element loses
                // focus between keydown and keyup, it would be left in an "active" state
                
.bind"keyup" this.eventNamespace " blur" this.eventNamespace, function() {
                    $( 
this ).removeClass"ui-state-active" );
                });

            if ( 
this.buttonElement.is("a") ) {
                
this.buttonElement.keyup(function(event) {
                    if ( 
event.keyCode === $.ui.keyCode.SPACE ) {
                        
// TODO pass through original event correctly (just as 2nd argument doesn't work)
                        
$( this ).click();
                    }
                });
            }
        }

        
// TODO: pull out $.Widget's handling for the disabled option into
        // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
        // be overridden by individual plugins
        
this._setOption"disabled"options.disabled );
        
this._resetButton();
    },

    
_determineButtonType: function() {
        var 
ancestorlabelSelectorchecked;

        if ( 
this.element.is("[type=checkbox]") ) {
            
this.type "checkbox";
        } else if ( 
this.element.is("[type=radio]") ) {
            
this.type "radio";
        } else if ( 
this.element.is("input") ) {
            
this.type "input";
        } else {
            
this.type "button";
        }

        if ( 
this.type === "checkbox" || this.type === "radio" ) {
            
// we don't search against the document in case the element
            // is disconnected from the DOM
            
ancestor this.element.parents().last();
            
labelSelector "label[for='" this.element.attr("id") + "']";
            
this.buttonElement ancestor.findlabelSelector );
            if ( !
this.buttonElement.length ) {
                
ancestor ancestor.length ancestor.siblings() : this.element.siblings();
                
this.buttonElement ancestor.filterlabelSelector );
                if ( !
this.buttonElement.length ) {
                    
this.buttonElement ancestor.findlabelSelector );
                }
            }
            
this.element.addClass"ui-helper-hidden-accessible" );

            
checked this.element.is":checked" );
            if ( 
checked ) {
                
this.buttonElement.addClass"ui-state-active" );
            }
            
this.buttonElement.prop"aria-pressed"checked );
        } else {
            
this.buttonElement this.element;
        }
    },

    
widget: function() {
        return 
this.buttonElement;
    },

    
_destroy: function() {
        
this.element
            
.removeClass"ui-helper-hidden-accessible" );
        
this.buttonElement
            
.removeClassbaseClasses " " stateClasses " " typeClasses )
            .
removeAttr"role" )
            .
removeAttr"aria-pressed" )
            .
htmlthis.buttonElement.find(".ui-button-text").html() );

        if ( !
this.hasTitle ) {
            
this.buttonElement.removeAttr"title" );
        }
    },

    
_setOption: function( keyvalue ) {
        
this._superkeyvalue );
        if ( 
key === "disabled" ) {
            if ( 
value ) {
                
this.element.prop"disabled"true );
            } else {
                
this.element.prop"disabled"false );
            }
            return;
        }
        
this._resetButton();
    },

    
refresh: function() {
        
//See #8237 & #8828
        
var isDisabled this.element.is"input, button" ) ? this.element.is":disabled" ) : this.element.hasClass"ui-button-disabled" );

        if ( 
isDisabled !== this.options.disabled ) {
            
this._setOption"disabled"isDisabled );
        }
        if ( 
this.type === "radio" ) {
            
radioGroupthis.element[0] ).each(function() {
                if ( $( 
this ).is":checked" ) ) {
                    $( 
this ).button"widget" )
                        .
addClass"ui-state-active" )
                        .
attr"aria-pressed""true" );
                } else {
                    $( 
this ).button"widget" )
                        .
removeClass"ui-state-active" )
                        .
attr"aria-pressed""false" );
                }
            });
        } else if ( 
this.type === "checkbox" ) {
            if ( 
this.element.is":checked" ) ) {
                
this.buttonElement
                    
.addClass"ui-state-active" )
                    .
attr"aria-pressed""true" );
            } else {
                
this.buttonElement
                    
.removeClass"ui-state-active" )
                    .
attr"aria-pressed""false" );
            }
        }
    },

    
_resetButton: function() {
        if ( 
this.type === "input" ) {
            if ( 
this.options.label ) {
                
this.element.valthis.options.label );
            }
            return;
        }
        var 
buttonElement this.buttonElement.removeClasstypeClasses ),
            
buttonText = $( "<span></span>"this.document[0] )
                .
addClass"ui-button-text" )
                .
htmlthis.options.label )
                .
appendTobuttonElement.empty() )
                .
text(),
            
icons this.options.icons,
            
multipleIcons icons.primary && icons.secondary,
            
buttonClasses = [];

        if ( 
icons.primary || icons.secondary ) {
            if ( 
this.options.text ) {
                
buttonClasses.push"ui-button-text-icon" + ( multipleIcons "s" : ( icons.primary "-primary" "-secondary" ) ) );
            }

            if ( 
icons.primary ) {
                
buttonElement.prepend"<span class='ui-button-icon-primary ui-icon " icons.primary "'></span>" );
            }

            if ( 
icons.secondary ) {
                
buttonElement.append"<span class='ui-button-icon-secondary ui-icon " icons.secondary "'></span>" );
            }

            if ( !
this.options.text ) {
                
buttonClasses.pushmultipleIcons "ui-button-icons-only" "ui-button-icon-only" );

                if ( !
this.hasTitle ) {
                    
buttonElement.attr"title", $.trimbuttonText ) );
                }
            }
        } else {
            
buttonClasses.push"ui-button-text-only" );
        }
        
buttonElement.addClassbuttonClasses.join" " ) );
    }
});

$.
widget"ui.buttonset", {
    
version"1.10.1",
    
options: {
        
items"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
    
},

    
_create: function() {
        
this.element.addClass"ui-buttonset" );
    },

    
_init: function() {
        
this.refresh();
    },

    
_setOption: function( keyvalue ) {
        if ( 
key === "disabled" ) {
            
this.buttons.button"option"keyvalue );
        }

        
this._superkeyvalue );
    },

    
refresh: function() {
        var 
rtl this.element.css"direction" ) === "rtl";

        
this.buttons this.element.findthis.options.items )
            .
filter":ui-button" )
                .
button"refresh" )
            .
end()
            .
not":ui-button" )
                .
button()
            .
end()
            .
map(function() {
                return $( 
this ).button"widget" )[ ];
            })
                .
removeClass"ui-corner-all ui-corner-left ui-corner-right" )
                .
filter":first" )
                    .
addClassrtl "ui-corner-right" "ui-corner-left" )
                .
end()
                .
filter":last" )
                    .
addClassrtl "ui-corner-left" "ui-corner-right" )
                .
end()
            .
end();
    },

    
_destroy: function() {
        
this.element.removeClass"ui-buttonset" );
        
this.buttons
            
.map(function() {
                return $( 
this ).button"widget" )[ ];
            })
                .
removeClass"ui-corner-left ui-corner-right" )
            .
end()
            .
button"destroy" );
    }
});

}( 
jQuery ) );
(function( $, 
undefined ) {

$.
extend($.ui, { datepicker: { version"1.10.1" } });

var 
PROP_NAME "datepicker",
    
dpuuid = new Date().getTime(),
    
instActive;

/* Date picker manager.
   Use the singleton instance of this class, $.datepicker, to interact with the date picker.
   Settings for (groups of) date pickers are maintained in an instance object,
   allowing multiple different settings on the same page. */

function Datepicker() {
    
this._curInst null// The current instance in use
    
this._keyEvent false// If the last event was a key event
    
this._disabledInputs = []; // List of date picker inputs that have been disabled
    
this._datepickerShowing false// True if the popup picker is showing , false if not
    
this._inDialog false// True if showing within a "dialog", false if not
    
this._mainDivId "ui-datepicker-div"// The ID of the main datepicker division
    
this._inlineClass "ui-datepicker-inline"// The name of the inline marker class
    
this._appendClass "ui-datepicker-append"// The name of the append marker class
    
this._triggerClass "ui-datepicker-trigger"// The name of the trigger marker class
    
this._dialogClass "ui-datepicker-dialog"// The name of the dialog marker class
    
this._disableClass "ui-datepicker-disabled"// The name of the disabled covering marker class
    
this._unselectableClass "ui-datepicker-unselectable"// The name of the unselectable cell marker class
    
this._currentClass "ui-datepicker-current-day"// The name of the current day marker class
    
this._dayOverClass "ui-datepicker-days-cell-over"// The name of the day hover marker class
    
this.regional = []; // Available regional settings, indexed by language code
    
this.regional[""] = { // Default regional settings
        
closeText"Done"// Display text for close link
        
prevText"Prev"// Display text for previous month link
        
nextText"Next"// Display text for next month link
        
currentText"Today"// Display text for current month link
        
monthNames: ["January","February","March","April","May","June",
            
"July","August","September","October","November","December"], // Names of months for drop-down and formatting
        
monthNamesShort: ["Jan""Feb""Mar""Apr""May""Jun""Jul""Aug""Sep""Oct""Nov""Dec"], // For formatting
        
dayNames: ["Sunday""Monday""Tuesday""Wednesday""Thursday""Friday""Saturday"], // For formatting
        
dayNamesShort: ["Sun""Mon""Tue""Wed""Thu""Fri""Sat"], // For formatting
        
dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"], // Column headings for days starting at Sunday
        
weekHeader"Wk"// Column header for week of the year
        
dateFormat"mm/dd/yy"// See format options on parseDate
        
firstDay0// The first day of the week, Sun = 0, Mon = 1, ...
        
isRTLfalse// True if right-to-left language, false if left-to-right
        
showMonthAfterYearfalse// True if the year select precedes month, false for month then year
        
yearSuffix"" // Additional text to append to the year in the month headers
    
};
    
this._defaults = { // Global defaults for all the date picker instances
        
showOn"focus"// "focus" for popup on focus,
            // "button" for trigger button, or "both" for either
        
showAnim"fadeIn"// Name of jQuery animation for popup
        
showOptions: {}, // Options for enhanced animations
        
defaultDatenull// Used when field is blank: actual date,
            // +/-number for offset from today, null for today
        
appendText""// Display text following the input box, e.g. showing the format
        
buttonText"..."// Text for trigger button
        
buttonImage""// URL for trigger button image
        
buttonImageOnlyfalse// True if the image appears alone, false if it appears on a button
        
hideIfNoPrevNextfalse// True to hide next/previous month links
            // if not applicable, false to just disable them
        
navigationAsDateFormatfalse// True if date formatting applied to prev/today/next links
        
gotoCurrentfalse// True if today link goes back to current selection instead
        
changeMonthfalse// True if month can be selected directly, false if only prev/next
        
changeYearfalse// True if year can be selected directly, false if only prev/next
        
yearRange"c-10:c+10"// Range of years to display in drop-down,
            // either relative to today's year (-nn:+nn), relative to currently displayed year
            // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
        
showOtherMonthsfalse// True to show dates in other months, false to leave blank
        
selectOtherMonthsfalse// True to allow selection of dates in other months, false for unselectable
        
showWeekfalse// True to show week of the year, false to not show it
        
calculateWeekthis.iso8601Week// How to calculate the week of the year,
            // takes a Date and returns the number of the week for it
        
shortYearCutoff"+10"// Short year values < this are in the current century,
            // > this are in the previous century,
            // string value starting with "+" for current year + value
        
minDatenull// The earliest selectable date, or null for no limit
        
maxDatenull// The latest selectable date, or null for no limit
        
duration"fast"// Duration of display/closure
        
beforeShowDaynull// Function that takes a date and returns an array with
            // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
            // [2] = cell title (optional), e.g. $.datepicker.noWeekends
        
beforeShownull// Function that takes an input field and
            // returns a set of custom settings for the date picker
        
onSelectnull// Define a callback function when a date is selected
        
onChangeMonthYearnull// Define a callback function when the month or year is changed
        
onClosenull// Define a callback function when the datepicker is closed
        
numberOfMonths1// Number of months to show at a time
        
showCurrentAtPos0// The position in multipe months at which to show the current month (starting at 0)
        
stepMonths1// Number of months to step back/forward
        
stepBigMonths12// Number of months to step back/forward for the big links
        
altField""// Selector for an alternate field to store selected dates into
        
altFormat""// The date format to use for the alternate field
        
constrainInputtrue// The input is constrained by the current date format
        
showButtonPanelfalse// True to show button panel, false to not show it
        
autoSizefalse// True to size the input for the date format, false to leave as is
        
disabledfalse // The initial disabled state
    
};
    $.
extend(this._defaultsthis.regional[""]);
    
this.dpDiv bindHover($("<div id='" this._mainDivId "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));
}

$.
extend(Datepicker.prototype, {
    
/* Class name added to elements to indicate already configured with a date picker. */
    
markerClassName"hasDatepicker",

    
//Keep track of the maximum number of rows displayed (see #7043)
    
maxRows4,

    
// TODO rename to "widget" when switching to widget factory
    
_widgetDatepicker: function() {
        return 
this.dpDiv;
    },

    
/* Override the default settings for all instances of the date picker.
     * @param  settings  object - the new settings to use as defaults (anonymous object)
     * @return the manager object
     */
    
setDefaults: function(settings) {
        
extendRemove(this._defaultssettings || {});
        return 
this;
    },

    
/* Attach the date picker to a jQuery selection.
     * @param  target    element - the target input field or division or span
     * @param  settings  object - the new settings to use for this date picker instance (anonymous)
     */
    
_attachDatepicker: function(targetsettings) {
        var 
nodeNameinlineinst;
        
nodeName target.nodeName.toLowerCase();
        
inline = (nodeName === "div" || nodeName === "span");
        if (!
target.id) {
            
this.uuid += 1;
            
target.id "dp" this.uuid;
        }
        
inst this._newInst($(target), inline);
        
inst.settings = $.extend({}, settings || {});
        if (
nodeName === "input") {
            
this._connectDatepicker(targetinst);
        } else if (
inline) {
            
this._inlineDatepicker(targetinst);
        }
    },

    
/* Create a new instance object. */
    
_newInst: function(targetinline) {
        var 
id target[0].id.replace(/([^A-Za-z0-9_-])/g"\\$1"); // escape jQuery meta chars
        
return {ididinputtarget// associated target
            
selectedDay0selectedMonth0selectedYear0// current selection
            
drawMonth0drawYear0// month being drawn
            
inlineinline// is datepicker inline or not
            
dpDiv: (!inline this.dpDiv // presentation div
            
bindHover($("<div class='" this._inlineClass " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))};
    },

    
/* Attach the date picker to an input field. */
    
_connectDatepicker: function(targetinst) {
        var 
input = $(target);
        
inst.append = $([]);
        
inst.trigger = $([]);
        if (
input.hasClass(this.markerClassName)) {
            return;
        }
        
this._attachments(inputinst);
        
input.addClass(this.markerClassName).keydown(this._doKeyDown).
            
keypress(this._doKeyPress).keyup(this._doKeyUp);
        
this._autoSize(inst);
        $.
data(targetPROP_NAMEinst);
        
//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
        
if( inst.settings.disabled ) {
            
this._disableDatepickertarget );
        }
    },

    
/* Make attachments based on settings. */
    
_attachments: function(inputinst) {
        var 
showOnbuttonTextbuttonImage,
            
appendText this._get(inst"appendText"),
            
isRTL this._get(inst"isRTL");

        if (
inst.append) {
            
inst.append.remove();
        }
        if (
appendText) {
            
inst.append = $("<span class='" this._appendClass "'>" appendText "</span>");
            
input[isRTL "before" "after"](inst.append);
        }

        
input.unbind("focus"this._showDatepicker);

        if (
inst.trigger) {
            
inst.trigger.remove();
        }

        
showOn this._get(inst"showOn");
        if (
showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field
            
input.focus(this._showDatepicker);
        }
        if (
showOn === "button" || showOn === "both") { // pop-up date picker when button clicked
            
buttonText this._get(inst"buttonText");
            
buttonImage this._get(inst"buttonImage");
            
inst.trigger = $(this._get(inst"buttonImageOnly") ?
                $(
"<img/>").addClass(this._triggerClass).
                    
attr({ srcbuttonImagealtbuttonTexttitlebuttonText }) :
                $(
"<button type='button'></button>").addClass(this._triggerClass).
                    
html(!buttonImage buttonText : $("<img/>").attr(
                    { 
src:buttonImagealt:buttonTexttitle:buttonText })));
            
input[isRTL "before" "after"](inst.trigger);
            
inst.trigger.click(function() {
                if ($.
datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) {
                    $.
datepicker._hideDatepicker();
                } else if ($.
datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) {
                    $.
datepicker._hideDatepicker();
                    $.
datepicker._showDatepicker(input[0]);
                } else {
                    $.
datepicker._showDatepicker(input[0]);
                }
                return 
false;
            });
        }
    },

    
/* Apply the maximum length for the date format. */
    
_autoSize: function(inst) {
        if (
this._get(inst"autoSize") && !inst.inline) {
            var 
findMaxmaxmaxIi,
                
date = new Date(200912 120), // Ensure double digits
                
dateFormat this._get(inst"dateFormat");

            if (
dateFormat.match(/[DM]/)) {
                
findMax = function(names) {
                    
max 0;
                    
maxI 0;
                    for (
0names.lengthi++) {
                        if (
names[i].length max) {
                            
max names[i].length;
                            
maxI i;
                        }
                    }
                    return 
maxI;
                };
                
date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
                    
"monthNames" "monthNamesShort"))));
                
date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
                    
"dayNames" "dayNamesShort"))) + 20 date.getDay());
            }
            
inst.input.attr("size"this._formatDate(instdate).length);
        }
    },

    
/* Attach an inline date picker to a div. */
    
_inlineDatepicker: function(targetinst) {
        var 
divSpan = $(target);
        if (
divSpan.hasClass(this.markerClassName)) {
            return;
        }
        
divSpan.addClass(this.markerClassName).append(inst.dpDiv);
        $.
data(targetPROP_NAMEinst);
        
this._setDate(instthis._getDefaultDate(inst), true);
        
this._updateDatepicker(inst);
        
this._updateAlternate(inst);
        
//If disabled option is true, disable the datepicker before showing it (see ticket #5665)
        
if( inst.settings.disabled ) {
            
this._disableDatepickertarget );
        }
        
// Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
        // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
        
inst.dpDiv.css"display""block" );
    },

    
/* Pop-up the date picker in a "dialog" box.
     * @param  input element - ignored
     * @param  date    string or Date - the initial date to display
     * @param  onSelect  function - the function to call when a date is selected
     * @param  settings  object - update the dialog date picker instance's settings (anonymous object)
     * @param  pos int[2] - coordinates for the dialog's position within the screen or
     *                    event - with x/y coordinates or
     *                    leave empty for default (screen centre)
     * @return the manager object
     */
    
_dialogDatepicker: function(inputdateonSelectsettingspos) {
        var 
idbrowserWidthbrowserHeightscrollXscrollY,
            
inst this._dialogInst// internal instance

        
if (!inst) {
            
this.uuid += 1;
            
id "dp" this.uuid;
            
this._dialogInput = $("<input type='text' id='" id +
                
"' style='position: absolute; top: -100px; width: 0px;'/>");
            
this._dialogInput.keydown(this._doKeyDown);
            $(
"body").append(this._dialogInput);
            
inst this._dialogInst this._newInst(this._dialogInputfalse);
            
inst.settings = {};
            $.
data(this._dialogInput[0], PROP_NAMEinst);
        }
        
extendRemove(inst.settingssettings || {});
        
date = (date && date.constructor === Date this._formatDate(instdate) : date);
        
this._dialogInput.val(date);

        
this._pos = (pos ? (pos.length pos : [pos.pageXpos.pageY]) : null);
        if (!
this._pos) {
            
browserWidth document.documentElement.clientWidth;
            
browserHeight document.documentElement.clientHeight;
            
scrollX document.documentElement.scrollLeft || document.body.scrollLeft;
            
scrollY document.documentElement.scrollTop || document.body.scrollTop;
            
this._pos // should use actual width/height below
                
[(browserWidth 2) - 100 scrollX, (browserHeight 2) - 150 scrollY];
        }

        
// move input on screen for focus, but hidden behind dialog
        
this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top"this._pos[1] + "px");
        
inst.settings.onSelect onSelect;
        
this._inDialog true;
        
this.dpDiv.addClass(this._dialogClass);
        
this._showDatepicker(this._dialogInput[0]);
        if ($.
blockUI) {
            $.
blockUI(this.dpDiv);
        }
        $.
data(this._dialogInput[0], PROP_NAMEinst);
        return 
this;
    },

    
/* Detach a datepicker from its control.
     * @param  target    element - the target input field or division or span
     */
    
_destroyDatepicker: function(target) {
        var 
nodeName,
            
$target = $(target),
            
inst = $.data(targetPROP_NAME);

        if (!
$target.hasClass(this.markerClassName)) {
            return;
        }

        
nodeName target.nodeName.toLowerCase();
        $.
removeData(targetPROP_NAME);
        if (
nodeName === "input") {
            
inst.append.remove();
            
inst.trigger.remove();
            
$target.removeClass(this.markerClassName).
                
unbind("focus"this._showDatepicker).
                
unbind("keydown"this._doKeyDown).
                
unbind("keypress"this._doKeyPress).
                
unbind("keyup"this._doKeyUp);
        } else if (
nodeName === "div" || nodeName === "span") {
            
$target.removeClass(this.markerClassName).empty();
        }
    },

    
/* Enable the date picker to a jQuery selection.
     * @param  target    element - the target input field or division or span
     */
    
_enableDatepicker: function(target) {
        var 
nodeNameinline,
            
$target = $(target),
            
inst = $.data(targetPROP_NAME);

        if (!
$target.hasClass(this.markerClassName)) {
            return;
        }

        
nodeName target.nodeName.toLowerCase();
        if (
nodeName === "input") {
            
target.disabled false;
            
inst.trigger.filter("button").
                
each(function() { this.disabled false; }).end().
                
filter("img").css({opacity"1.0"cursor""});
        } else if (
nodeName === "div" || nodeName === "span") {
            
inline $target.children("." this._inlineClass);
            
inline.children().removeClass("ui-state-disabled");
            
inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
                
prop("disabled"false);
        }
        
this._disabledInputs = $.map(this._disabledInputs,
            function(
value) { return (value === target null value); }); // delete entry
    
},

    
/* Disable the date picker to a jQuery selection.
     * @param  target    element - the target input field or division or span
     */
    
_disableDatepicker: function(target) {
        var 
nodeNameinline,
            
$target = $(target),
            
inst = $.data(targetPROP_NAME);

        if (!
$target.hasClass(this.markerClassName)) {
            return;
        }

        
nodeName target.nodeName.toLowerCase();
        if (
nodeName === "input") {
            
target.disabled true;
            
inst.trigger.filter("button").
                
each(function() { this.disabled true; }).end().
                
filter("img").css({opacity"0.5"cursor"default"});
        } else if (
nodeName === "div" || nodeName === "span") {
            
inline $target.children("." this._inlineClass);
            
inline.children().addClass("ui-state-disabled");
            
inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
                
prop("disabled"true);
        }
        
this._disabledInputs = $.map(this._disabledInputs,
            function(
value) { return (value === target null value); }); // delete entry
        
this._disabledInputs[this._disabledInputs.length] = target;
    },

    
/* Is the first field in a jQuery collection disabled as a datepicker?
     * @param  target    element - the target input field or division or span
     * @return boolean - true if disabled, false if enabled
     */
    
_isDisabledDatepicker: function(target) {
        if (!
target) {
            return 
false;
        }
        for (var 
0this._disabledInputs.lengthi++) {
            if (
this._disabledInputs[i] === target) {
                return 
true;
            }
        }
        return 
false;
    },

    
/* Retrieve the instance data for the target control.
     * @param  target  element - the target input field or division or span
     * @return  object - the associated instance data
     * @throws  error if a jQuery problem getting data
     */
    
_getInst: function(target) {
        try {
            return $.
data(targetPROP_NAME);
        }
        catch (
err) {
            throw 
"Missing instance data for this datepicker";
        }
    },

    
/* Update or retrieve the settings for a date picker attached to an input field or division.
     * @param  target  element - the target input field or division or span
     * @param  name    object - the new settings to update or
     *                string - the name of the setting to change or retrieve,
     *                when retrieving also "all" for all instance settings or
     *                "defaults" for all global defaults
     * @param  value   any - the new value for the setting
     *                (omit if above is an object or to retrieve a value)
     */
    
_optionDatepicker: function(targetnamevalue) {
        var 
settingsdateminDatemaxDate,
            
inst this._getInst(target);

        if (
arguments.length === && typeof name === "string") {
            return (
name === "defaults" ? $.extend({}, $.datepicker._defaults) :
                (
inst ? (name === "all" ? $.extend({}, inst.settings) :
                
this._get(instname)) : null));
        }

        
settings name || {};
        if (
typeof name === "string") {
            
settings = {};
            
settings[name] = value;
        }

        if (
inst) {
            if (
this._curInst === inst) {
                
this._hideDatepicker();
            }

            
date this._getDateDatepicker(targettrue);
            
minDate this._getMinMaxDate(inst"min");
            
maxDate this._getMinMaxDate(inst"max");
            
extendRemove(inst.settingssettings);
            
// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
            
if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
                
inst.settings.minDate this._formatDate(instminDate);
            }
            if (
maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) {
                
inst.settings.maxDate this._formatDate(instmaxDate);
            }
            if ( 
"disabled" in settings ) {
                if ( 
settings.disabled ) {
                    
this._disableDatepicker(target);
                } else {
                    
this._enableDatepicker(target);
                }
            }
            
this._attachments($(target), inst);
            
this._autoSize(inst);
            
this._setDate(instdate);
            
this._updateAlternate(inst);
            
this._updateDatepicker(inst);
        }
    },

    
// change method deprecated
    
_changeDatepicker: function(targetnamevalue) {
        
this._optionDatepicker(targetnamevalue);
    },

    
/* Redraw the date picker attached to an input field or division.
     * @param  target  element - the target input field or division or span
     */
    
_refreshDatepicker: function(target) {
        var 
inst this._getInst(target);
        if (
inst) {
            
this._updateDatepicker(inst);
        }
    },

    
/* Set the dates for a jQuery selection.
     * @param  target element - the target input field or division or span
     * @param  date    Date - the new date
     */
    
_setDateDatepicker: function(targetdate) {
        var 
inst this._getInst(target);
        if (
inst) {
            
this._setDate(instdate);
            
this._updateDatepicker(inst);
            
this._updateAlternate(inst);
        }
    },

    
/* Get the date(s) for the first entry in a jQuery selection.
     * @param  target element - the target input field or division or span
     * @param  noDefault boolean - true if no default date is to be used
     * @return Date - the current date
     */
    
_getDateDatepicker: function(targetnoDefault) {
        var 
inst this._getInst(target);
        if (
inst && !inst.inline) {
            
this._setDateFromField(instnoDefault);
        }
        return (
inst this._getDate(inst) : null);
    },

    
/* Handle keystrokes. */
    
_doKeyDown: function(event) {
        var 
onSelectdateStrsel,
            
inst = $.datepicker._getInst(event.target),
            
handled true,
            
isRTL inst.dpDiv.is(".ui-datepicker-rtl");

        
inst._keyEvent true;
        if ($.
datepicker._datepickerShowing) {
            switch (
event.keyCode) {
                case 
9: $.datepicker._hideDatepicker();
                        
handled false;
                        break; 
// hide on tab out
                
case 13sel = $("td." + $.datepicker._dayOverClass ":not(." +
                                    $.
datepicker._currentClass ")"inst.dpDiv);
                        if (
sel[0]) {
                            $.
datepicker._selectDay(event.targetinst.selectedMonthinst.selectedYearsel[0]);
                        }

                        
onSelect = $.datepicker._get(inst"onSelect");
                        if (
onSelect) {
                            
dateStr = $.datepicker._formatDate(inst);

                            
// trigger custom callback
                            
onSelect.apply((inst.input inst.input[0] : null), [dateStrinst]);
                        } else {
                            $.
datepicker._hideDatepicker();
                        }

                        return 
false// don't submit the form
                
case 27: $.datepicker._hideDatepicker();
                        break; 
// hide on escape
                
case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
                            -$.
datepicker._get(inst"stepBigMonths") :
                            -$.
datepicker._get(inst"stepMonths")), "M");
                        break; 
// previous month/year on page up/+ ctrl
                
case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
                            +$.
datepicker._get(inst"stepBigMonths") :
                            +$.
datepicker._get(inst"stepMonths")), "M");
                        break; 
// next month/year on page down/+ ctrl
                
case 35: if (event.ctrlKey || event.metaKey) {
                            $.
datepicker._clearDate(event.target);
                        }
                        
handled event.ctrlKey || event.metaKey;
                        break; 
// clear on ctrl or command +end
                
case 36: if (event.ctrlKey || event.metaKey) {
                            $.
datepicker._gotoToday(event.target);
                        }
                        
handled event.ctrlKey || event.metaKey;
                        break; 
// current on ctrl or command +home
                
case 37: if (event.ctrlKey || event.metaKey) {
                            $.
datepicker._adjustDate(event.target, (isRTL ? +: -1), "D");
                        }
                        
handled event.ctrlKey || event.metaKey;
                        
// -1 day on ctrl or command +left
                        
if (event.originalEvent.altKey) {
                            $.
datepicker._adjustDate(event.target, (event.ctrlKey ?
                                -$.
datepicker._get(inst"stepBigMonths") :
                                -$.
datepicker._get(inst"stepMonths")), "M");
                        }
                        
// next month/year on alt +left on Mac
                        
break;
                case 
38: if (event.ctrlKey || event.metaKey) {
                            $.
datepicker._adjustDate(event.target, -7"D");
                        }
                        
handled event.ctrlKey || event.metaKey;
                        break; 
// -1 week on ctrl or command +up
                
case 39: if (event.ctrlKey || event.metaKey) {
                            $.
datepicker._adjustDate(event.target, (isRTL ? -: +1), "D");
                        }
                        
handled event.ctrlKey || event.metaKey;
                        
// +1 day on ctrl or command +right
                        
if (event.originalEvent.altKey) {
                            $.
datepicker._adjustDate(event.target, (event.ctrlKey ?
                                +$.
datepicker._get(inst"stepBigMonths") :
                                +$.
datepicker._get(inst"stepMonths")), "M");
                        }
                        
// next month/year on alt +right
                        
break;
                case 
40: if (event.ctrlKey || event.metaKey) {
                            $.
datepicker._adjustDate(event.target, +7"D");
                        }
                        
handled event.ctrlKey || event.metaKey;
                        break; 
// +1 week on ctrl or command +down
                
default: handled false;
            }
        } else if (
event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home
            
$.datepicker._showDatepicker(this);
        } else {
            
handled false;
        }

        if (
handled) {
            
event.preventDefault();
            
event.stopPropagation();
        }
    },

    
/* Filter entered characters - based on date format. */
    
_doKeyPress: function(event) {
        var 
charschr,
            
inst = $.datepicker._getInst(event.target);

        if ($.
datepicker._get(inst"constrainInput")) {
            
chars = $.datepicker._possibleChars($.datepicker._get(inst"dateFormat"));
            
chr String.fromCharCode(event.charCode == null event.keyCode event.charCode);
            return 
event.ctrlKey || event.metaKey || (chr " " || !chars || chars.indexOf(chr) > -1);
        }
    },

    
/* Synchronise manual entry and field/alternate field. */
    
_doKeyUp: function(event) {
        var 
date,
            
inst = $.datepicker._getInst(event.target);

        if (
inst.input.val() !== inst.lastVal) {
            try {
                
date = $.datepicker.parseDate($.datepicker._get(inst"dateFormat"),
                    (
inst.input inst.input.val() : null),
                    $.
datepicker._getFormatConfig(inst));

                if (
date) { // only if valid
                    
$.datepicker._setDateFromField(inst);
                    $.
datepicker._updateAlternate(inst);
                    $.
datepicker._updateDatepicker(inst);
                }
            }
            catch (
err) {
            }
        }
        return 
true;
    },

    
/* Pop-up the date picker for a given input field.
     * If false returned from beforeShow event handler do not show.
     * @param  input  element - the input field attached to the date picker or
     *                    event - if triggered by focus
     */
    
_showDatepicker: function(input) {
        
input input.target || input;
        if (
input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
            
input = $("input"input.parentNode)[0];
        }

        if ($.
datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here
            
return;
        }

        var 
instbeforeShowbeforeShowSettingsisFixed,
            
offsetshowAnimduration;

        
inst = $.datepicker._getInst(input);
        if ($.
datepicker._curInst && $.datepicker._curInst !== inst) {
            $.
datepicker._curInst.dpDiv.stop(truetrue);
            if ( 
inst && $.datepicker._datepickerShowing ) {
                $.
datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
            }
        }

        
beforeShow = $.datepicker._get(inst"beforeShow");
        
beforeShowSettings beforeShow beforeShow.apply(input, [inputinst]) : {};
        if(
beforeShowSettings === false){
            return;
        }
        
extendRemove(inst.settingsbeforeShowSettings);

        
inst.lastVal null;
        $.
datepicker._lastInput input;
        $.
datepicker._setDateFromField(inst);

        if ($.
datepicker._inDialog) { // hide cursor
            
input.value "";
        }
        if (!$.
datepicker._pos) { // position below input
            
$.datepicker._pos = $.datepicker._findPos(input);
            $.
datepicker._pos[1] += input.offsetHeight// add the height
        
}

        
isFixed false;
        $(
input).parents().each(function() {
            
isFixed |= $(this).css("position") === "fixed";
            return !
isFixed;
        });

        
offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
        $.
datepicker._pos null;
        
//to avoid flashes on Firefox
        
inst.dpDiv.empty();
        
// determine sizing offscreen
        
inst.dpDiv.css({position"absolute"display"block"top"-1000px"});
        $.
datepicker._updateDatepicker(inst);
        
// fix width for dynamic number of date pickers
        // and adjust position before showing
        
offset = $.datepicker._checkOffset(instoffsetisFixed);
        
inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
            
"static" : (isFixed "fixed" "absolute")), display"none",
            
leftoffset.left "px"topoffset.top "px"});

        if (!
inst.inline) {
            
showAnim = $.datepicker._get(inst"showAnim");
            
duration = $.datepicker._get(inst"duration");
            
inst.dpDiv.zIndex($(input).zIndex()+1);
            $.
datepicker._datepickerShowing true;

            if ( $.
effects && $.effects.effectshowAnim ] ) {
                
inst.dpDiv.show(showAnim, $.datepicker._get(inst"showOptions"), duration);
            } else {
                
inst.dpDiv[showAnim || "show"](showAnim duration null);
            }

            if (
inst.input.is(":visible") && !inst.input.is(":disabled")) {
                
inst.input.focus();
            }
            $.
datepicker._curInst inst;
        }
    },

    
/* Generate the date picker content. */
    
_updateDatepicker: function(inst) {
        
this.maxRows 4//Reset the max number of rows being displayed (see #7043)
        
instActive inst// for delegate hover events
        
inst.dpDiv.empty().append(this._generateHTML(inst));
        
this._attachHandlers(inst);
        
inst.dpDiv.find("." this._dayOverClass " a").mouseover();

        var 
origyearshtml,
            
numMonths this._getNumberOfMonths(inst),
            
cols numMonths[1],
            
width 17;

        
inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
        if (
cols 1) {
            
inst.dpDiv.addClass("ui-datepicker-multi-" cols).css("width", (width cols) + "em");
        }
        
inst.dpDiv[(numMonths[0] !== || numMonths[1] !== "add" "remove") +
            
"Class"]("ui-datepicker-multi");
        
inst.dpDiv[(this._get(inst"isRTL") ? "add" "remove") +
            
"Class"]("ui-datepicker-rtl");

        
// #6694 - don't focus the input if it's already focused
        // this breaks the change event in IE
        
if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
            
inst.input.is(":visible") && !inst.input.is(":disabled") && inst.input[0] !== document.activeElement) {
            
inst.input.focus();
        }

        
// deffered render of the years select (to avoid flashes on Firefox)
        
if( inst.yearshtml ){
            
origyearshtml inst.yearshtml;
            
setTimeout(function(){
                
//assure that inst.yearshtml didn't change.
                
if( origyearshtml === inst.yearshtml && inst.yearshtml ){
                    
inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml);
                }
                
origyearshtml inst.yearshtml null;
            }, 
0);
        }
    },

    
/* Retrieve the size of left and top borders for an element.
     * @param  elem  (jQuery object) the element of interest
     * @return  (number[2]) the left and top borders
     */
    
_getBorders: function(elem) {
        var 
convert = function(value) {
            return {
thin1medium2thick3}[value] || value;
        };
        return [
parseFloat(convert(elem.css("border-left-width"))),
            
parseFloat(convert(elem.css("border-top-width")))];
    },

    
/* Check positioning to remain on screen. */
    
_checkOffset: function(instoffsetisFixed) {
        var 
dpWidth inst.dpDiv.outerWidth(),
            
dpHeight inst.dpDiv.outerHeight(),
            
inputWidth inst.input inst.input.outerWidth() : 0,
            
inputHeight inst.input inst.input.outerHeight() : 0,
            
viewWidth document.documentElement.clientWidth + (isFixed : $(document).scrollLeft()),
            
viewHeight document.documentElement.clientHeight + (isFixed : $(document).scrollTop());

        
offset.left -= (this._get(inst"isRTL") ? (dpWidth inputWidth) : 0);
        
offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0;
        
offset.top -= (isFixed && offset.top === (inst.input.offset().top inputHeight)) ? $(document).scrollTop() : 0;

        
// now check if datepicker is showing outside window viewport - move to a better place if so.
        
offset.left -= Math.min(offset.left, (offset.left dpWidth viewWidth && viewWidth dpWidth) ?
            
Math.abs(offset.left dpWidth viewWidth) : 0);
        
offset.top -= Math.min(offset.top, (offset.top dpHeight viewHeight && viewHeight dpHeight) ?
            
Math.abs(dpHeight inputHeight) : 0);

        return 
offset;
    },

    
/* Find an object's position on the screen. */
    
_findPos: function(obj) {
        var 
position,
            
inst this._getInst(obj),
            
isRTL this._get(inst"isRTL");

        while (
obj && (obj.type === "hidden" || obj.nodeType !== || $.expr.filters.hidden(obj))) {
            
obj obj[isRTL "previousSibling" "nextSibling"];
        }

        
position = $(obj).offset();
        return [
position.leftposition.top];
    },

    
/* Hide the date picker from view.
     * @param  input  element - the input field attached to the date picker
     */
    
_hideDatepicker: function(input) {
        var 
showAnimdurationpostProcessonClose,
            
inst this._curInst;

        if (!
inst || (input && inst !== $.data(inputPROP_NAME))) {
            return;
        }

        if (
this._datepickerShowing) {
            
showAnim this._get(inst"showAnim");
            
duration this._get(inst"duration");
            
postProcess = function() {
                $.
datepicker._tidyDialog(inst);
            };

            
// DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
            
if ( $.effects && ( $.effects.effectshowAnim ] || $.effectsshowAnim ] ) ) {
                
inst.dpDiv.hide(showAnim, $.datepicker._get(inst"showOptions"), durationpostProcess);
            } else {
                
inst.dpDiv[(showAnim === "slideDown" "slideUp" :
                    (
showAnim === "fadeIn" "fadeOut" "hide"))]((showAnim duration null), postProcess);
            }

            if (!
showAnim) {
                
postProcess();
            }
            
this._datepickerShowing false;

            
onClose this._get(inst"onClose");
            if (
onClose) {
                
onClose.apply((inst.input inst.input[0] : null), [(inst.input inst.input.val() : ""), inst]);
            }

            
this._lastInput null;
            if (
this._inDialog) {
                
this._dialogInput.css({ position"absolute"left"0"top"-100px" });
                if ($.
blockUI) {
                    $.
unblockUI();
                    $(
"body").append(this.dpDiv);
                }
            }
            
this._inDialog false;
        }
    },

    
/* Tidy up after a dialog display. */
    
_tidyDialog: function(inst) {
        
inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar");
    },

    
/* Close date picker if clicked elsewhere. */
    
_checkExternalClick: function(event) {
        if (!$.
datepicker._curInst) {
            return;
        }

        var 
$target = $(event.target),
            
inst = $.datepicker._getInst($target[0]);

        if ( ( ( 
$target[0].id !== $.datepicker._mainDivId &&
                
$target.parents("#" + $.datepicker._mainDivId).length === &&
                !
$target.hasClass($.datepicker.markerClassName) &&
                !
$target.closest("." + $.datepicker._triggerClass).length &&
                $.
datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
            ( 
$target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst ) ) {
                $.
datepicker._hideDatepicker();
        }
    },

    
/* Adjust one of the date sub-fields. */
    
_adjustDate: function(idoffsetperiod) {
        var 
target = $(id),
            
inst this._getInst(target[0]);

        if (
this._isDisabledDatepicker(target[0])) {
            return;
        }
        
this._adjustInstDate(instoffset +
            (
period === "M" this._get(inst"showCurrentAtPos") : 0), // undo positioning
            
period);
        
this._updateDatepicker(inst);
    },

    
/* Action for current link. */
    
_gotoToday: function(id) {
        var 
date,
            
target = $(id),
            
inst this._getInst(target[0]);

        if (
this._get(inst"gotoCurrent") && inst.currentDay) {
            
inst.selectedDay inst.currentDay;
            
inst.drawMonth inst.selectedMonth inst.currentMonth;
            
inst.drawYear inst.selectedYear inst.currentYear;
        } else {
            
date = new Date();
            
inst.selectedDay date.getDate();
            
inst.drawMonth inst.selectedMonth date.getMonth();
            
inst.drawYear inst.selectedYear date.getFullYear();
        }
        
this._notifyChange(inst);
        
this._adjustDate(target);
    },

    
/* Action for selecting a new month/year. */
    
_selectMonthYear: function(idselectperiod) {
        var 
target = $(id),
            
inst this._getInst(target[0]);

        
inst["selected" + (period === "M" "Month" "Year")] =
        
inst["draw" + (period === "M" "Month" "Year")] =
            
parseInt(select.options[select.selectedIndex].value,10);

        
this._notifyChange(inst);
        
this._adjustDate(target);
    },

    
/* Action for selecting a day. */
    
_selectDay: function(idmonthyeartd) {
        var 
inst,
            
target = $(id);

        if ($(
td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
            return;
        }

        
inst this._getInst(target[0]);
        
inst.selectedDay inst.currentDay = $("a"td).html();
        
inst.selectedMonth inst.currentMonth month;
        
inst.selectedYear inst.currentYear year;
        
this._selectDate(idthis._formatDate(inst,
            
inst.currentDayinst.currentMonthinst.currentYear));
    },

    
/* Erase the input field and hide the date picker. */
    
_clearDate: function(id) {
        var 
target = $(id);
        
this._selectDate(target"");
    },

    
/* Update the input field with the selected date. */
    
_selectDate: function(iddateStr) {
        var 
onSelect,
            
target = $(id),
            
inst this._getInst(target[0]);

        
dateStr = (dateStr != null dateStr this._formatDate(inst));
        if (
inst.input) {
            
inst.input.val(dateStr);
        }
        
this._updateAlternate(inst);

        
onSelect this._get(inst"onSelect");
        if (
onSelect) {
            
onSelect.apply((inst.input inst.input[0] : null), [dateStrinst]);  // trigger custom callback
        
} else if (inst.input) {
            
inst.input.trigger("change"); // fire the change event
        
}

        if (
inst.inline){
            
this._updateDatepicker(inst);
        } else {
            
this._hideDatepicker();
            
this._lastInput inst.input[0];
            if (
typeof(inst.input[0]) !== "object") {
                
inst.input.focus(); // restore focus
            
}
            
this._lastInput null;
        }
    },

    
/* Update any alternate field to synchronise with the main field. */
    
_updateAlternate: function(inst) {
        var 
altFormatdatedateStr,
            
altField this._get(inst"altField");

        if (
altField) { // update alternate field too
            
altFormat this._get(inst"altFormat") || this._get(inst"dateFormat");
            
date this._getDate(inst);
            
dateStr this.formatDate(altFormatdatethis._getFormatConfig(inst));
            $(
altField).each(function() { $(this).val(dateStr); });
        }
    },

    
/* Set as beforeShowDay function to prevent selection of weekends.
     * @param  date  Date - the date to customise
     * @return [boolean, string] - is this date selectable?, what is its CSS class?
     */
    
noWeekends: function(date) {
        var 
day date.getDay();
        return [(
day && day 6), ""];
    },

    
/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
     * @param  date  Date - the date to get the week for
     * @return  number - the number of the week within the year that contains this date
     */
    
iso8601Week: function(date) {
        var 
time,
            
checkDate = new Date(date.getTime());

        
// Find Thursday of this week starting on Monday
        
checkDate.setDate(checkDate.getDate() + - (checkDate.getDay() || 7));

        
time checkDate.getTime();
        
checkDate.setMonth(0); // Compare with Jan 1
        
checkDate.setDate(1);
        return 
Math.floor(Math.round((time checkDate) / 86400000) / 7) + 1;
    },

    
/* Parse a string value into a date object.
     * See formatDate below for the possible formats.
     *
     * @param  format string - the expected format of the date
     * @param  value string - the date in the above format
     * @param  settings Object - attributes include:
     *                    shortYearCutoff  number - the cutoff year for determining the century (optional)
     *                    dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)
     *                    dayNames        string[7] - names of the days from Sunday (optional)
     *                    monthNamesShort string[12] - abbreviated names of the months (optional)
     *                    monthNames        string[12] - names of the months (optional)
     * @return  Date - the extracted date value or null if value is blank
     */
    
parseDate: function (formatvaluesettings) {
        if (
format == null || value == null) {
            throw 
"Invalid arguments";
        }

        
value = (typeof value === "object" value.toString() : value "");
        if (
value === "") {
            return 
null;
        }

        var 
iFormatdimextra,
            
iValue 0,
            
shortYearCutoffTemp = (settings settings.shortYearCutoff null) || this._defaults.shortYearCutoff,
            
shortYearCutoff = (typeof shortYearCutoffTemp !== "string" shortYearCutoffTemp :
                new 
Date().getFullYear() % 100 parseInt(shortYearCutoffTemp10)),
            
dayNamesShort = (settings settings.dayNamesShort null) || this._defaults.dayNamesShort,
            
dayNames = (settings settings.dayNames null) || this._defaults.dayNames,
            
monthNamesShort = (settings settings.monthNamesShort null) || this._defaults.monthNamesShort,
            
monthNames = (settings settings.monthNames null) || this._defaults.monthNames,
            
year = -1,
            
month = -1,
            
day = -1,
            
doy = -1,
            
literal false,
            
date,
            
// Check whether a format character is doubled
            
lookAhead = function(match) {
                var 
matches = (iFormat format.length && format.charAt(iFormat 1) === match);
                if (
matches) {
                    
iFormat++;
                }
                return 
matches;
            },
            
// Extract a number from the string value
            
getNumber = function(match) {
                var 
isDoubled lookAhead(match),
                    
size = (match === "@" 14 : (match === "!" 20 :
                    (
match === "y" && isDoubled : (match === "o" 2)))),
                    
digits = new RegExp("^\d{1," size "}"),
                    
num value.substring(iValue).match(digits);
                if (!
num) {
                    throw 
"Missing number at position " iValue;
                }
                
iValue += num[0].length;
                return 
parseInt(num[0], 10);
            },
            
// Extract a name from the string value and convert to an index
            
getName = function(matchshortNameslongNames) {
                var 
index = -1,
                    
names = $.map(lookAhead(match) ? longNames shortNames, function (vk) {
                        return [ [
kv] ];
                    }).
sort(function (ab) {
                        return -(
a[1].length b[1].length);
                    });

                $.
each(names, function (ipair) {
                    var 
name pair[1];
                    if (
value.substr(iValuename.length).toLowerCase() === name.toLowerCase()) {
                        
index pair[0];
                        
iValue += name.length;
                        return 
false;
                    }
                });
                if (
index !== -1) {
                    return 
index 1;
                } else {
                    throw 
"Unknown name at position " iValue;
                }
            },
            
// Confirm that a literal character matches the string value
            
checkLiteral = function() {
                if (
value.charAt(iValue) !== format.charAt(iFormat)) {
                    throw 
"Unexpected literal at position " iValue;
                }
                
iValue++;
            };

        for (
iFormat 0iFormat format.lengthiFormat++) {
            if (
literal) {
                if (
format.charAt(iFormat) === "'" && !lookAhead("'")) {
                    
literal false;
                } else {
                    
checkLiteral();
                }
            } else {
                switch (
format.charAt(iFormat)) {
                    case 
"d":
                        
day getNumber("d");
                        break;
                    case 
"D":
                        
getName("D"dayNamesShortdayNames);
                        break;
                    case 
"o":
                        
doy getNumber("o");
                        break;
                    case 
"m":
                        
month getNumber("m");
                        break;
                    case 
"M":
                        
month getName("M"monthNamesShortmonthNames);
                        break;
                    case 
"y":
                        
year getNumber("y");
                        break;
                    case 
"@":
                        
date = new Date(getNumber("@"));
                        
year date.getFullYear();
                        
month date.getMonth() + 1;
                        
day date.getDate();
                        break;
                    case 
"!":
                        
date = new Date((getNumber("!") - this._ticksTo1970) / 10000);
                        
year date.getFullYear();
                        
month date.getMonth() + 1;
                        
day date.getDate();
                        break;
                    case 
"'":
                        if (
lookAhead("'")){
                            
checkLiteral();
                        } else {
                            
literal true;
                        }
                        break;
                    default:
                        
checkLiteral();
                }
            }
        }

        if (
iValue value.length){
            
extra value.substr(iValue);
            if (!/^
s+/.test(extra)) {
                throw 
"Extra/unparsed characters found in date: " extra;
            }
        }

        if (
year === -1) {
            
year = new Date().getFullYear();
        } else if (
year 100) {
            
year += new Date().getFullYear() - new Date().getFullYear() % 100 +
                (
year <= shortYearCutoff : -100);
        }

        if (
doy > -1) {
            
month 1;
            
day doy;
            do {
                
dim this._getDaysInMonth(yearmonth 1);
                if (
day <= dim) {
                    break;
                }
                
month++;
                
day -= dim;
            } while (
true);
        }

        
date this._daylightSavingAdjust(new Date(yearmonth 1day));
        if (
date.getFullYear() !== year || date.getMonth() + !== month || date.getDate() !== day) {
            throw 
"Invalid date"// E.g. 31/02/00
        
}
        return 
date;
    },

    
/* Standard date formats. */
    
ATOM"yy-mm-dd"// RFC 3339 (ISO 8601)
    
COOKIE"D, dd M yy",
    
ISO_8601"yy-mm-dd",
    
RFC_822"D, d M y",
    
RFC_850"DD, dd-M-y",
    
RFC_1036"D, d M y",
    
RFC_1123"D, d M yy",
    
RFC_2822"D, d M yy",
    
RSS"D, d M y"// RFC 822
    
TICKS"!",
    
TIMESTAMP"@",
    
W3C"yy-mm-dd"// ISO 8601

    
_ticksTo1970: (((1970 1) * 365 Math.floor(1970 4) - Math.floor(1970 100) +
        
Math.floor(1970 400)) * 24 60 60 10000000),

    
/* Format a date object into a string value.
     * The format can be combinations of the following:
     * d  - day of month (no leading zero)
     * dd - day of month (two digit)
     * o  - day of year (no leading zeros)
     * oo - day of year (three digit)
     * D  - day name short
     * DD - day name long
     * m  - month of year (no leading zero)
     * mm - month of year (two digit)
     * M  - month name short
     * MM - month name long
     * y  - year (two digit)
     * yy - year (four digit)
     * @ - Unix timestamp (ms since 01/01/1970)
     * ! - Windows ticks (100ns since 01/01/0001)
     * "..." - literal text
     * '' - single quote
     *
     * @param  format string - the desired format of the date
     * @param  date Date - the date value to format
     * @param  settings Object - attributes include:
     *                    dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)
     *                    dayNames        string[7] - names of the days from Sunday (optional)
     *                    monthNamesShort string[12] - abbreviated names of the months (optional)
     *                    monthNames        string[12] - names of the months (optional)
     * @return  string - the date in the above format
     */
    
formatDate: function (formatdatesettings) {
        if (!
date) {
            return 
"";
        }

        var 
iFormat,
            
dayNamesShort = (settings settings.dayNamesShort null) || this._defaults.dayNamesShort,
            
dayNames = (settings settings.dayNames null) || this._defaults.dayNames,
            
monthNamesShort = (settings settings.monthNamesShort null) || this._defaults.monthNamesShort,
            
monthNames = (settings settings.monthNames null) || this._defaults.monthNames,
            
// Check whether a format character is doubled
            
lookAhead = function(match) {
                var 
matches = (iFormat format.length && format.charAt(iFormat 1) === match);
                if (
matches) {
                    
iFormat++;
                }
                return 
matches;
            },
            
// Format a number, with leading zero if necessary
            
formatNumber = function(matchvaluelen) {
                var 
num "" value;
                if (
lookAhead(match)) {
                    while (
num.length len) {
                        
num "0" num;
                    }
                }
                return 
num;
            },
            
// Format a name, short or long as requested
            
formatName = function(matchvalueshortNameslongNames) {
                return (
lookAhead(match) ? longNames[value] : shortNames[value]);
            },
            
output "",
            
literal false;

        if (
date) {
            for (
iFormat 0iFormat format.lengthiFormat++) {
                if (
literal) {
                    if (
format.charAt(iFormat) === "'" && !lookAhead("'")) {
                        
literal false;
                    } else {
                        
output += format.charAt(iFormat);
                    }
                } else {
                    switch (
format.charAt(iFormat)) {
                        case 
"d":
                            
output += formatNumber("d"date.getDate(), 2);
                            break;
                        case 
"D":
                            
output += formatName("D"date.getDay(), dayNamesShortdayNames);
                            break;
                        case 
"o":
                            
output += formatNumber("o",
                                
Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 00).getTime()) / 86400000), 3);
                            break;
                        case 
"m":
                            
output += formatNumber("m"date.getMonth() + 12);
                            break;
                        case 
"M":
                            
output += formatName("M"date.getMonth(), monthNamesShortmonthNames);
                            break;
                        case 
"y":
                            
output += (lookAhead("y") ? date.getFullYear() :
                                (
date.getYear() % 100 10 "0" "") + date.getYear() % 100);
                            break;
                        case 
"@":
                            
output += date.getTime();
                            break;
                        case 
"!":
                            
output += date.getTime() * 10000 this._ticksTo1970;
                            break;
                        case 
"'":
                            if (
lookAhead("'")) {
                                
output += "'";
                            } else {
                                
literal true;
                            }
                            break;
                        default:
                            
output += format.charAt(iFormat);
                    }
                }
            }
        }
        return 
output;
    },

    
/* Extract all possible characters from the date format. */
    
_possibleChars: function (format) {
        var 
iFormat,
            
chars "",
            
literal false,
            
// Check whether a format character is doubled
            
lookAhead = function(match) {
                var 
matches = (iFormat format.length && format.charAt(iFormat 1) === match);
                if (
matches) {
                    
iFormat++;
                }
                return 
matches;
            };

        for (
iFormat 0iFormat format.lengthiFormat++) {
            if (
literal) {
                if (
format.charAt(iFormat) === "'" && !lookAhead("'")) {
                    
literal false;
                } else {
                    
chars += format.charAt(iFormat);
                }
            } else {
                switch (
format.charAt(iFormat)) {
                    case 
"d": case "m": case "y": case "@":
                        
chars += "0123456789";
                        break;
                    case 
"D": case "M":
                        return 
null// Accept anything
                    
case "'":
                        if (
lookAhead("'")) {
                            
chars += "'";
                        } else {
                            
literal true;
                        }
                        break;
                    default:
                        
chars += format.charAt(iFormat);
                }
            }
        }
        return 
chars;
    },

    
/* Get a setting value, defaulting if necessary. */
    
_get: function(instname) {
        return 
inst.settings[name] !== undefined ?
            
inst.settings[name] : this._defaults[name];
    },

    
/* Parse existing date and initialise date picker. */
    
_setDateFromField: function(instnoDefault) {
        if (
inst.input.val() === inst.lastVal) {
            return;
        }

        var 
dateFormat this._get(inst"dateFormat"),
            
dates inst.lastVal inst.input inst.input.val() : null,
            
defaultDate this._getDefaultDate(inst),
            
date defaultDate,
            
settings this._getFormatConfig(inst);

        try {
            
date this.parseDate(dateFormatdatessettings) || defaultDate;
        } catch (
event) {
            
dates = (noDefault "" dates);
        }
        
inst.selectedDay date.getDate();
        
inst.drawMonth inst.selectedMonth date.getMonth();
        
inst.drawYear inst.selectedYear date.getFullYear();
        
inst.currentDay = (dates date.getDate() : 0);
        
inst.currentMonth = (dates date.getMonth() : 0);
        
inst.currentYear = (dates date.getFullYear() : 0);
        
this._adjustInstDate(inst);
    },

    
/* Retrieve the default date shown on opening. */
    
_getDefaultDate: function(inst) {
        return 
this._restrictMinMax(inst,
            
this._determineDate(instthis._get(inst"defaultDate"), new Date()));
    },

    
/* A date may be specified as an exact value or a relative one. */
    
_determineDate: function(instdatedefaultDate) {
        var 
offsetNumeric = function(offset) {
                var 
date = new Date();
                
date.setDate(date.getDate() + offset);
                return 
date;
            },
            
offsetString = function(offset) {
                try {
                    return $.
datepicker.parseDate($.datepicker._get(inst"dateFormat"),
                        
offset, $.datepicker._getFormatConfig(inst));
                }
                catch (
e) {
                    
// Ignore
                
}

                var 
date = (offset.toLowerCase().match(/^c/) ?
                    $.
datepicker._getDate(inst) : null) || new Date(),
                    
year date.getFullYear(),
                    
month date.getMonth(),
                    
day date.getDate(),
                    
pattern = /([+-]?[0-9]+)s*(d|D|w|W|m|M|y|Y)?/g,
                    
matches pattern.exec(offset);

                while (
matches) {
                    switch (
matches[2] || "d") {
                        case 
"d" : case "D" :
                            
day += parseInt(matches[1],10); break;
                        case 
"w" : case "W" :
                            
day += parseInt(matches[1],10) * 7; break;
                        case 
"m" : case "M" :
                            
month += parseInt(matches[1],10);
                            
day Math.min(day, $.datepicker._getDaysInMonth(yearmonth));
                            break;
                        case 
"y": case "Y" :
                            
year += parseInt(matches[1],10);
                            
day Math.min(day, $.datepicker._getDaysInMonth(yearmonth));
                            break;
                    }
                    
matches pattern.exec(offset);
                }
                return new 
Date(yearmonthday);
            },
            
newDate = (date == null || date === "" defaultDate : (typeof date === "string" offsetString(date) :
                (
typeof date === "number" ? (isNaN(date) ? defaultDate offsetNumeric(date)) : new Date(date.getTime()))));

        
newDate = (newDate && newDate.toString() === "Invalid Date" defaultDate newDate);
        if (
newDate) {
            
newDate.setHours(0);
            
newDate.setMinutes(0);
            
newDate.setSeconds(0);
            
newDate.setMilliseconds(0);
        }
        return 
this._daylightSavingAdjust(newDate);
    },

    
/* Handle switch to/from daylight saving.
     * Hours may be non-zero on daylight saving cut-over:
     * > 12 when midnight changeover, but then cannot generate
     * midnight datetime, so jump to 1AM, otherwise reset.
     * @param  date  (Date) the date to check
     * @return  (Date) the corrected date
     */
    
_daylightSavingAdjust: function(date) {
        if (!
date) {
            return 
null;
        }
        
date.setHours(date.getHours() > 12 date.getHours() + 0);
        return 
date;
    },

    
/* Set the date(s) directly. */
    
_setDate: function(instdatenoChange) {
        var 
clear = !date,
            
origMonth inst.selectedMonth,
            
origYear inst.selectedYear,
            
newDate this._restrictMinMax(instthis._determineDate(instdate, new Date()));

        
inst.selectedDay inst.currentDay newDate.getDate();
        
inst.drawMonth inst.selectedMonth inst.currentMonth newDate.getMonth();
        
inst.drawYear inst.selectedYear inst.currentYear newDate.getFullYear();
        if ((
origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) {
            
this._notifyChange(inst);
        }
        
this._adjustInstDate(inst);
        if (
inst.input) {
            
inst.input.val(clear "" this._formatDate(inst));
        }
    },

    
/* Retrieve the date(s) directly. */
    
_getDate: function(inst) {
        var 
startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null :
            
this._daylightSavingAdjust(new Date(
            
inst.currentYearinst.currentMonthinst.currentDay)));
            return 
startDate;
    },

    
/* Attach the onxxx handlers.  These are declared statically so
     * they work with static code transformers like Caja.
     */
    
_attachHandlers: function(inst) {
        var 
stepMonths this._get(inst"stepMonths"),
            
id "#" inst.id.replace( /\\/g"\" );
        inst.dpDiv.find("
[data-handler]").map(function () {
            var handler = {
                prev: function () {
                    window["
DP_jQuery_" + dpuuid].datepicker._adjustDate(id, -stepMonths, "M");
                },
                next: function () {
                    window["
DP_jQuery_" + dpuuid].datepicker._adjustDate(id, +stepMonths, "M");
                },
                hide: function () {
                    window["
DP_jQuery_" + dpuuid].datepicker._hideDatepicker();
                },
                today: function () {
                    window["
DP_jQuery_" + dpuuid].datepicker._gotoToday(id);
                },
                selectDay: function () {
                    window["
DP_jQuery_" + dpuuid].datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
                    return false;
                },
                selectMonth: function () {
                    window["
DP_jQuery_" + dpuuid].datepicker._selectMonthYear(id, this, "M");
                    return false;
                },
                selectYear: function () {
                    window["
DP_jQuery_" + dpuuid].datepicker._selectMonthYear(id, this, "Y");
                    return false;
                }
            };
            $(this).bind(this.getAttribute("
data-event"), handler[this.getAttribute("data-handler")]);
        });
    },

    /* Generate the HTML for the current state of the date picker. */
    _generateHTML: function(inst) {
        var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
            controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
            monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
            selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
            cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
            printDate, dRow, tbody, daySettings, otherMonth, unselectable,
            tempDate = new Date(),
            today = this._daylightSavingAdjust(
                new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time
            isRTL = this._get(inst, "
isRTL"),
            showButtonPanel = this._get(inst, "
showButtonPanel"),
            hideIfNoPrevNext = this._get(inst, "
hideIfNoPrevNext"),
            navigationAsDateFormat = this._get(inst, "
navigationAsDateFormat"),
            numMonths = this._getNumberOfMonths(inst),
            showCurrentAtPos = this._get(inst, "
showCurrentAtPos"),
            stepMonths = this._get(inst, "
stepMonths"),
            isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1),
            currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
                new Date(inst.currentYear, inst.currentMonth, inst.currentDay))),
            minDate = this._getMinMaxDate(inst, "
min"),
            maxDate = this._getMinMaxDate(inst, "
max"),
            drawMonth = inst.drawMonth - showCurrentAtPos,
            drawYear = inst.drawYear;

        if (drawMonth < 0) {
            drawMonth += 12;
            drawYear--;
        }
        if (maxDate) {
            maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
                maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
            maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
            while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
                drawMonth--;
                if (drawMonth < 0) {
                    drawMonth = 11;
                    drawYear--;
                }
            }
        }
        inst.drawMonth = drawMonth;
        inst.drawYear = drawYear;

        prevText = this._get(inst, "
prevText");
        prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
            this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
            this._getFormatConfig(inst)));

        prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
            "
<class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
            " 
title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" :
            (hideIfNoPrevNext ? "" : "
<class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+ prevText +"'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>"));

        nextText = this._get(inst, "
nextText");
        nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
            this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
            this._getFormatConfig(inst)));

        next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
            "
<class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
            " 
title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" :
            (hideIfNoPrevNext ? "" : "
<class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+ nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>"));

        currentText = this._get(inst, "
currentText");
        gotoDate = (this._get(inst, "
gotoCurrent") && inst.currentDay ? currentDate : today);
        currentText = (!navigationAsDateFormat ? currentText :
            this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));

        controls = (!inst.inline ? "
<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
            this._get(inst, "
closeText") + "</button>" : "");

        buttonPanel = (showButtonPanel) ? "
<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") +
            (this._isInRange(inst, gotoDate) ? "
<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
            "
>" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : "";

        firstDay = parseInt(this._get(inst, "
firstDay"),10);
        firstDay = (isNaN(firstDay) ? 0 : firstDay);

        showWeek = this._get(inst, "
showWeek");
        dayNames = this._get(inst, "
dayNames");
        dayNamesMin = this._get(inst, "
dayNamesMin");
        monthNames = this._get(inst, "
monthNames");
        monthNamesShort = this._get(inst, "
monthNamesShort");
        beforeShowDay = this._get(inst, "
beforeShowDay");
        showOtherMonths = this._get(inst, "
showOtherMonths");
        selectOtherMonths = this._get(inst, "
selectOtherMonths");
        defaultDate = this._getDefaultDate(inst);
        html = "";
        dow;
        for (row = 0; row < numMonths[0]; row++) {
            group = "";
            this.maxRows = 4;
            for (col = 0; col < numMonths[1]; col++) {
                selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
                cornerClass = " 
ui-corner-all";
                calender = "";
                if (isMultiMonth) {
                    calender += "
<div class='ui-datepicker-group";
                    if (numMonths[1] > 1) {
                        switch (col) {
                            case 0: calender += " ui-datepicker-group-first";
                                cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break;
                            case numMonths[1]-1: calender += " ui-datepicker-group-last";
                                cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break;
                            default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
                        }
                    }
                    calender += "'
>";
                }
                calender += "
<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
                    (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") +
                    (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") +
                    this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
                    row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
                    "
</div><table class='ui-datepicker-calendar'><thead>" +
                    "
<tr>";
                thead = (showWeek ? "
<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : "");
                for (dow = 0; dow < 7; dow++) { // days of the week
                    day = (dow + firstDay) % 7;
                    thead += "
<th" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" +
                        "
<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>";
                }
                calender += thead + "
</tr></thead><tbody>";
                daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
                if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) {
                    inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
                }
                leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
                curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
                numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
                this.maxRows = numRows;
                printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
                for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows
                    calender += "
<tr>";
                    tbody = (!showWeek ? "" : "
<td class='ui-datepicker-week-col'>" +
                        this._get(inst, "
calculateWeek")(printDate) + "</td>");
                    for (dow = 0; dow < 7; dow++) { // create date picker days
                        daySettings = (beforeShowDay ?
                            beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]);
                        otherMonth = (printDate.getMonth() !== drawMonth);
                        unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
                            (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
                        tbody += "
<td class='" +
                            ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends
                            (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months
                            ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key
                            (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ?
                            // or defaultDate is current printedDate and defaultDate is selectedDate
                            " " + this._dayOverClass : "") + // highlight selected day
                            (unselectable ? " " + this._unselectableClass + " ui-state-disabled": "") +  // highlight unselectable days
                            (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates
                            (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day
                            (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different)
                            ((!otherMonth || showOtherMonths) && daySettings[2] ? " 
title='" + daySettings[2].replace(/'/g"&#39;") + "'" "") + // cell title
                            
(unselectable "" " data-handler='selectDay' data-event='click' data-month='" printDate.getMonth() + "' data-year='" printDate.getFullYear() + "'") + ">" // actions
                            
(otherMonth && !showOtherMonths "&#xa0;" // display for other months
                            
(unselectable "<span class='ui-state-default'>" printDate.getDate() + "</span>" "<a class='ui-state-default" +
                            (
printDate.getTime() === today.getTime() ? " ui-state-highlight" "") +
                            (
printDate.getTime() === currentDate.getTime() ? " ui-state-active" "") + // highlight selected day
                            
(otherMonth " ui-priority-secondary" "") + // distinguish dates from other months
                            
"' href='#'>" printDate.getDate() + "</a>")) + "</td>"// display selectable date
                        
printDate.setDate(printDate.getDate() + 1);
                        
printDate this._daylightSavingAdjust(printDate);
                    }
                    
calender += tbody "</tr>";
                }
                
drawMonth++;
                if (
drawMonth 11) {
                    
drawMonth 0;
                    
drawYear++;
                }
                
calender += "</tbody></table>" + (isMultiMonth "</div>" +
                            ((
numMonths[0] > && col === numMonths[1]-1) ? "<div class='ui-datepicker-row-break'></div>" "") : "");
                
group += calender;
            }
            
html += group;
        }
        
html += buttonPanel;
        
inst._keyEvent false;
        return 
html;
    },

    
/* Generate the month and year header. */
    
_generateMonthYearHeader: function(instdrawMonthdrawYearminDatemaxDate,
            
secondarymonthNamesmonthNamesShort) {

        var 
inMinYearinMaxYearmonthyearsthisYeardetermineYearyearendYear,
            
changeMonth this._get(inst"changeMonth"),
            
changeYear this._get(inst"changeYear"),
            
showMonthAfterYear this._get(inst"showMonthAfterYear"),
            
html "<div class='ui-datepicker-title'>",
            
monthHtml "";

        
// month selection
        
if (secondary || !changeMonth) {
            
monthHtml += "<span class='ui-datepicker-month'>" monthNames[drawMonth] + "</span>";
        } else {
            
inMinYear = (minDate && minDate.getFullYear() === drawYear);
            
inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
            
monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
            for ( 
month 0month 12month++) {
                if ((!
inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
                    
monthHtml += "<option value='" month "'" +
                        (
month === drawMonth " selected='selected'" "") +
                        
">" monthNamesShort[month] + "</option>";
                }
            }
            
monthHtml += "</select>";
        }

        if (!
showMonthAfterYear) {
            
html += monthHtml + (secondary || !(changeMonth && changeYear) ? "&#xa0;" "");
        }

        
// year selection
        
if ( !inst.yearshtml ) {
            
inst.yearshtml "";
            if (
secondary || !changeYear) {
                
html += "<span class='ui-datepicker-year'>" drawYear "</span>";
            } else {
                
// determine range of years to display
                
years this._get(inst"yearRange").split(":");
                
thisYear = new Date().getFullYear();
                
determineYear = function(value) {
                    var 
year = (value.match(/c[+-].*/) ? drawYear parseInt(value.substring(1), 10) :
                        (
value.match(/[+-].*/) ? thisYear parseInt(value10) :
                        
parseInt(value10)));
                    return (
isNaN(year) ? thisYear year);
                };
                
year determineYear(years[0]);
                
endYear Math.max(yeardetermineYear(years[1] || ""));
                
year = (minDate Math.max(yearminDate.getFullYear()) : year);
                
endYear = (maxDate Math.min(endYearmaxDate.getFullYear()) : endYear);
                
inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
                for (; 
year <= endYearyear++) {
                    
inst.yearshtml += "<option value='" year "'" +
                        (
year === drawYear " selected='selected'" "") +
                        
">" year "</option>";
                }
                
inst.yearshtml += "</select>";

                
html += inst.yearshtml;
                
inst.yearshtml null;
            }
        }

        
html += this._get(inst"yearSuffix");
        if (
showMonthAfterYear) {
            
html += (secondary || !(changeMonth && changeYear) ? "&#xa0;" "") + monthHtml;
        }
        
html += "</div>"// Close datepicker_header
        
return html;
    },

    
/* Adjust one of the date sub-fields. */
    
_adjustInstDate: function(instoffsetperiod) {
        var 
year inst.drawYear + (period === "Y" offset 0),
            
month inst.drawMonth + (period === "M" offset 0),
            
day Math.min(inst.selectedDaythis._getDaysInMonth(yearmonth)) + (period === "D" offset 0),
            
date this._restrictMinMax(instthis._daylightSavingAdjust(new Date(yearmonthday)));

        
inst.selectedDay date.getDate();
        
inst.drawMonth inst.selectedMonth date.getMonth();
        
inst.drawYear inst.selectedYear date.getFullYear();
        if (
period === "M" || period === "Y") {
            
this._notifyChange(inst);
        }
    },

    
/* Ensure a date is within any min/max bounds. */
    
_restrictMinMax: function(instdate) {
        var 
minDate this._getMinMaxDate(inst"min"),
            
maxDate this._getMinMaxDate(inst"max"),
            
newDate = (minDate && date minDate minDate date);
        return (
maxDate && newDate maxDate maxDate newDate);
    },

    
/* Notify change of month/year. */
    
_notifyChange: function(inst) {
        var 
onChange this._get(inst"onChangeMonthYear");
        if (
onChange) {
            
onChange.apply((inst.input inst.input[0] : null),
                [
inst.selectedYearinst.selectedMonth 1inst]);
        }
    },

    
/* Determine the number of months to show. */
    
_getNumberOfMonths: function(inst) {
        var 
numMonths this._get(inst"numberOfMonths");
        return (
numMonths == null ? [11] : (typeof numMonths === "number" ? [1numMonths] : numMonths));
    },

    
/* Determine the current maximum date - ensure no time components are set. */
    
_getMinMaxDate: function(instminMax) {
        return 
this._determineDate(instthis._get(instminMax "Date"), null);
    },

    
/* Find the number of days in a given month. */
    
_getDaysInMonth: function(yearmonth) {
        return 
32 this._daylightSavingAdjust(new Date(yearmonth32)).getDate();
    },

    
/* Find the day of the week of the first of a month. */
    
_getFirstDayOfMonth: function(yearmonth) {
        return new 
Date(yearmonth1).getDay();
    },

    
/* Determines if we should allow a "next/prev" month display change. */
    
_canAdjustMonth: function(instoffsetcurYearcurMonth) {
        var 
numMonths this._getNumberOfMonths(inst),
            
date this._daylightSavingAdjust(new Date(curYear,
            
curMonth + (offset offset numMonths[0] * numMonths[1]), 1));

        if (
offset 0) {
            
date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
        }
        return 
this._isInRange(instdate);
    },

    
/* Is the given date in the accepted range? */
    
_isInRange: function(instdate) {
        var 
yearSplitcurrentYear,
            
minDate this._getMinMaxDate(inst"min"),
            
maxDate this._getMinMaxDate(inst"max"),
            
minYear null,
            
maxYear null,
            
years this._get(inst"yearRange");
            if (
years){
                
yearSplit years.split(":");
                
currentYear = new Date().getFullYear();
                
minYear parseInt(yearSplit[0], 10);
                
maxYear parseInt(yearSplit[1], 10);
                if ( 
yearSplit[0].match(/[+-].*/) ) {
                    
minYear += currentYear;
                }
                if ( 
yearSplit[1].match(/[+-].*/) ) {
                    
maxYear += currentYear;
                }
            }

        return ((!
minDate || date.getTime() >= minDate.getTime()) &&
            (!
maxDate || date.getTime() <= maxDate.getTime()) &&
            (!
minYear || date.getFullYear() >= minYear) &&
            (!
maxYear || date.getFullYear() <= maxYear));
    },

    
/* Provide the configuration settings for formatting/parsing. */
    
_getFormatConfig: function(inst) {
        var 
shortYearCutoff this._get(inst"shortYearCutoff");
        
shortYearCutoff = (typeof shortYearCutoff !== "string" shortYearCutoff :
            new 
Date().getFullYear() % 100 parseInt(shortYearCutoff10));
        return {
shortYearCutoffshortYearCutoff,
            
dayNamesShortthis._get(inst"dayNamesShort"), dayNamesthis._get(inst"dayNames"),
            
monthNamesShortthis._get(inst"monthNamesShort"), monthNamesthis._get(inst"monthNames")};
    },

    
/* Format the given date for display. */
    
_formatDate: function(instdaymonthyear) {
        if (!
day) {
            
inst.currentDay inst.selectedDay;
            
inst.currentMonth inst.selectedMonth;
            
inst.currentYear inst.selectedYear;
        }
        var 
date = (day ? (typeof day === "object" day :
            
this._daylightSavingAdjust(new Date(yearmonthday))) :
            
this._daylightSavingAdjust(new Date(inst.currentYearinst.currentMonthinst.currentDay)));
        return 
this.formatDate(this._get(inst"dateFormat"), datethis._getFormatConfig(inst));
    }
});

/*
 * Bind hover events for datepicker elements.
 * Done via delegate so the binding only occurs once in the lifetime of the parent div.
 * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
 */
function bindHover(dpDiv) {
    var 
selector "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
    return 
dpDiv.delegate(selector"mouseout", function() {
            $(
this).removeClass("ui-state-hover");
            if (
this.className.indexOf("ui-datepicker-prev") !== -1) {
                $(
this).removeClass("ui-datepicker-prev-hover");
            }
            if (
this.className.indexOf("ui-datepicker-next") !== -1) {
                $(
this).removeClass("ui-datepicker-next-hover");
            }
        })
        .
delegate(selector"mouseover", function(){
            if (!$.
datepicker._isDisabledDatepickerinstActive.inline dpDiv.parent()[0] : instActive.input[0])) {
                $(
this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
                $(
this).addClass("ui-state-hover");
                if (
this.className.indexOf("ui-datepicker-prev") !== -1) {
                    $(
this).addClass("ui-datepicker-prev-hover");
                }
                if (
this.className.indexOf("ui-datepicker-next") !== -1) {
                    $(
this).addClass("ui-datepicker-next-hover");
                }
            }
        });
}

/* jQuery extend now ignores nulls! */
function extendRemove(targetprops) {
    $.
extend(targetprops);
    for (var 
name in props) {
        if (
props[name] == null) {
            
target[name] = props[name];
        }
    }
    return 
target;
}

/* Invoke the datepicker functionality.
   @param  options  string - a command, optionally followed by additional parameters or
                    Object - settings for attaching new datepicker functionality
   @return  jQuery object */
$.fn.datepicker = function(options){

    
/* Verify an empty collection wasn't passed - Fixes #6976 */
    
if ( !this.length ) {
        return 
this;
    }

    
/* Initialise the date picker. */
    
if (!$.datepicker.initialized) {
        $(
document).mousedown($.datepicker._checkExternalClick);
        $.
datepicker.initialized true;
    }

    
/* Append datepicker main container to body if not exist. */
    
if ($("#"+$.datepicker._mainDivId).length === 0) {
        $(
"body").append($.datepicker.dpDiv);
    }

    var 
otherArgs = Array.prototype.slice.call(arguments1);
    if (
typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) {
        return $.
datepicker["_" options "Datepicker"].
            
apply($.datepicker, [this[0]].concat(otherArgs));
    }
    if (
options === "option" && arguments.length === && typeof arguments[1] === "string") {
        return $.
datepicker["_" options "Datepicker"].
            
apply($.datepicker, [this[0]].concat(otherArgs));
    }
    return 
this.each(function() {
        
typeof options === "string" ?
            $.
datepicker["_" options "Datepicker"].
                
apply($.datepicker, [this].concat(otherArgs)) :
            $.
datepicker._attachDatepicker(thisoptions);
    });
};

$.
datepicker = new Datepicker(); // singleton instance
$.datepicker.initialized false;
$.
datepicker.uuid = new Date().getTime();
$.
datepicker.version "1.10.1";

// Workaround for #4055
// Add another global to avoid noConflict issues with inline event handlers
window["DP_jQuery_" dpuuid] = $;

})(
jQuery);
(function( $, 
undefined ) {

var 
sizeRelatedOptions = {
        
buttonstrue,
        
heighttrue,
        
maxHeighttrue,
        
maxWidthtrue,
        
minHeighttrue,
        
minWidthtrue,
        
widthtrue
    
},
    
resizableRelatedOptions = {
        
maxHeighttrue,
        
maxWidthtrue,
        
minHeighttrue,
        
minWidthtrue
    
};

$.
widget"ui.dialog", {
    
version"1.10.1",
    
options: {
        
appendTo"body",
        
autoOpentrue,
        
buttons: [],
        
closeOnEscapetrue,
        
closeText"close",
        
dialogClass"",
        
draggabletrue,
        
hidenull,
        
height"auto",
        
maxHeightnull,
        
maxWidthnull,
        
minHeight150,
        
minWidth150,
        
modalfalse,
        
position: {
            
my"center",
            
at"center",
            
ofwindow,
            
collision"fit",
            
// Ensure the titlebar is always visible
            
using: function( pos ) {
                var 
topOffset = $( this ).csspos ).offset().top;
                if ( 
topOffset ) {
                    $( 
this ).css"top"pos.top topOffset );
                }
            }
        },
        
resizabletrue,
        
shownull,
        
titlenull,
        
width300,

        
// callbacks
        
beforeClosenull,
        
closenull,
        
dragnull,
        
dragStartnull,
        
dragStopnull,
        
focusnull,
        
opennull,
        
resizenull,
        
resizeStartnull,
        
resizeStopnull
    
},

    
_create: function() {
        
this.originalCss = {
            
displaythis.element[0].style.display,
            
widththis.element[0].style.width,
            
minHeightthis.element[0].style.minHeight,
            
maxHeightthis.element[0].style.maxHeight,
            
heightthis.element[0].style.height
        
};
        
this.originalPosition = {
            
parentthis.element.parent(),
            
indexthis.element.parent().children().indexthis.element )
        };
        
this.originalTitle this.element.attr("title");
        
this.options.title this.options.title || this.originalTitle;

        
this._createWrapper();

        
this.element
            
.show()
            .
removeAttr("title")
            .
addClass("ui-dialog-content ui-widget-content")
            .
appendTothis.uiDialog );

        
this._createTitlebar();
        
this._createButtonPane();

        if ( 
this.options.draggable && $.fn.draggable ) {
            
this._makeDraggable();
        }
        if ( 
this.options.resizable && $.fn.resizable ) {
            
this._makeResizable();
        }

        
this._isOpen false;
    },

    
_init: function() {
        if ( 
this.options.autoOpen ) {
            
this.open();
        }
    },

    
_appendTo: function() {
        var 
element this.options.appendTo;
        if ( 
element && (element.jquery || element.nodeType) ) {
            return $( 
element );
        }
        return 
this.document.findelement || "body" ).eq);
    },

    
_destroy: function() {
        var 
next,
            
originalPosition this.originalPosition;

        
this._destroyOverlay();

        
this.element
            
.removeUniqueId()
            .
removeClass("ui-dialog-content ui-widget-content")
            .
cssthis.originalCss )
            
// Without detaching first, the following becomes really slow
            
.detach();

        
this.uiDialog.stoptruetrue ).remove();

        if ( 
this.originalTitle ) {
            
this.element.attr"title"this.originalTitle );
        }

        
next originalPosition.parent.children().eqoriginalPosition.index );
        
// Don't try to place the dialog next to itself (#8613)
        
if ( next.length && next[0] !== this.element[0] ) {
            
next.beforethis.element );
        } else {
            
originalPosition.parent.appendthis.element );
        }
    },

    
widget: function() {
        return 
this.uiDialog;
    },

    
disable: $.noop,
    
enable: $.noop,

    
close: function( event ) {
        var 
that this;

        if ( !
this._isOpen || this._trigger"beforeClose"event ) === false ) {
            return;
        }

        
this._isOpen false;
        
this._destroyOverlay();

        if ( !
this.opener.filter(":focusable").focus().length ) {
            
// Hiding a focused element doesn't trigger blur in WebKit
            // so in case we have nothing to focus on, explicitly blur the active element
            // https://bugs.webkit.org/show_bug.cgi?id=47182
            
$( this.document[0].activeElement ).blur();
        }

        
this._hidethis.uiDialogthis.options.hide, function() {
            
that._trigger"close"event );
        });
    },

    
isOpen: function() {
        return 
this._isOpen;
    },

    
moveToTop: function() {
        
this._moveToTop();
    },

    
_moveToTop: function( eventsilent ) {
        var 
moved = !!this.uiDialog.nextAll(":visible").insertBeforethis.uiDialog ).length;
        if ( 
moved && !silent ) {
            
this._trigger"focus"event );
        }
        return 
moved;
    },

    
open: function() {
        var 
that this;
        if ( 
this._isOpen ) {
            if ( 
this._moveToTop() ) {
                
this._focusTabbable();
            }
            return;
        }

        
this._isOpen true;
        
this.opener = $( this.document[0].activeElement );

        
this._size();
        
this._position();
        
this._createOverlay();
        
this._moveToTopnulltrue );
        
this._showthis.uiDialogthis.options.show, function() {
            
that._focusTabbable();
            
that._trigger("focus");
        });

        
this._trigger("open");
    },

    
_focusTabbable: function() {
        
// Set focus to the first match:
        // 1. First element inside the dialog matching [autofocus]
        // 2. Tabbable element inside the content element
        // 3. Tabbable element inside the buttonpane
        // 4. The close button
        // 5. The dialog itself
        
var hasFocus this.element.find("[autofocus]");
        if ( !
hasFocus.length ) {
            
hasFocus this.element.find(":tabbable");
        }
        if ( !
hasFocus.length ) {
            
hasFocus this.uiDialogButtonPane.find(":tabbable");
        }
        if ( !
hasFocus.length ) {
            
hasFocus this.uiDialogTitlebarClose.filter(":tabbable");
        }
        if ( !
hasFocus.length ) {
            
hasFocus this.uiDialog;
        }
        
hasFocus.eq).focus();
    },

    
_keepFocus: function( event ) {
        function 
checkFocus() {
            var 
activeElement this.document[0].activeElement,
                
isActive this.uiDialog[0] === activeElement ||
                    $.
containsthis.uiDialog[0], activeElement );
            if ( !
isActive ) {
                
this._focusTabbable();
            }
        }
        
event.preventDefault();
        
checkFocus.callthis );
        
// support: IE
        // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
        // so we check again later
        
this._delaycheckFocus );
    },

    
_createWrapper: function() {
        
this.uiDialog = $("<div>")
            .
addClass"ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " +
                
this.options.dialogClass )
            .
hide()
            .
attr({
                
// Setting tabIndex makes the div focusable
                
tabIndex: -1,
                
role"dialog"
            
})
            .
appendTothis._appendTo() );

        
this._onthis.uiDialog, {
            
keydown: function( event ) {
                if ( 
this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
                        
event.keyCode === $.ui.keyCode.ESCAPE ) {
                    
event.preventDefault();
                    
this.closeevent );
                    return;
                }

                
// prevent tabbing out of dialogs
                
if ( event.keyCode !== $.ui.keyCode.TAB ) {
                    return;
                }
                var 
tabbables this.uiDialog.find(":tabbable"),
                    
first tabbables.filter(":first"),
                    
last  tabbables.filter(":last");

                if ( ( 
event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) {
                    
first.focus);
                    
event.preventDefault();
                } else if ( ( 
event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) {
                    
last.focus);
                    
event.preventDefault();
                }
            },
            
mousedown: function( event ) {
                if ( 
this._moveToTopevent ) ) {
                    
this._focusTabbable();
                }
            }
        });

        
// We assume that any existing aria-describedby attribute means
        // that the dialog content is marked up properly
        // otherwise we brute force the content as the description
        
if ( !this.element.find("[aria-describedby]").length ) {
            
this.uiDialog.attr({
                
"aria-describedby"this.element.uniqueId().attr("id")
            });
        }
    },

    
_createTitlebar: function() {
        var 
uiDialogTitle;

        
this.uiDialogTitlebar = $("<div>")
            .
addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix")
            .
prependTothis.uiDialog );
        
this._onthis.uiDialogTitlebar, {
            
mousedown: function( event ) {
                
// Don't prevent click on close button (#8838)
                // Focusing a dialog that is partially scrolled out of view
                // causes the browser to scroll it into view, preventing the click event
                
if ( !$( event.target ).closest(".ui-dialog-titlebar-close") ) {
                    
// Dialog isn't getting focus when dragging (#8063)
                    
this.uiDialog.focus();
                }
            }
        });

        
this.uiDialogTitlebarClose = $("<button></button>")
            .
button({
                
labelthis.options.closeText,
                
icons: {
                    
primary"ui-icon-closethick"
                
},
                
textfalse
            
})
            .
addClass("ui-dialog-titlebar-close")
            .
appendTothis.uiDialogTitlebar );
        
this._onthis.uiDialogTitlebarClose, {
            
click: function( event ) {
                
event.preventDefault();
                
this.closeevent );
            }
        });

        
uiDialogTitle = $("<span>")
            .
uniqueId()
            .
addClass("ui-dialog-title")
            .
prependTothis.uiDialogTitlebar );
        
this._titleuiDialogTitle );

        
this.uiDialog.attr({
            
"aria-labelledby"uiDialogTitle.attr("id")
        });
    },

    
_title: function( title ) {
        if ( !
this.options.title ) {
            
title.html("&#160;");
        }
        
title.textthis.options.title );
    },

    
_createButtonPane: function() {
        
this.uiDialogButtonPane = $("<div>")
            .
addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");

        
this.uiButtonSet = $("<div>")
            .
addClass("ui-dialog-buttonset")
            .
appendTothis.uiDialogButtonPane );

        
this._createButtons();
    },

    
_createButtons: function() {
        var 
that this,
            
buttons this.options.buttons;

        
// if we already have a button pane, remove it
        
this.uiDialogButtonPane.remove();
        
this.uiButtonSet.empty();

        if ( $.
isEmptyObjectbuttons ) || ($.isArraybuttons ) && !buttons.length) ) {
            
this.uiDialog.removeClass("ui-dialog-buttons");
            return;
        }

        $.
eachbuttons, function( nameprops ) {
            var 
clickbuttonOptions;
            
props = $.isFunctionprops ) ?
                { 
clickpropstextname } :
                
props;
            
// Default to a non-submitting button
            
props = $.extend( { type"button" }, props );
            
// Change the context for the click callback to be the main element
            
click props.click;
            
props.click = function() {
                
click.applythat.element[0], arguments );
            };
            
buttonOptions = {
                
iconsprops.icons,
                
textprops.showText
            
};
            
delete props.icons;
            
delete props.showText;
            $( 
"<button></button>"props )
                .
buttonbuttonOptions )
                .
appendTothat.uiButtonSet );
        });
        
this.uiDialog.addClass("ui-dialog-buttons");
        
this.uiDialogButtonPane.appendTothis.uiDialog );
    },

    
_makeDraggable: function() {
        var 
that this,
            
options this.options;

        function 
filteredUiui ) {
            return {
                
positionui.position,
                
offsetui.offset
            
};
        }

        
this.uiDialog.draggable({
            
cancel".ui-dialog-content, .ui-dialog-titlebar-close",
            
handle".ui-dialog-titlebar",
            
containment"document",
            
start: function( eventui ) {
                $( 
this ).addClass("ui-dialog-dragging");
                
that._blockFrames();
                
that._trigger"dragStart"eventfilteredUiui ) );
            },
            
drag: function( eventui ) {
                
that._trigger"drag"eventfilteredUiui ) );
            },
            
stop: function( eventui ) {
                
options.position = [
                    
ui.position.left that.document.scrollLeft(),
                    
ui.position.top that.document.scrollTop()
                ];
                $( 
this ).removeClass("ui-dialog-dragging");
                
that._unblockFrames();
                
that._trigger"dragStop"eventfilteredUiui ) );
            }
        });
    },

    
_makeResizable: function() {
        var 
that this,
            
options this.options,
            
handles options.resizable,
            
// .ui-resizable has position: relative defined in the stylesheet
            // but dialogs have to use absolute or fixed positioning
            
position this.uiDialog.css("position"),
            
resizeHandles typeof handles === "string" ?
                
handles    :
                
"n,e,s,w,se,sw,ne,nw";

        function 
filteredUiui ) {
            return {
                
originalPositionui.originalPosition,
                
originalSizeui.originalSize,
                
positionui.position,
                
sizeui.size
            
};
        }

        
this.uiDialog.resizable({
            
cancel".ui-dialog-content",
            
containment"document",
            
alsoResizethis.element,
            
maxWidthoptions.maxWidth,
            
maxHeightoptions.maxHeight,
            
minWidthoptions.minWidth,
            
minHeightthis._minHeight(),
            
handlesresizeHandles,
            
start: function( eventui ) {
                $( 
this ).addClass("ui-dialog-resizing");
                
that._blockFrames();
                
that._trigger"resizeStart"eventfilteredUiui ) );
            },
            
resize: function( eventui ) {
                
that._trigger"resize"eventfilteredUiui ) );
            },
            
stop: function( eventui ) {
                
options.height = $( this ).height();
                
options.width = $( this ).width();
                $( 
this ).removeClass("ui-dialog-resizing");
                
that._unblockFrames();
                
that._trigger"resizeStop"eventfilteredUiui ) );
            }
        })
        .
css"position"position );
    },

    
_minHeight: function() {
        var 
options this.options;

        return 
options.height === "auto" ?
            
options.minHeight :
            
Math.minoptions.minHeightoptions.height );
    },

    
_position: function() {
        
// Need to show the dialog to get the actual offset in the position plugin
        
var isVisible this.uiDialog.is(":visible");
        if ( !
isVisible ) {
            
this.uiDialog.show();
        }
        
this.uiDialog.positionthis.options.position );
        if ( !
isVisible ) {
            
this.uiDialog.hide();
        }
    },

    
_setOptions: function( options ) {
        var 
that this,
            
resize false,
            
resizableOptions = {};

        $.
eachoptions, function( keyvalue ) {
            
that._setOptionkeyvalue );

            if ( 
key in sizeRelatedOptions ) {
                
resize true;
            }
            if ( 
key in resizableRelatedOptions ) {
                
resizableOptionskey ] = value;
            }
        });

        if ( 
resize ) {
            
this._size();
            
this._position();
        }
        if ( 
this.uiDialog.is(":data(ui-resizable)") ) {
            
this.uiDialog.resizable"option"resizableOptions );
        }
    },

    
_setOption: function( keyvalue ) {
        
/*jshint maxcomplexity:15*/
        
var isDraggableisResizable,
            
uiDialog this.uiDialog;

        if ( 
key === "dialogClass" ) {
            
uiDialog
                
.removeClassthis.options.dialogClass )
                .
addClassvalue );
        }

        if ( 
key === "disabled" ) {
            return;
        }

        
this._superkeyvalue );

        if ( 
key === "appendTo" ) {
            
this.uiDialog.appendTothis._appendTo() );
        }

        if ( 
key === "buttons" ) {
            
this._createButtons();
        }

        if ( 
key === "closeText" ) {
            
this.uiDialogTitlebarClose.button({
                
// Ensure that we always pass a string
                
label"" value
            
});
        }

        if ( 
key === "draggable" ) {
            
isDraggable uiDialog.is(":data(ui-draggable)");
            if ( 
isDraggable && !value ) {
                
uiDialog.draggable("destroy");
            }

            if ( !
isDraggable && value ) {
                
this._makeDraggable();
            }
        }

        if ( 
key === "position" ) {
            
this._position();
        }

        if ( 
key === "resizable" ) {
            
// currently resizable, becoming non-resizable
            
isResizable uiDialog.is(":data(ui-resizable)");
            if ( 
isResizable && !value ) {
                
uiDialog.resizable("destroy");
            }

            
// currently resizable, changing handles
            
if ( isResizable && typeof value === "string" ) {
                
uiDialog.resizable"option""handles"value );
            }

            
// currently non-resizable, becoming resizable
            
if ( !isResizable && value !== false ) {
                
this._makeResizable();
            }
        }

        if ( 
key === "title" ) {
            
this._titlethis.uiDialogTitlebar.find(".ui-dialog-title") );
        }
    },

    
_size: function() {
        
// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
        // divs will both have width and height set, so we need to reset them
        
var nonContentHeightminContentHeightmaxContentHeight,
            
options this.options;

        
// Reset content sizing
        
this.element.show().css({
            
width"auto",
            
minHeight0,
            
maxHeight"none",
            
height0
        
});

        if ( 
options.minWidth options.width ) {
            
options.width options.minWidth;
        }

        
// reset wrapper sizing
        // determine the height of all the non-content elements
        
nonContentHeight this.uiDialog.css({
                
height"auto",
                
widthoptions.width
            
})
            .
outerHeight();
        
minContentHeight Math.max0options.minHeight nonContentHeight );
        
maxContentHeight typeof options.maxHeight === "number" ?
            
Math.max0options.maxHeight nonContentHeight ) :
            
"none";

        if ( 
options.height === "auto" ) {
            
this.element.css({
                
minHeightminContentHeight,
                
maxHeightmaxContentHeight,
                
height"auto"
            
});
        } else {
            
this.element.heightMath.max0options.height nonContentHeight ) );
        }

        if (
this.uiDialog.is(":data(ui-resizable)") ) {
            
this.uiDialog.resizable"option""minHeight"this._minHeight() );
        }
    },

    
_blockFrames: function() {
        
this.iframeBlocks this.document.find"iframe" ).map(function() {
            var 
iframe = $( this );

            return $( 
"<div>" )
                .
css({
                    
position"absolute",
                    
widthiframe.outerWidth(),
                    
heightiframe.outerHeight()
                })
                .
appendToiframe.parent() )
                .
offsetiframe.offset() )[0];
        });
    },

    
_unblockFrames: function() {
        if ( 
this.iframeBlocks ) {
            
this.iframeBlocks.remove();
            
delete this.iframeBlocks;
        }
    },

    
_createOverlay: function() {
        if ( !
this.options.modal ) {
            return;
        }

        if ( !$.
ui.dialog.overlayInstances ) {
            
// Prevent use of anchors and inputs.
            // We use a delay in case the overlay is created from an
            // event that we're going to be cancelling. (#2804)
            
this._delay(function() {
                
// Handle .dialog().dialog("close") (#4065)
                
if ( $.ui.dialog.overlayInstances ) {
                    
this.document.bind"focusin.dialog", function( event ) {
                        if ( !$( 
event.target ).closest(".ui-dialog").length &&
                                
// TODO: Remove hack when datepicker implements
                                // the .ui-front logic (#8989)
                                
!$( event.target ).closest(".ui-datepicker").length ) {
                            
event.preventDefault();
                            $(
".ui-dialog:visible:last .ui-dialog-content")
                                .
data("ui-dialog")._focusTabbable();
                        }
                    });
                }
            });
        }

        
this.overlay = $("<div>")
            .
addClass("ui-widget-overlay ui-front")
            .
appendTothis._appendTo() );
        
this._onthis.overlay, {
            
mousedown"_keepFocus"
        
});
        $.
ui.dialog.overlayInstances++;
    },

    
_destroyOverlay: function() {
        if ( !
this.options.modal ) {
            return;
        }

        if ( 
this.overlay ) {
            $.
ui.dialog.overlayInstances--;

            if ( !$.
ui.dialog.overlayInstances ) {
                
this.document.unbind"focusin.dialog" );
            }
            
this.overlay.remove();
            
this.overlay null;
        }
    }
});

$.
ui.dialog.overlayInstances 0;

// DEPRECATED
if ( $.uiBackCompat !== false ) {
    
// position option with array notation
    // just override with old implementation
    
$.widget"ui.dialog", $.ui.dialog, {
        
_position: function() {
            var 
position this.options.position,
                
myAt = [],
                
offset = [ 0],
                
isVisible;

            if ( 
position ) {
                if ( 
typeof position === "string" || (typeof position === "object" && "0" in position ) ) {
                    
myAt position.split position.split(" ") : [ position[0], position[1] ];
                    if ( 
myAt.length === ) {
                        
myAt[1] = myAt[0];
                    }

                    $.
each( [ "left""top" ], function( ioffsetPosition ) {
                        if ( +
myAt] === myAt] ) {
                            
offset] = myAt];
                            
myAt] = offsetPosition;
                        }
                    });

                    
position = {
                        
mymyAt[0] + (offset[0] < offset[0] : "+" offset[0]) + " " +
                            
myAt[1] + (offset[1] < offset[1] : "+" offset[1]),
                        
atmyAt.join(" ")
                    };
                }

                
position = $.extend( {}, $.ui.dialog.prototype.options.positionposition );
            } else {
                
position = $.ui.dialog.prototype.options.position;
            }

            
// need to show the dialog to get the actual offset in the position plugin
            
isVisible this.uiDialog.is(":visible");
            if ( !
isVisible ) {
                
this.uiDialog.show();
            }
            
this.uiDialog.positionposition );
            if ( !
isVisible ) {
                
this.uiDialog.hide();
            }
        }
    });
}

}( 
jQuery ) );
(function( $, 
undefined ) {

$.
widget"ui.menu", {
    
version"1.10.1",
    
defaultElement"<ul>",
    
delay300,
    
options: {
        
icons: {
            
submenu"ui-icon-carat-1-e"
        
},
        
menus"ul",
        
position: {
            
my"left top",
            
at"right top"
        
},
        
role"menu",

        
// callbacks
        
blurnull,
        
focusnull,
        
selectnull
    
},

    
_create: function() {
        
this.activeMenu this.element;
        
// flag used to prevent firing of the click handler
        // as the event bubbles up through nested menus
        
this.mouseHandled false;
        
this.element
            
.uniqueId()
            .
addClass"ui-menu ui-widget ui-widget-content ui-corner-all" )
            .
toggleClass"ui-menu-icons", !!this.element.find".ui-icon" ).length )
            .
attr({
                
rolethis.options.role,
                
tabIndex0
            
})
            
// need to catch all clicks on disabled menu
            // not possible through _on
            
.bind"click" this.eventNamespace, $.proxy(function( event ) {
                if ( 
this.options.disabled ) {
                    
event.preventDefault();
                }
            }, 
this ));

        if ( 
this.options.disabled ) {
            
this.element
                
.addClass"ui-state-disabled" )
                .
attr"aria-disabled""true" );
        }

        
this._on({
            
// Prevent focus from sticking to links inside menu after clicking
            // them (focus should always stay on UL during navigation).
            
"mousedown .ui-menu-item > a": function( event ) {
                
event.preventDefault();
            },
            
"click .ui-state-disabled > a": function( event ) {
                
event.preventDefault();
            },
            
"click .ui-menu-item:has(a)": function( event ) {
                var 
target = $( event.target ).closest".ui-menu-item" );
                if ( !
this.mouseHandled && target.not".ui-state-disabled" ).length ) {
                    
this.mouseHandled true;

                    
this.selectevent );
                    
// Open submenu on click
                    
if ( target.has".ui-menu" ).length ) {
                        
this.expandevent );
                    } else if ( !
this.element.is":focus" ) ) {
                        
// Redirect focus to the menu
                        
this.element.trigger"focus", [ true ] );

                        
// If the active item is on the top level, let it stay active.
                        // Otherwise, blur the active item since it is no longer visible.
                        
if ( this.active && this.active.parents".ui-menu" ).length === ) {
                            
clearTimeoutthis.timer );
                        }
                    }
                }
            },
            
"mouseenter .ui-menu-item": function( event ) {
                var 
target = $( event.currentTarget );
                
// Remove ui-state-active class from siblings of the newly focused menu item
                // to avoid a jump caused by adjacent elements both having a class with a border
                
target.siblings().children".ui-state-active" ).removeClass"ui-state-active" );
                
this.focuseventtarget );
            },
            
mouseleave"collapseAll",
            
"mouseleave .ui-menu""collapseAll",
            
focus: function( eventkeepActiveItem ) {
                
// If there's already an active item, keep it active
                // If not, activate the first item
                
var item this.active || this.element.children".ui-menu-item" ).eq);

                if ( !
keepActiveItem ) {
                    
this.focuseventitem );
                }
            },
            
blur: function( event ) {
                
this._delay(function() {
                    if ( !$.
containsthis.element[0], this.document[0].activeElement ) ) {
                        
this.collapseAllevent );
                    }
                });
            },
            
keydown"_keydown"
        
});

        
this.refresh();

        
// Clicks outside of a menu collapse any open menus
        
this._onthis.document, {
            
click: function( event ) {
                if ( !$( 
event.target ).closest".ui-menu" ).length ) {
                    
this.collapseAllevent );
                }

                
// Reset the mouseHandled flag
                
this.mouseHandled false;
            }
        });
    },

    
_destroy: function() {
        
// Destroy (sub)menus
        
this.element
            
.removeAttr"aria-activedescendant" )
            .
find".ui-menu" ).addBack()
                .
removeClass"ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )
                .
removeAttr"role" )
                .
removeAttr"tabIndex" )
                .
removeAttr"aria-labelledby" )
                .
removeAttr"aria-expanded" )
                .
removeAttr"aria-hidden" )
                .
removeAttr"aria-disabled" )
                .
removeUniqueId()
                .
show();

        
// Destroy menu items
        
this.element.find".ui-menu-item" )
            .
removeClass"ui-menu-item" )
            .
removeAttr"role" )
            .
removeAttr"aria-disabled" )
            .
children"a" )
                .
removeUniqueId()
                .
removeClass"ui-corner-all ui-state-hover" )
                .
removeAttr"tabIndex" )
                .
removeAttr"role" )
                .
removeAttr"aria-haspopup" )
                .
children().each( function() {
                    var 
elem = $( this );
                    if ( 
elem.data"ui-menu-submenu-carat" ) ) {
                        
elem.remove();
                    }
                });

        
// Destroy menu dividers
        
this.element.find".ui-menu-divider" ).removeClass"ui-menu-divider ui-widget-content" );
    },

    
_keydown: function( event ) {
        
/*jshint maxcomplexity:20*/
        
var matchprevcharacterskipregex,
            
preventDefault true;

        function 
escapevalue ) {
            return 
value.replace( /[-[]{}()*+?.,\^$|#s]/g, "\$&" );
        
}

        switch ( 
event.keyCode ) {
        case $.
ui.keyCode.PAGE_UP:
            
this.previousPageevent );
            break;
        case $.
ui.keyCode.PAGE_DOWN:
            
this.nextPageevent );
            break;
        case $.
ui.keyCode.HOME:
            
this._move"first""first"event );
            break;
        case $.
ui.keyCode.END:
            
this._move"last""last"event );
            break;
        case $.
ui.keyCode.UP:
            
this.previousevent );
            break;
        case $.
ui.keyCode.DOWN:
            
this.nextevent );
            break;
        case $.
ui.keyCode.LEFT:
            
this.collapseevent );
            break;
        case $.
ui.keyCode.RIGHT:
            if ( 
this.active && !this.active.is".ui-state-disabled" ) ) {
                
this.expandevent );
            }
            break;
        case $.
ui.keyCode.ENTER:
        case $.
ui.keyCode.SPACE:
            
this._activateevent );
            break;
        case $.
ui.keyCode.ESCAPE:
            
this.collapseevent );
            break;
        default:
            
preventDefault false;
            
prev this.previousFilter || "";
            
character String.fromCharCodeevent.keyCode );
            
skip false;

            
clearTimeoutthis.filterTimer );

            if ( 
character === prev ) {
                
skip true;
            } else {
                
character prev character;
            }

            
regex = new RegExp"^" escapecharacter ), "i" );
            
match this.activeMenu.children".ui-menu-item" ).filter(function() {
                return 
regex.test( $( this ).children"a" ).text() );
            });
            
match skip && match.indexthis.active.next() ) !== -?
                
this.active.nextAll".ui-menu-item" ) :
                
match;

            
// If no matches on the current filter, reset to the last character pressed
            // to move down the menu to the first item that starts with that character
            
if ( !match.length ) {
                
character String.fromCharCodeevent.keyCode );
                
regex = new RegExp"^" escapecharacter ), "i" );
                
match this.activeMenu.children".ui-menu-item" ).filter(function() {
                    return 
regex.test( $( this ).children"a" ).text() );
                });
            }

            if ( 
match.length ) {
                
this.focuseventmatch );
                if ( 
match.length ) {
                    
this.previousFilter character;
                    
this.filterTimer this._delay(function() {
                        
delete this.previousFilter;
                    }, 
1000 );
                } else {
                    
delete this.previousFilter;
                }
            } else {
                
delete this.previousFilter;
            }
        }

        if ( 
preventDefault ) {
            
event.preventDefault();
        }
    },

    
_activate: function( event ) {
        if ( !
this.active.is".ui-state-disabled" ) ) {
            if ( 
this.active.children"a[aria-haspopup='true']" ).length ) {
                
this.expandevent );
            } else {
                
this.selectevent );
            }
        }
    },

    
refresh: function() {
        var 
menus,
            
icon this.options.icons.submenu,
            
submenus this.element.findthis.options.menus );

        
// Initialize nested menus
        
submenus.filter":not(.ui-menu)" )
            .
addClass"ui-menu ui-widget ui-widget-content ui-corner-all" )
            .
hide()
            .
attr({
                
rolethis.options.role,
                
"aria-hidden""true",
                
"aria-expanded""false"
            
})
            .
each(function() {
                var 
menu = $( this ),
                    
item menu.prev"a" ),
                    
submenuCarat = $( "<span>" )
                        .
addClass"ui-menu-icon ui-icon " icon )
                        .
data"ui-menu-submenu-carat"true );

                
item
                    
.attr"aria-haspopup""true" )
                    .
prependsubmenuCarat );
                
menu.attr"aria-labelledby"item.attr"id" ) );
            });

        
menus submenus.addthis.element );

        
// Don't refresh list items that are already adapted
        
menus.children":not(.ui-menu-item):has(a)" )
            .
addClass"ui-menu-item" )
            .
attr"role""presentation" )
            .
children"a" )
                .
uniqueId()
                .
addClass"ui-corner-all" )
                .
attr({
                    
tabIndex: -1,
                    
rolethis._itemRole()
                });

        
// Initialize unlinked menu-items containing spaces and/or dashes only as dividers
        
menus.children":not(.ui-menu-item)" ).each(function() {
            var 
item = $( this );
            
// hyphen, em dash, en dash
            
if ( !/[^-u2014u2013s]/.testitem.text() ) ) {
                
item.addClass"ui-widget-content ui-menu-divider" );
            }
        });

        
// Add aria-disabled attribute to any disabled menu item
        
menus.children".ui-state-disabled" ).attr"aria-disabled""true" );

        
// If the active item has been removed, blur the menu
        
if ( this.active && !$.containsthis.element], this.active] ) ) {
            
this.blur();
        }
    },

    
_itemRole: function() {
        return {
            
menu"menuitem",
            
listbox"option"
        
}[ this.options.role ];
    },

    
_setOption: function( keyvalue ) {
        if ( 
key === "icons" ) {
            
this.element.find".ui-menu-icon" )
                .
removeClassthis.options.icons.submenu )
                .
addClassvalue.submenu );
        }
        
this._superkeyvalue );
    },

    
focus: function( eventitem ) {
        var 
nestedfocused;
        
this.blureventevent && event.type === "focus" );

        
this._scrollIntoViewitem );

        
this.active item.first();
        
focused this.active.children"a" ).addClass"ui-state-focus" );
        
// Only update aria-activedescendant if there's a role
        // otherwise we assume focus is managed elsewhere
        
if ( this.options.role ) {
            
this.element.attr"aria-activedescendant"focused.attr"id" ) );
        }

        
// Highlight active parent menu item, if any
        
this.active
            
.parent()
            .
closest".ui-menu-item" )
            .
children"a:first" )
            .
addClass"ui-state-active" );

        if ( 
event && event.type === "keydown" ) {
            
this._close();
        } else {
            
this.timer this._delay(function() {
                
this._close();
            }, 
this.delay );
        }

        
nested item.children".ui-menu" );
        if ( 
nested.length && ( /^mouse/.testevent.type ) ) ) {
            
this._startOpening(nested);
        }
        
this.activeMenu item.parent();

        
this._trigger"focus"event, { itemitem } );
    },

    
_scrollIntoView: function( item ) {
        var 
borderToppaddingTopoffsetscrollelementHeightitemHeight;
        if ( 
this._hasScroll() ) {
            
borderTop parseFloat( $.cssthis.activeMenu[0], "borderTopWidth" ) ) || 0;
            
paddingTop parseFloat( $.cssthis.activeMenu[0], "paddingTop" ) ) || 0;
            
offset item.offset().top this.activeMenu.offset().top borderTop paddingTop;
            
scroll this.activeMenu.scrollTop();
            
elementHeight this.activeMenu.height();
            
itemHeight item.height();

            if ( 
offset ) {
                
this.activeMenu.scrollTopscroll offset );
            } else if ( 
offset itemHeight elementHeight ) {
                
this.activeMenu.scrollTopscroll offset elementHeight itemHeight );
            }
        }
    },

    
blur: function( eventfromFocus ) {
        if ( !
fromFocus ) {
            
clearTimeoutthis.timer );
        }

        if ( !
this.active ) {
            return;
        }

        
this.active.children"a" ).removeClass"ui-state-focus" );
        
this.active null;

        
this._trigger"blur"event, { itemthis.active } );
    },

    
_startOpening: function( submenu ) {
        
clearTimeoutthis.timer );

        
// Don't open if already open fixes a Firefox bug that caused a .5 pixel
        // shift in the submenu position when mousing over the carat icon
        
if ( submenu.attr"aria-hidden" ) !== "true" ) {
            return;
        }

        
this.timer this._delay(function() {
            
this._close();
            
this._opensubmenu );
        }, 
this.delay );
    },

    
_open: function( submenu ) {
        var 
position = $.extend({
            
ofthis.active
        
}, this.options.position );

        
clearTimeoutthis.timer );
        
this.element.find".ui-menu" ).notsubmenu.parents".ui-menu" ) )
            .
hide()
            .
attr"aria-hidden""true" );

        
submenu
            
.show()
            .
removeAttr"aria-hidden" )
            .
attr"aria-expanded""true" )
            .
positionposition );
    },

    
collapseAll: function( eventall ) {
        
clearTimeoutthis.timer );
        
this.timer this._delay(function() {
            
// If we were passed an event, look for the submenu that contains the event
            
var currentMenu all this.element :
                $( 
event && event.target ).closestthis.element.find".ui-menu" ) );

            
// If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
            
if ( !currentMenu.length ) {
                
currentMenu this.element;
            }

            
this._closecurrentMenu );

            
this.blurevent );
            
this.activeMenu currentMenu;
        }, 
this.delay );
    },

    
// With no arguments, closes the currently active menu - if nothing is active
    // it closes all menus.  If passed an argument, it will search for menus BELOW
    
_close: function( startMenu ) {
        if ( !
startMenu ) {
            
startMenu this.active this.active.parent() : this.element;
        }

        
startMenu
            
.find".ui-menu" )
                .
hide()
                .
attr"aria-hidden""true" )
                .
attr"aria-expanded""false" )
            .
end()
            .
find"a.ui-state-active" )
                .
removeClass"ui-state-active" );
    },

    
collapse: function( event ) {
        var 
newItem this.active &&
            
this.active.parent().closest".ui-menu-item"this.element );
        if ( 
newItem && newItem.length ) {
            
this._close();
            
this.focuseventnewItem );
        }
    },

    
expand: function( event ) {
        var 
newItem this.active &&
            
this.active
                
.children".ui-menu " )
                .
children".ui-menu-item" )
                .
first();

        if ( 
newItem && newItem.length ) {
            
this._opennewItem.parent() );

            
// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
            
this._delay(function() {
                
this.focuseventnewItem );
            });
        }
    },

    
next: function( event ) {
        
this._move"next""first"event );
    },

    
previous: function( event ) {
        
this._move"prev""last"event );
    },

    
isFirstItem: function() {
        return 
this.active && !this.active.prevAll".ui-menu-item" ).length;
    },

    
isLastItem: function() {
        return 
this.active && !this.active.nextAll".ui-menu-item" ).length;
    },

    
_move: function( directionfilterevent ) {
        var 
next;
        if ( 
this.active ) {
            if ( 
direction === "first" || direction === "last" ) {
                
next this.active
                    
direction === "first" "prevAll" "nextAll" ]( ".ui-menu-item" )
                    .
eq( -);
            } else {
                
next this.active
                    
direction "All" ]( ".ui-menu-item" )
                    .
eq);
            }
        }
        if ( !
next || !next.length || !this.active ) {
            
next this.activeMenu.children".ui-menu-item" )[ filter ]();
        }

        
this.focuseventnext );
    },

    
nextPage: function( event ) {
        var 
itembaseheight;

        if ( !
this.active ) {
            
this.nextevent );
            return;
        }
        if ( 
this.isLastItem() ) {
            return;
        }
        if ( 
this._hasScroll() ) {
            
base this.active.offset().top;
            
height this.element.height();
            
this.active.nextAll".ui-menu-item" ).each(function() {
                
item = $( this );
                return 
item.offset().top base height 0;
            });

            
this.focuseventitem );
        } else {
            
this.focuseventthis.activeMenu.children".ui-menu-item" )
                [ !
this.active "first" "last" ]() );
        }
    },

    
previousPage: function( event ) {
        var 
itembaseheight;
        if ( !
this.active ) {
            
this.nextevent );
            return;
        }
        if ( 
this.isFirstItem() ) {
            return;
        }
        if ( 
this._hasScroll() ) {
            
base this.active.offset().top;
            
height this.element.height();
            
this.active.prevAll".ui-menu-item" ).each(function() {
                
item = $( this );
                return 
item.offset().top base height 0;
            });

            
this.focuseventitem );
        } else {
            
this.focuseventthis.activeMenu.children".ui-menu-item" ).first() );
        }
    },

    
_hasScroll: function() {
        return 
this.element.outerHeight() < this.element.prop"scrollHeight" );
    },

    
select: function( event ) {
        
// TODO: It should never be possible to not have an active item at this
        // point, but the tests don't trigger mouseenter before click.
        
this.active this.active || $( event.target ).closest".ui-menu-item" );
        var 
ui = { itemthis.active };
        if ( !
this.active.has".ui-menu" ).length ) {
            
this.collapseAlleventtrue );
        }
        
this._trigger"select"eventui );
    }
});

}( 
jQuery ));
(function( $, 
undefined ) {

$.
widget"ui.progressbar", {
    
version"1.10.1",
    
options: {
        
max100,
        
value0,

        
changenull,
        
completenull
    
},

    
min0,

    
_create: function() {
        
// Constrain initial value
        
this.oldValue this.options.value this._constrainedValue();

        
this.element
            
.addClass"ui-progressbar ui-widget ui-widget-content ui-corner-all" )
            .
attr({
                
// Only set static values, aria-valuenow and aria-valuemax are
                // set inside _refreshValue()
                
role"progressbar",
                
"aria-valuemin"this.min
            
});

        
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
            .
appendTothis.element );

        
this._refreshValue();
    },

    
_destroy: function() {
        
this.element
            
.removeClass"ui-progressbar ui-widget ui-widget-content ui-corner-all" )
            .
removeAttr"role" )
            .
removeAttr"aria-valuemin" )
            .
removeAttr"aria-valuemax" )
            .
removeAttr"aria-valuenow" );

        
this.valueDiv.remove();
    },

    
value: function( newValue ) {
        if ( 
newValue === undefined ) {
            return 
this.options.value;
        }

        
this.options.value this._constrainedValuenewValue );
        
this._refreshValue();
    },

    
_constrainedValue: function( newValue ) {
        if ( 
newValue === undefined ) {
            
newValue this.options.value;
        }

        
this.indeterminate newValue === false;

        
// sanitize value
        
if ( typeof newValue !== "number" ) {
            
newValue 0;
        }

        return 
this.indeterminate false :
            
Math.minthis.options.maxMath.maxthis.minnewValue ) );
    },

    
_setOptions: function( options ) {
        
// Ensure "value" option is set after other values (like max)
        
var value options.value;
        
delete options.value;

        
this._superoptions );

        
this.options.value this._constrainedValuevalue );
        
this._refreshValue();
    },

    
_setOption: function( keyvalue ) {
        if ( 
key === "max" ) {
            
// Don't allow a max less than min
            
value Math.maxthis.minvalue );
        }

        
this._superkeyvalue );
    },

    
_percentage: function() {
        return 
this.indeterminate 100 100 * ( this.options.value this.min ) / ( this.options.max this.min );
    },

    
_refreshValue: function() {
        var 
value this.options.value,
            
percentage this._percentage();

        
this.valueDiv
            
.togglethis.indeterminate || value this.min )
            .
toggleClass"ui-corner-right"value === this.options.max )
            .
widthpercentage.toFixed(0) + "%" );

        
this.element.toggleClass"ui-progressbar-indeterminate"this.indeterminate );

        if ( 
this.indeterminate ) {
            
this.element.removeAttr"aria-valuenow" );
            if ( !
this.overlayDiv ) {
                
this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTothis.valueDiv );
            }
        } else {
            
this.element.attr({
                
"aria-valuemax"this.options.max,
                
"aria-valuenow"value
            
});
            if ( 
this.overlayDiv ) {
                
this.overlayDiv.remove();
                
this.overlayDiv null;
            }
        }

        if ( 
this.oldValue !== value ) {
            
this.oldValue value;
            
this._trigger"change" );
        }
        if ( 
value === this.options.max ) {
            
this._trigger"complete" );
        }
    }
});

})( 
jQuery );
(function( $, 
undefined ) {

// number of pages in a slider
// (how many times can you page up/down to go through the whole range)
var numPages 5;

$.
widget"ui.slider", $.ui.mouse, {
    
version"1.10.1",
    
widgetEventPrefix"slide",

    
options: {
        
animatefalse,
        
distance0,
        
max100,
        
min0,
        
orientation"horizontal",
        
rangefalse,
        
step1,
        
value0,
        
valuesnull,

        
// callbacks
        
changenull,
        
slidenull,
        
startnull,
        
stopnull
    
},

    
_create: function() {
        
this._keySliding false;
        
this._mouseSliding false;
        
this._animateOff true;
        
this._handleIndex null;
        
this._detectOrientation();
        
this._mouseInit();

        
this.element
            
.addClass"ui-slider" +
                
" ui-slider-" this.orientation +
                
" ui-widget" +
                
" ui-widget-content" +
                
" ui-corner-all");

        
this._refresh();
        
this._setOption"disabled"this.options.disabled );

        
this._animateOff false;
    },

    
_refresh: function() {
        
this._createRange();
        
this._createHandles();
        
this._setupEvents();
        
this._refreshValue();
    },

    
_createHandles: function() {
        var 
ihandleCount,
            
options this.options,
            
existingHandles this.element.find".ui-slider-handle" ).addClass"ui-state-default ui-corner-all" ),
            
handle "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
            
handles = [];

        
handleCount = ( options.values && options.values.length ) || 1;

        if ( 
existingHandles.length handleCount ) {
            
existingHandles.slicehandleCount ).remove();
            
existingHandles existingHandles.slice0handleCount );
        }

        for ( 
existingHandles.lengthhandleCounti++ ) {
            
handles.pushhandle );
        }

        
this.handles existingHandles.add( $( handles.join"" ) ).appendTothis.element ) );

        
this.handle this.handles.eq);

        
this.handles.each(function( ) {
            $( 
this ).data"ui-slider-handle-index");
        });
    },

    
_createRange: function() {
        var 
options this.options,
            
classes "";

        if ( 
options.range ) {
            if ( 
options.range === true ) {
                if ( !
options.values ) {
                    
options.values = [ this._valueMin(), this._valueMin() ];
                } else if ( 
options.values.length && options.values.length !== ) {
                    
options.values = [ options.values[0], options.values[0] ];
                } else if ( $.
isArrayoptions.values ) ) {
                    
options.values options.values.slice(0);
                }
            }

            if ( !
this.range || !this.range.length ) {
                
this.range = $( "<div></div>" )
                    .
appendTothis.element );

                
classes "ui-slider-range" +
                
// note: this isn't the most fittingly semantic framework class for this element,
                // but worked best visually with a variety of themes
                
" ui-widget-header ui-corner-all";
            } else {
                
this.range.removeClass"ui-slider-range-min ui-slider-range-max" )
                    
// Handle range switching from true to min/max
                    
.css({
                        
"left""",
                        
"bottom"""
                    
});
            }

            
this.range.addClassclasses +
                ( ( 
options.range === "min" || options.range === "max" ) ? " ui-slider-range-" options.range "" ) );
        } else {
            
this.range = $([]);
        }
    },

    
_setupEvents: function() {
        var 
elements this.handles.addthis.range ).filter"a" );
        
this._offelements );
        
this._onelementsthis._handleEvents );
        
this._hoverableelements );
        
this._focusableelements );
    },

    
_destroy: function() {
        
this.handles.remove();
        
this.range.remove();

        
this.element
            
.removeClass"ui-slider" +
                
" ui-slider-horizontal" +
                
" ui-slider-vertical" +
                
" ui-widget" +
                
" ui-widget-content" +
                
" ui-corner-all" );

        
this._mouseDestroy();
    },

    
_mouseCapture: function( event ) {
        var 
positionnormValuedistanceclosestHandleindexallowedoffsetmouseOverHandle,
            
that this,
            
this.options;

        if ( 
o.disabled ) {
            return 
false;
        }

        
this.elementSize = {
            
widththis.element.outerWidth(),
            
heightthis.element.outerHeight()
        };
        
this.elementOffset this.element.offset();

        
position = { xevent.pageXyevent.pageY };
        
normValue this._normValueFromMouseposition );
        
distance this._valueMax() - this._valueMin() + 1;
        
this.handles.each(function( ) {
            var 
thisDistance Math.absnormValue that.values(i) );
            if (( 
distance thisDistance ) ||
                ( 
distance === thisDistance &&
                    (
=== that._lastChangedValue || that.values(i) === o.min ))) {
                
distance thisDistance;
                
closestHandle = $( this );
                
index i;
            }
        });

        
allowed this._starteventindex );
        if ( 
allowed === false ) {
            return 
false;
        }
        
this._mouseSliding true;

        
this._handleIndex index;

        
closestHandle
            
.addClass"ui-state-active" )
            .
focus();

        
offset closestHandle.offset();
        
mouseOverHandle = !$( event.target ).parents().addBack().is".ui-slider-handle" );
        
this._clickOffset mouseOverHandle ? { left0top} : {
            
leftevent.pageX offset.left - ( closestHandle.width() / ),
            
topevent.pageY offset.top -
                ( 
closestHandle.height() / ) -
                ( 
parseIntclosestHandle.css("borderTopWidth"), 10 ) || ) -
                ( 
parseIntclosestHandle.css("borderBottomWidth"), 10 ) || 0) +
                ( 
parseIntclosestHandle.css("marginTop"), 10 ) || 0)
        };

        if ( !
this.handles.hasClass"ui-state-hover" ) ) {
            
this._slideeventindexnormValue );
        }
        
this._animateOff true;
        return 
true;
    },

    
_mouseStart: function() {
        return 
true;
    },

    
_mouseDrag: function( event ) {
        var 
position = { xevent.pageXyevent.pageY },
            
normValue this._normValueFromMouseposition );

        
this._slideeventthis._handleIndexnormValue );

        return 
false;
    },

    
_mouseStop: function( event ) {
        
this.handles.removeClass"ui-state-active" );
        
this._mouseSliding false;

        
this._stopeventthis._handleIndex );
        
this._changeeventthis._handleIndex );

        
this._handleIndex null;
        
this._clickOffset null;
        
this._animateOff false;

        return 
false;
    },

    
_detectOrientation: function() {
        
this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" "horizontal";
    },

    
_normValueFromMouse: function( position ) {
        var 
pixelTotal,
            
pixelMouse,
            
percentMouse,
            
valueTotal,
            
valueMouse;

        if ( 
this.orientation === "horizontal" ) {
            
pixelTotal this.elementSize.width;
            
pixelMouse position.this.elementOffset.left - ( this._clickOffset this._clickOffset.left );
        } else {
            
pixelTotal this.elementSize.height;
            
pixelMouse position.this.elementOffset.top - ( this._clickOffset this._clickOffset.top );
        }

        
percentMouse = ( pixelMouse pixelTotal );
        if ( 
percentMouse ) {
            
percentMouse 1;
        }
        if ( 
percentMouse ) {
            
percentMouse 0;
        }
        if ( 
this.orientation === "vertical" ) {
            
percentMouse percentMouse;
        }

        
valueTotal this._valueMax() - this._valueMin();
        
valueMouse this._valueMin() + percentMouse valueTotal;

        return 
this._trimAlignValuevalueMouse );
    },

    
_start: function( eventindex ) {
        var 
uiHash = {
            
handlethis.handlesindex ],
            
valuethis.value()
        };
        if ( 
this.options.values && this.options.values.length ) {
            
uiHash.value this.valuesindex );
            
uiHash.values this.values();
        }
        return 
this._trigger"start"eventuiHash );
    },

    
_slide: function( eventindexnewVal ) {
        var 
otherVal,
            
newValues,
            
allowed;

        if ( 
this.options.values && this.options.values.length ) {
            
otherVal this.valuesindex );

            if ( ( 
this.options.values.length === && this.options.range === true ) &&
                    ( ( 
index === && newVal otherVal) || ( index === && newVal otherVal ) )
                ) {
                
newVal otherVal;
            }

            if ( 
newVal !== this.valuesindex ) ) {
                
newValues this.values();
                
newValuesindex ] = newVal;
                
// A slide can be canceled by returning false from the slide callback
                
allowed this._trigger"slide"event, {
                    
handlethis.handlesindex ],
                    
valuenewVal,
                    
valuesnewValues
                
} );
                
otherVal this.valuesindex );
                if ( 
allowed !== false ) {
                    
this.valuesindexnewValtrue );
                }
            }
        } else {
            if ( 
newVal !== this.value() ) {
                
// A slide can be canceled by returning false from the slide callback
                
allowed this._trigger"slide"event, {
                    
handlethis.handlesindex ],
                    
valuenewVal
                
} );
                if ( 
allowed !== false ) {
                    
this.valuenewVal );
                }
            }
        }
    },

    
_stop: function( eventindex ) {
        var 
uiHash = {
            
handlethis.handlesindex ],
            
valuethis.value()
        };
        if ( 
this.options.values && this.options.values.length ) {
            
uiHash.value this.valuesindex );
            
uiHash.values this.values();
        }

        
this._trigger"stop"eventuiHash );
    },

    
_change: function( eventindex ) {
        if ( !
this._keySliding && !this._mouseSliding ) {
            var 
uiHash = {
                
handlethis.handlesindex ],
                
valuethis.value()
            };
            if ( 
this.options.values && this.options.values.length ) {
                
uiHash.value this.valuesindex );
                
uiHash.values this.values();
            }

            
//store the last changed value index for reference when handles overlap
            
this._lastChangedValue index;

            
this._trigger"change"eventuiHash );
        }
    },

    
value: function( newValue ) {
        if ( 
arguments.length ) {
            
this.options.value this._trimAlignValuenewValue );
            
this._refreshValue();
            
this._changenull);
            return;
        }

        return 
this._value();
    },

    
values: function( indexnewValue ) {
        var 
vals,
            
newValues,
            
i;

        if ( 
arguments.length ) {
            
this.options.valuesindex ] = this._trimAlignValuenewValue );
            
this._refreshValue();
            
this._changenullindex );
            return;
        }

        if ( 
arguments.length ) {
            if ( $.
isArrayarguments] ) ) {
                
vals this.options.values;
                
newValues arguments];
                for ( 
0vals.length+= ) {
                    
vals] = this._trimAlignValuenewValues] );
                    
this._changenull);
                }
                
this._refreshValue();
            } else {
                if ( 
this.options.values && this.options.values.length ) {
                    return 
this._valuesindex );
                } else {
                    return 
this.value();
                }
            }
        } else {
            return 
this._values();
        }
    },

    
_setOption: function( keyvalue ) {
        var 
i,
            
valsLength 0;

        if ( 
key === "range" && this.options.range === true ) {
            if ( 
value === "min" ) {
                
this.options.value this._values);
                
this.options.values null;
            } else if ( 
value === "max" ) {
                
this.options.value this._valuesthis.options.values.length-);
                
this.options.values null;
            }
        }

        if ( $.
isArraythis.options.values ) ) {
            
valsLength this.options.values.length;
        }

        $.
Widget.prototype._setOption.applythisarguments );

        switch ( 
key ) {
            case 
"orientation":
                
this._detectOrientation();
                
this.element
                    
.removeClass"ui-slider-horizontal ui-slider-vertical" )
                    .
addClass"ui-slider-" this.orientation );
                
this._refreshValue();
                break;
            case 
"value":
                
this._animateOff true;
                
this._refreshValue();
                
this._changenull);
                
this._animateOff false;
                break;
            case 
"values":
                
this._animateOff true;
                
this._refreshValue();
                for ( 
0valsLength+= ) {
                    
this._changenull);
                }
                
this._animateOff false;
                break;
            case 
"min":
            case 
"max":
                
this._animateOff true;
                
this._refreshValue();
                
this._animateOff false;
                break;
            case 
"range":
                
this._animateOff true;
                
this._refresh();
                
this._animateOff false;
                break;
        }
    },

    
//internal value getter
    // _value() returns value trimmed by min and max, aligned by step
    
_value: function() {
        var 
val this.options.value;
        
val this._trimAlignValueval );

        return 
val;
    },

    
//internal values getter
    // _values() returns array of values trimmed by min and max, aligned by step
    // _values( index ) returns single value trimmed by min and max, aligned by step
    
_values: function( index ) {
        var 
val,
            
vals,
            
i;

        if ( 
arguments.length ) {
            
val this.options.valuesindex ];
            
val this._trimAlignValueval );

            return 
val;
        } else if ( 
this.options.values && this.options.values.length ) {
            
// .slice() creates a copy of the array
            // this copy gets trimmed by min and max and then returned
            
vals this.options.values.slice();
            for ( 
0vals.lengthi+= 1) {
                
vals] = this._trimAlignValuevals] );
            }

            return 
vals;
        } else {
            return [];
        }
    },

    
// returns the step-aligned value that val is closest to, between (inclusive) min and max
    
_trimAlignValue: function( val ) {
        if ( 
val <= this._valueMin() ) {
            return 
this._valueMin();
        }
        if ( 
val >= this._valueMax() ) {
            return 
this._valueMax();
        }
        var 
step = ( this.options.step ) ? this.options.step 1,
            
valModStep = (val this._valueMin()) % step,
            
alignValue val valModStep;

        if ( 
Math.abs(valModStep) * >= step ) {
            
alignValue += ( valModStep ) ? step : ( -step );
        }

        
// Since JavaScript has problems with large floats, round
        // the final value to 5 digits after the decimal point (see #4124)
        
return parseFloatalignValue.toFixed(5) );
    },

    
_valueMin: function() {
        return 
this.options.min;
    },

    
_valueMax: function() {
        return 
this.options.max;
    },

    
_refreshValue: function() {
        var 
lastValPercentvalPercentvaluevalueMinvalueMax,
            
oRange this.options.range,
            
this.options,
            
that this,
            
animate = ( !this._animateOff ) ? o.animate false,
            
_set = {};

        if ( 
this.options.values && this.options.values.length ) {
            
this.handles.each(function( ) {
                
valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
                
_setthat.orientation === "horizontal" "left" "bottom" ] = valPercent "%";
                $( 
this ).stop1)[ animate "animate" "css" ]( _seto.animate );
                if ( 
that.options.range === true ) {
                    if ( 
that.orientation === "horizontal" ) {
                        if ( 
=== ) {
                            
that.range.stop1)[ animate "animate" "css" ]( { leftvalPercent "%" }, o.animate );
                        }
                        if ( 
=== ) {
                            
that.rangeanimate "animate" "css" ]( { width: ( valPercent lastValPercent ) + "%" }, { queuefalsedurationo.animate } );
                        }
                    } else {
                        if ( 
=== ) {
                            
that.range.stop1)[ animate "animate" "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
                        }
                        if ( 
=== ) {
                            
that.rangeanimate "animate" "css" ]( { height: ( valPercent lastValPercent ) + "%" }, { queuefalsedurationo.animate } );
                        }
                    }
                }
                
lastValPercent valPercent;
            });
        } else {
            
value this.value();
            
valueMin this._valueMin();
            
valueMax this._valueMax();
            
valPercent = ( valueMax !== valueMin ) ?
                    ( 
value valueMin ) / ( valueMax valueMin ) * 100 :
                    
0;
            
_setthis.orientation === "horizontal" "left" "bottom" ] = valPercent "%";
            
this.handle.stop1)[ animate "animate" "css" ]( _seto.animate );

            if ( 
oRange === "min" && this.orientation === "horizontal" ) {
                
this.range.stop1)[ animate "animate" "css" ]( { widthvalPercent "%" }, o.animate );
            }
            if ( 
oRange === "max" && this.orientation === "horizontal" ) {
                
this.rangeanimate "animate" "css" ]( { width: ( 100 valPercent ) + "%" }, { queuefalsedurationo.animate } );
            }
            if ( 
oRange === "min" && this.orientation === "vertical" ) {
                
this.range.stop1)[ animate "animate" "css" ]( { heightvalPercent "%" }, o.animate );
            }
            if ( 
oRange === "max" && this.orientation === "vertical" ) {
                
this.rangeanimate "animate" "css" ]( { height: ( 100 valPercent ) + "%" }, { queuefalsedurationo.animate } );
            }
        }
    },

    
_handleEvents: {
        
keydown: function( event ) {
            
/*jshint maxcomplexity:25*/
            
var allowedcurValnewValstep,
                
index = $( event.target ).data"ui-slider-handle-index" );

            switch ( 
event.keyCode ) {
                case $.
ui.keyCode.HOME:
                case $.
ui.keyCode.END:
                case $.
ui.keyCode.PAGE_UP:
                case $.
ui.keyCode.PAGE_DOWN:
                case $.
ui.keyCode.UP:
                case $.
ui.keyCode.RIGHT:
                case $.
ui.keyCode.DOWN:
                case $.
ui.keyCode.LEFT:
                    
event.preventDefault();
                    if ( !
this._keySliding ) {
                        
this._keySliding true;
                        $( 
event.target ).addClass"ui-state-active" );
                        
allowed this._starteventindex );
                        if ( 
allowed === false ) {
                            return;
                        }
                    }
                    break;
            }

            
step this.options.step;
            if ( 
this.options.values && this.options.values.length ) {
                
curVal newVal this.valuesindex );
            } else {
                
curVal newVal this.value();
            }

            switch ( 
event.keyCode ) {
                case $.
ui.keyCode.HOME:
                    
newVal this._valueMin();
                    break;
                case $.
ui.keyCode.END:
                    
newVal this._valueMax();
                    break;
                case $.
ui.keyCode.PAGE_UP:
                    
newVal this._trimAlignValuecurVal + ( (this._valueMax() - this._valueMin()) / numPages ) );
                    break;
                case $.
ui.keyCode.PAGE_DOWN:
                    
newVal this._trimAlignValuecurVal - ( (this._valueMax() - this._valueMin()) / numPages ) );
                    break;
                case $.
ui.keyCode.UP:
                case $.
ui.keyCode.RIGHT:
                    if ( 
curVal === this._valueMax() ) {
                        return;
                    }
                    
newVal this._trimAlignValuecurVal step );
                    break;
                case $.
ui.keyCode.DOWN:
                case $.
ui.keyCode.LEFT:
                    if ( 
curVal === this._valueMin() ) {
                        return;
                    }
                    
newVal this._trimAlignValuecurVal step );
                    break;
            }

            
this._slideeventindexnewVal );
        },
        
click: function( event ) {
            
event.preventDefault();
        },
        
keyup: function( event ) {
            var 
index = $( event.target ).data"ui-slider-handle-index" );

            if ( 
this._keySliding ) {
                
this._keySliding false;
                
this._stopeventindex );
                
this._changeeventindex );
                $( 
event.target ).removeClass"ui-state-active" );
            }
        }
    }

});

}(
jQuery));
(function( $ ) {

function 
modifier( fn ) {
    return function() {
        var 
previous this.element.val();
        fn.
applythisarguments );
        
this._refresh();
        if ( 
previous !== this.element.val() ) {
            
this._trigger"change" );
        }
    };
}

$.
widget"ui.spinner", {
    
version"1.10.1",
    
defaultElement"<input>",
    
widgetEventPrefix"spin",
    
options: {
        
culturenull,
        
icons: {
            
down"ui-icon-triangle-1-s",
            
up"ui-icon-triangle-1-n"
        
},
        
incrementaltrue,
        
maxnull,
        
minnull,
        
numberFormatnull,
        
page10,
        
step1,

        
changenull,
        
spinnull,
        
startnull,
        
stopnull
    
},

    
_create: function() {
        
// handle string values that need to be parsed
        
this._setOption"max"this.options.max );
        
this._setOption"min"this.options.min );
        
this._setOption"step"this.options.step );

        
// format the value, but don't constrain
        
this._valuethis.element.val(), true );

        
this._draw();
        
this._onthis._events );
        
this._refresh();

        
// turning off autocomplete prevents the browser from remembering the
        // value when navigating through history, so we re-enable autocomplete
        // if the page is unloaded before the widget is destroyed. #7790
        
this._onthis.window, {
            
beforeunload: function() {
                
this.element.removeAttr"autocomplete" );
            }
        });
    },

    
_getCreateOptions: function() {
        var 
options = {},
            
element this.element;

        $.
each( [ "min""max""step" ], function( ioption ) {
            var 
value element.attroption );
            if ( 
value !== undefined && value.length ) {
                
optionsoption ] = value;
            }
        });

        return 
options;
    },

    
_events: {
        
keydown: function( event ) {
            if ( 
this._startevent ) && this._keydownevent ) ) {
                
event.preventDefault();
            }
        },
        
keyup"_stop",
        
focus: function() {
            
this.previous this.element.val();
        },
        
blur: function( event ) {
            if ( 
this.cancelBlur ) {
                
delete this.cancelBlur;
                return;
            }

            
this._refresh();
            if ( 
this.previous !== this.element.val() ) {
                
this._trigger"change"event );
            }
        },
        
mousewheel: function( eventdelta ) {
            if ( !
delta ) {
                return;
            }
            if ( !
this.spinning && !this._startevent ) ) {
                return 
false;
            }

            
this._spin( (delta : -1) * this.options.stepevent );
            
clearTimeoutthis.mousewheelTimer );
            
this.mousewheelTimer this._delay(function() {
                if ( 
this.spinning ) {
                    
this._stopevent );
                }
            }, 
100 );
            
event.preventDefault();
        },
        
"mousedown .ui-spinner-button": function( event ) {
            var 
previous;

            
// We never want the buttons to have focus; whenever the user is
            // interacting with the spinner, the focus should be on the input.
            // If the input is focused then this.previous is properly set from
            // when the input first received focus. If the input is not focused
            // then we need to set this.previous based on the value before spinning.
            
previous this.element[0] === this.document[0].activeElement ?
                
this.previous this.element.val();
            function 
checkFocus() {
                var 
isActive this.element[0] === this.document[0].activeElement;
                if ( !
isActive ) {
                    
this.element.focus();
                    
this.previous previous;
                    
// support: IE
                    // IE sets focus asynchronously, so we need to check if focus
                    // moved off of the input because the user clicked on the button.
                    
this._delay(function() {
                        
this.previous previous;
                    });
                }
            }

            
// ensure focus is on (or stays on) the text field
            
event.preventDefault();
            
checkFocus.callthis );

            
// support: IE
            // IE doesn't prevent moving focus even with event.preventDefault()
            // so we set a flag to know when we should ignore the blur event
            // and check (again) if focus moved off of the input.
            
this.cancelBlur true;
            
this._delay(function() {
                
delete this.cancelBlur;
                
checkFocus.callthis );
            });

            if ( 
this._startevent ) === false ) {
                return;
            }

            
this._repeatnull, $( event.currentTarget ).hasClass"ui-spinner-up" ) ? : -1event );
        },
        
"mouseup .ui-spinner-button""_stop",
        
"mouseenter .ui-spinner-button": function( event ) {
            
// button will add ui-state-active if mouse was down while mouseleave and kept down
            
if ( !$( event.currentTarget ).hasClass"ui-state-active" ) ) {
                return;
            }

            if ( 
this._startevent ) === false ) {
                return 
false;
            }
            
this._repeatnull, $( event.currentTarget ).hasClass"ui-spinner-up" ) ? : -1event );
        },
        
// TODO: do we really want to consider this a stop?
        // shouldn't we just stop the repeater and wait until mouseup before
        // we trigger the stop event?
        
"mouseleave .ui-spinner-button""_stop"
    
},

    
_draw: function() {
        var 
uiSpinner this.uiSpinner this.element
            
.addClass"ui-spinner-input" )
            .
attr"autocomplete""off" )
            .
wrapthis._uiSpinnerHtml() )
            .
parent()
                
// add buttons
                
.appendthis._buttonHtml() );

        
this.element.attr"role""spinbutton" );

        
// button bindings
        
this.buttons uiSpinner.find".ui-spinner-button" )
            .
attr"tabIndex", -)
            .
button()
            .
removeClass"ui-corner-all" );

        
// IE 6 doesn't understand height: 50% for the buttons
        // unless the wrapper has an explicit height
        
if ( this.buttons.height() > Math.ceiluiSpinner.height() * 0.5 ) &&
                
uiSpinner.height() > ) {
            
uiSpinner.heightuiSpinner.height() );
        }

        
// disable spinner if element was already disabled
        
if ( this.options.disabled ) {
            
this.disable();
        }
    },

    
_keydown: function( event ) {
        var 
options this.options,
            
keyCode = $.ui.keyCode;

        switch ( 
event.keyCode ) {
        case 
keyCode.UP:
            
this._repeatnull1event );
            return 
true;
        case 
keyCode.DOWN:
            
this._repeatnull, -1event );
            return 
true;
        case 
keyCode.PAGE_UP:
            
this._repeatnulloptions.pageevent );
            return 
true;
        case 
keyCode.PAGE_DOWN:
            
this._repeatnull, -options.pageevent );
            return 
true;
        }

        return 
false;
    },

    
_uiSpinnerHtml: function() {
        return 
"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";
    },

    
_buttonHtml: function() {
        return 
"" +
            
"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
                
"<span class='ui-icon " this.options.icons.up "'>&#9650;</span>" +
            
"</a>" +
            
"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
                
"<span class='ui-icon " this.options.icons.down "'>&#9660;</span>" +
            
"</a>";
    },

    
_start: function( event ) {
        if ( !
this.spinning && this._trigger"start"event ) === false ) {
            return 
false;
        }

        if ( !
this.counter ) {
            
this.counter 1;
        }
        
this.spinning true;
        return 
true;
    },

    
_repeat: function( istepsevent ) {
        
|| 500;

        
clearTimeoutthis.timer );
        
this.timer this._delay(function() {
            
this._repeat40stepsevent );
        }, 
);

        
this._spinsteps this.options.stepevent );
    },

    
_spin: function( stepevent ) {
        var 
value this.value() || 0;

        if ( !
this.counter ) {
            
this.counter 1;
        }

        
value this._adjustValuevalue step this._incrementthis.counter ) );

        if ( !
this.spinning || this._trigger"spin"event, { valuevalue } ) !== false) {
            
this._valuevalue );
            
this.counter++;
        }
    },

    
_increment: function( ) {
        var 
incremental this.options.incremental;

        if ( 
incremental ) {
            return $.
isFunctionincremental ) ?
                
incremental) :
                
Math.floori*i*i/50000 i*i/500 17*i/200 );
        }

        return 
1;
    },

    
_precision: function() {
        var 
precision this._precisionOfthis.options.step );
        if ( 
this.options.min !== null ) {
            
precision Math.maxprecisionthis._precisionOfthis.options.min ) );
        }
        return 
precision;
    },

    
_precisionOf: function( num ) {
        var 
str num.toString(),
            
decimal str.indexOf"." );
        return 
decimal === -str.length decimal 1;
    },

    
_adjustValue: function( value ) {
        var 
baseaboveMin,
            
options this.options;

        
// make sure we're at a valid step
        // - find out where we are relative to the base (min or 0)
        
base options.min !== null options.min 0;
        
aboveMin value base;
        
// - round to the nearest step
        
aboveMin Math.round(aboveMin options.step) * options.step;
        
// - rounding is based on 0, so adjust back to our base
        
value base aboveMin;

        
// fix precision from bad JS floating point math
        
value parseFloatvalue.toFixedthis._precision() ) );

        
// clamp the value
        
if ( options.max !== null && value options.max) {
            return 
options.max;
        }
        if ( 
options.min !== null && value options.min ) {
            return 
options.min;
        }

        return 
value;
    },

    
_stop: function( event ) {
        if ( !
this.spinning ) {
            return;
        }

        
clearTimeoutthis.timer );
        
clearTimeoutthis.mousewheelTimer );
        
this.counter 0;
        
this.spinning false;
        
this._trigger"stop"event );
    },

    
_setOption: function( keyvalue ) {
        if ( 
key === "culture" || key === "numberFormat" ) {
            var 
prevValue this._parsethis.element.val() );
            
this.optionskey ] = value;
            
this.element.valthis._formatprevValue ) );
            return;
        }

        if ( 
key === "max" || key === "min" || key === "step" ) {
            if ( 
typeof value === "string" ) {
                
value this._parsevalue );
            }
        }
        if ( 
key === "icons" ) {
            
this.buttons.first().find".ui-icon" )
                .
removeClassthis.options.icons.up )
                .
addClassvalue.up );
            
this.buttons.last().find".ui-icon" )
                .
removeClassthis.options.icons.down )
                .
addClassvalue.down );
        }

        
this._superkeyvalue );

        if ( 
key === "disabled" ) {
            if ( 
value ) {
                
this.element.prop"disabled"true );
                
this.buttons.button"disable" );
            } else {
                
this.element.prop"disabled"false );
                
this.buttons.button"enable" );
            }
        }
    },

    
_setOptionsmodifier(function( options ) {
        
this._superoptions );
        
this._valuethis.element.val() );
    }),

    
_parse: function( val ) {
        if ( 
typeof val === "string" && val !== "" ) {
            
val window.Globalize && this.options.numberFormat ?
                
Globalize.parseFloatval10this.options.culture ) : +val;
        }
        return 
val === "" || isNaNval ) ? null val;
    },

    
_format: function( value ) {
        if ( 
value === "" ) {
            return 
"";
        }
        return 
window.Globalize && this.options.numberFormat ?
            
Globalize.formatvaluethis.options.numberFormatthis.options.culture ) :
            
value;
    },

    
_refresh: function() {
        
this.element.attr({
            
"aria-valuemin"this.options.min,
            
"aria-valuemax"this.options.max,
            
// TODO: what should we do with values that can't be parsed?
            
"aria-valuenow"this._parsethis.element.val() )
        });
    },

    
// update the value without triggering change
    
_value: function( valueallowAny ) {
        var 
parsed;
        if ( 
value !== "" ) {
            
parsed this._parsevalue );
            if ( 
parsed !== null ) {
                if ( !
allowAny ) {
                    
parsed this._adjustValueparsed );
                }
                
value this._formatparsed );
            }
        }
        
this.element.valvalue );
        
this._refresh();
    },

    
_destroy: function() {
        
this.element
            
.removeClass"ui-spinner-input" )
            .
prop"disabled"false )
            .
removeAttr"autocomplete" )
            .
removeAttr"role" )
            .
removeAttr"aria-valuemin" )
            .
removeAttr"aria-valuemax" )
            .
removeAttr"aria-valuenow" );
        
this.uiSpinner.replaceWiththis.element );
    },

    
stepUpmodifier(function( steps ) {
        
this._stepUpsteps );
    }),
    
_stepUp: function( steps ) {
        if ( 
this._start() ) {
            
this._spin( (steps || 1) * this.options.step );
            
this._stop();
        }
    },

    
stepDownmodifier(function( steps ) {
        
this._stepDownsteps );
    }),
    
_stepDown: function( steps ) {
        if ( 
this._start() ) {
            
this._spin( (steps || 1) * -this.options.step );
            
this._stop();
        }
    },

    
pageUpmodifier(function( pages ) {
        
this._stepUp( (pages || 1) * this.options.page );
    }),

    
pageDownmodifier(function( pages ) {
        
this._stepDown( (pages || 1) * this.options.page );
    }),

    
value: function( newVal ) {
        if ( !
arguments.length ) {
            return 
this._parsethis.element.val() );
        }
        
modifierthis._value ).callthisnewVal );
    },

    
widget: function() {
        return 
this.uiSpinner;
    }
});

}( 
jQuery ) );
(function( $, 
undefined ) {

var 
tabId 0,
    
rhash = /#.*$/;

function getNextTabId() {
    return ++
tabId;
}

function 
isLocalanchor ) {
    return 
anchor.hash.length &&
        
decodeURIComponentanchor.href.replacerhash"" ) ) ===
            
decodeURIComponentlocation.href.replacerhash"" ) );
}

$.
widget"ui.tabs", {
    
version"1.10.1",
    
delay300,
    
options: {
        
activenull,
        
collapsiblefalse,
        
event"click",
        
heightStyle"content",
        
hidenull,
        
shownull,

        
// callbacks
        
activatenull,
        
beforeActivatenull,
        
beforeLoadnull,
        
loadnull
    
},

    
_create: function() {
        var 
that this,
            
options this.options;

        
this.running false;

        
this.element
            
.addClass"ui-tabs ui-widget ui-widget-content ui-corner-all" )
            .
toggleClass"ui-tabs-collapsible"options.collapsible )
            
// Prevent users from focusing disabled tabs via click
            
.delegate".ui-tabs-nav > li""mousedown" this.eventNamespace, function( event ) {
                if ( $( 
this ).is".ui-state-disabled" ) ) {
                    
event.preventDefault();
                }
            })
            
// support: IE <9
            // Preventing the default action in mousedown doesn't prevent IE
            // from focusing the element, so if the anchor gets focused, blur.
            // We don't have to worry about focusing the previously focused
            // element since clicking on a non-focusable element should focus
            // the body anyway.
            
.delegate".ui-tabs-anchor""focus" this.eventNamespace, function() {
                if ( $( 
this ).closest"li" ).is".ui-state-disabled" ) ) {
                    
this.blur();
                }
            });

        
this._processTabs();
        
options.active this._initialActive();

        
// Take disabling tabs via class attribute from HTML
        // into account and update option properly.
        
if ( $.isArrayoptions.disabled ) ) {
            
options.disabled = $.uniqueoptions.disabled.concat(
                $.
mapthis.tabs.filter".ui-state-disabled" ), function( li ) {
                    return 
that.tabs.indexli );
                })
            ) ).
sort();
        }

        
// check for length avoids error when initializing empty list
        
if ( this.options.active !== false && this.anchors.length ) {
            
this.active this._findActiveoptions.active );
        } else {
            
this.active = $();
        }

        
this._refresh();

        if ( 
this.active.length ) {
            
this.loadoptions.active );
        }
    },

    
_initialActive: function() {
        var 
active this.options.active,
            
collapsible this.options.collapsible,
            
locationHash location.hash.substring);

        if ( 
active === null ) {
            
// check the fragment identifier in the URL
            
if ( locationHash ) {
                
this.tabs.each(function( itab ) {
                    if ( $( 
tab ).attr"aria-controls" ) === locationHash ) {
                        
active i;
                        return 
false;
                    }
                });
            }

            
// check for a tab marked active via a class
            
if ( active === null ) {
                
active this.tabs.indexthis.tabs.filter".ui-tabs-active" ) );
            }

            
// no active tab, set to false
            
if ( active === null || active === -) {
                
active this.tabs.length false;
            }
        }

        
// handle numbers: negative, out of range
        
if ( active !== false ) {
            
active this.tabs.indexthis.tabs.eqactive ) );
            if ( 
active === -) {
                
active collapsible false 0;
            }
        }

        
// don't allow collapsible: false and active: false
        
if ( !collapsible && active === false && this.anchors.length ) {
            
active 0;
        }

        return 
active;
    },

    
_getCreateEventData: function() {
        return {
            
tabthis.active,
            
panel: !this.active.length ? $() : this._getPanelForTabthis.active )
        };
    },

    
_tabKeydown: function( event ) {
        
/*jshint maxcomplexity:15*/
        
var focusedTab = $( this.document[0].activeElement ).closest"li" ),
            
selectedIndex this.tabs.indexfocusedTab ),
            
goingForward true;

        if ( 
this._handlePageNavevent ) ) {
            return;
        }

        switch ( 
event.keyCode ) {
            case $.
ui.keyCode.RIGHT:
            case $.
ui.keyCode.DOWN:
                
selectedIndex++;
                break;
            case $.
ui.keyCode.UP:
            case $.
ui.keyCode.LEFT:
                
goingForward false;
                
selectedIndex--;
                break;
            case $.
ui.keyCode.END:
                
selectedIndex this.anchors.length 1;
                break;
            case $.
ui.keyCode.HOME:
                
selectedIndex 0;
                break;
            case $.
ui.keyCode.SPACE:
                
// Activate only, no collapsing
                
event.preventDefault();
                
clearTimeoutthis.activating );
                
this._activateselectedIndex );
                return;
            case $.
ui.keyCode.ENTER:
                
// Toggle (cancel delayed activation, allow collapsing)
                
event.preventDefault();
                
clearTimeoutthis.activating );
                
// Determine if we should collapse or activate
                
this._activateselectedIndex === this.options.active false selectedIndex );
                return;
            default:
                return;
        }

        
// Focus the appropriate tab, based on which key was pressed
        
event.preventDefault();
        
clearTimeoutthis.activating );
        
selectedIndex this._focusNextTabselectedIndexgoingForward );

        
// Navigating with control key will prevent automatic activation
        
if ( !event.ctrlKey ) {
            
// Update aria-selected immediately so that AT think the tab is already selected.
            // Otherwise AT may confuse the user by stating that they need to activate the tab,
            // but the tab will already be activated by the time the announcement finishes.
            
focusedTab.attr"aria-selected""false" );
            
this.tabs.eqselectedIndex ).attr"aria-selected""true" );

            
this.activating this._delay(function() {
                
this.option"active"selectedIndex );
            }, 
this.delay );
        }
    },

    
_panelKeydown: function( event ) {
        if ( 
this._handlePageNavevent ) ) {
            return;
        }

        
// Ctrl+up moves focus to the current tab
        
if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
            
event.preventDefault();
            
this.active.focus();
        }
    },

    
// Alt+page up/down moves focus to the previous/next tab (and activates)
    
_handlePageNav: function( event ) {
        if ( 
event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
            
this._activatethis._focusNextTabthis.options.active 1false ) );
            return 
true;
        }
        if ( 
event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
            
this._activatethis._focusNextTabthis.options.active 1true ) );
            return 
true;
        }
    },

    
_findNextTab: function( indexgoingForward ) {
        var 
lastTabIndex this.tabs.length 1;

        function 
constrain() {
            if ( 
index lastTabIndex ) {
                
index 0;
            }
            if ( 
index ) {
                
index lastTabIndex;
            }
            return 
index;
        }

        while ( $.
inArrayconstrain(), this.options.disabled ) !== -) {
            
index goingForward index index 1;
        }

        return 
index;
    },

    
_focusNextTab: function( indexgoingForward ) {
        
index this._findNextTabindexgoingForward );
        
this.tabs.eqindex ).focus();
        return 
index;
    },

    
_setOption: function( keyvalue ) {
        if ( 
key === "active" ) {
            
// _activate() will handle invalid values and update this.options
            
this._activatevalue );
            return;
        }

        if ( 
key === "disabled" ) {
            
// don't use the widget factory's disabled handling
            
this._setupDisabledvalue );
            return;
        }

        
this._superkeyvalue);

        if ( 
key === "collapsible" ) {
            
this.element.toggleClass"ui-tabs-collapsible"value );
            
// Setting collapsible: false while collapsed; open first panel
            
if ( !value && this.options.active === false ) {
                
this._activate);
            }
        }

        if ( 
key === "event" ) {
            
this._setupEventsvalue );
        }

        if ( 
key === "heightStyle" ) {
            
this._setupHeightStylevalue );
        }
    },

    
_tabId: function( tab ) {
        return 
tab.attr"aria-controls" ) || "ui-tabs-" getNextTabId();
    },

    
_sanitizeSelector: function( hash ) {
        return 
hash hash.replace( /[!"$%&'()*+,./:;<=>?@[]^`{|}~]/g, "\$&" ) : "";
    },

    refresh: function() {
        var options = this.options,
            lis = this.tablist.children( "
:has(a[href])" );

        // get disabled tabs from class attribute from HTML
        // this will get converted to a boolean if needed in _refresh()
        options.disabled = $.map( lis.filter( "
.ui-state-disabled" ), function( tab ) {
            return lis.index( tab );
        });

        this._processTabs();

        // was collapsed or no tabs
        if ( options.active === false || !this.anchors.length ) {
            options.active = false;
            this.active = $();
        // was active, but active tab is gone
        } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
            // all remaining tabs are disabled
            if ( this.tabs.length === options.disabled.length ) {
                options.active = false;
                this.active = $();
            // activate previous tab
            } else {
                this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
            }
        // was active, active tab still exists
        } else {
            // make sure active index is correct
            options.active = this.tabs.index( this.active );
        }

        this._refresh();
    },

    _refresh: function() {
        this._setupDisabled( this.options.disabled );
        this._setupEvents( this.options.event );
        this._setupHeightStyle( this.options.heightStyle );

        this.tabs.not( this.active ).attr({
            "
aria-selected": "false",
            tabIndex: -1
        });
        this.panels.not( this._getPanelForTab( this.active ) )
            .hide()
            .attr({
                "
aria-expanded": "false",
                "
aria-hidden": "true"
            });

        // Make sure one tab is in the tab order
        if ( !this.active.length ) {
            this.tabs.eq( 0 ).attr( "
tabIndex", 0 );
        } else {
            this.active
                .addClass( "
ui-tabs-active ui-state-active" )
                .attr({
                    "
aria-selected": "true",
                    tabIndex: 0
                });
            this._getPanelForTab( this.active )
                .show()
                .attr({
                    "
aria-expanded": "true",
                    "
aria-hidden": "false"
                });
        }
    },

    _processTabs: function() {
        var that = this;

        this.tablist = this._getList()
            .addClass( "
ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
            .attr( "
role", "tablist" );

        this.tabs = this.tablist.find( "
li:has(a[href])" )
            .addClass( "
ui-state-default ui-corner-top" )
            .attr({
                role: "
tab",
                tabIndex: -1
            });

        this.anchors = this.tabs.map(function() {
                return $( "
a", this )[ 0 ];
            })
            .addClass( "
ui-tabs-anchor" )
            .attr({
                role: "
presentation",
                tabIndex: -1
            });

        this.panels = $();

        this.anchors.each(function( i, anchor ) {
            var selector, panel, panelId,
                anchorId = $( anchor ).uniqueId().attr( "
id" ),
                tab = $( anchor ).closest( "
li" ),
                originalAriaControls = tab.attr( "
aria-controls" );

            // inline tab
            if ( isLocal( anchor ) ) {
                selector = anchor.hash;
                panel = that.element.find( that._sanitizeSelector( selector ) );
            // remote tab
            } else {
                panelId = that._tabId( tab );
                selector = "
#" + panelId;
                
panel that.element.findselector );
                if ( !
panel.length ) {
                    
panel that._createPanelpanelId );
                    
panel.insertAfterthat.panels] || that.tablist );
                }
                
panel.attr"aria-live""polite" );
            }

            if ( 
panel.length) {
                
that.panels that.panels.addpanel );
            }
            if ( 
originalAriaControls ) {
                
tab.data"ui-tabs-aria-controls"originalAriaControls );
            }
            
tab.attr({
                
"aria-controls"selector.substring),
                
"aria-labelledby"anchorId
            
});
            
panel.attr"aria-labelledby"anchorId );
        });

        
this.panels
            
.addClass"ui-tabs-panel ui-widget-content ui-corner-bottom" )
            .
attr"role""tabpanel" );
    },

    
// allow overriding how to find the list for rare usage scenarios (#7715)
    
_getList: function() {
        return 
this.element.find"ol,ul" ).eq);
    },

    
_createPanel: function( id ) {
        return $( 
"<div>" )
            .
attr"id"id )
            .
addClass"ui-tabs-panel ui-widget-content ui-corner-bottom" )
            .
data"ui-tabs-destroy"true );
    },

    
_setupDisabled: function( disabled ) {
        if ( $.
isArraydisabled ) ) {
            if ( !
disabled.length ) {
                
disabled false;
            } else if ( 
disabled.length === this.anchors.length ) {
                
disabled true;
            }
        }

        
// disable tabs
        
for ( var 0li; ( li this.tabs] ); i++ ) {
            if ( 
disabled === true || $.inArrayidisabled ) !== -) {
                $( 
li )
                    .
addClass"ui-state-disabled" )
                    .
attr"aria-disabled""true" );
            } else {
                $( 
li )
                    .
removeClass"ui-state-disabled" )
                    .
removeAttr"aria-disabled" );
            }
        }

        
this.options.disabled disabled;
    },

    
_setupEvents: function( event ) {
        var 
events = {
            
click: function( event ) {
                
event.preventDefault();
            }
        };
        if ( 
event ) {
            $.
eachevent.split(" "), function( indexeventName ) {
                
eventseventName ] = "_eventHandler";
            });
        }

        
this._offthis.anchors.addthis.tabs ).addthis.panels ) );
        
this._onthis.anchorsevents );
        
this._onthis.tabs, { keydown"_tabKeydown" } );
        
this._onthis.panels, { keydown"_panelKeydown" } );

        
this._focusablethis.tabs );
        
this._hoverablethis.tabs );
    },

    
_setupHeightStyle: function( heightStyle ) {
        var 
maxHeight,
            
parent this.element.parent();

        if ( 
heightStyle === "fill" ) {
            
maxHeight parent.height();
            
maxHeight -= this.element.outerHeight() - this.element.height();

            
this.element.siblings":visible" ).each(function() {
                var 
elem = $( this ),
                    
position elem.css"position" );

                if ( 
position === "absolute" || position === "fixed" ) {
                    return;
                }
                
maxHeight -= elem.outerHeighttrue );
            });

            
this.element.children().notthis.panels ).each(function() {
                
maxHeight -= $( this ).outerHeighttrue );
            });

            
this.panels.each(function() {
                $( 
this ).heightMath.max0maxHeight -
                    $( 
this ).innerHeight() + $( this ).height() ) );
            })
            .
css"overflow""auto" );
        } else if ( 
heightStyle === "auto" ) {
            
maxHeight 0;
            
this.panels.each(function() {
                
maxHeight Math.maxmaxHeight, $( this ).height"" ).height() );
            }).
heightmaxHeight );
        }
    },

    
_eventHandler: function( event ) {
        var 
options this.options,
            
active this.active,
            
anchor = $( event.currentTarget ),
            
tab anchor.closest"li" ),
            
clickedIsActive tab] === active],
            
collapsing clickedIsActive && options.collapsible,
            
toShow collapsing ? $() : this._getPanelForTabtab ),
            
toHide = !active.length ? $() : this._getPanelForTabactive ),
            
eventData = {
                
oldTabactive,
                
oldPaneltoHide,
                
newTabcollapsing ? $() : tab,
                
newPaneltoShow
            
};

        
event.preventDefault();

        if ( 
tab.hasClass"ui-state-disabled" ) ||
                
// tab is already loading
                
tab.hasClass"ui-tabs-loading" ) ||
                
// can't switch durning an animation
                
this.running ||
                
// click on active header, but not collapsible
                
clickedIsActive && !options.collapsible ) ||
                
// allow canceling activation
                
this._trigger"beforeActivate"eventeventData ) === false ) ) {
            return;
        }

        
options.active collapsing false this.tabs.indextab );

        
this.active clickedIsActive ? $() : tab;
        if ( 
this.xhr ) {
            
this.xhr.abort();
        }

        if ( !
toHide.length && !toShow.length ) {
            $.
error"jQuery UI Tabs: Mismatching fragment identifier." );
        }

        if ( 
toShow.length ) {
            
this.loadthis.tabs.indextab ), event );
        }
        
this._toggleeventeventData );
    },

    
// handles show/hide for selecting tabs
    
_toggle: function( eventeventData ) {
        var 
that this,
            
toShow eventData.newPanel,
            
toHide eventData.oldPanel;

        
this.running true;

        function 
complete() {
            
that.running false;
            
that._trigger"activate"eventeventData );
        }

        function 
show() {
            
eventData.newTab.closest"li" ).addClass"ui-tabs-active ui-state-active" );

            if ( 
toShow.length && that.options.show ) {
                
that._showtoShowthat.options.showcomplete );
            } else {
                
toShow.show();
                
complete();
            }
        }

        
// start out by hiding, then showing, then completing
        
if ( toHide.length && this.options.hide ) {
            
this._hidetoHidethis.options.hide, function() {
                
eventData.oldTab.closest"li" ).removeClass"ui-tabs-active ui-state-active" );
                
show();
            });
        } else {
            
eventData.oldTab.closest"li" ).removeClass"ui-tabs-active ui-state-active" );
            
toHide.hide();
            
show();
        }

        
toHide.attr({
            
"aria-expanded""false",
            
"aria-hidden""true"
        
});
        
eventData.oldTab.attr"aria-selected""false" );
        
// If we're switching tabs, remove the old tab from the tab order.
        // If we're opening from collapsed state, remove the previous tab from the tab order.
        // If we're collapsing, then keep the collapsing tab in the tab order.
        
if ( toShow.length && toHide.length ) {
            
eventData.oldTab.attr"tabIndex", -);
        } else if ( 
toShow.length ) {
            
this.tabs.filter(function() {
                return $( 
this ).attr"tabIndex" ) === 0;
            })
            .
attr"tabIndex", -);
        }

        
toShow.attr({
            
"aria-expanded""true",
            
"aria-hidden""false"
        
});
        
eventData.newTab.attr({
            
"aria-selected""true",
            
tabIndex0
        
});
    },

    
_activate: function( index ) {
        var 
anchor,
            
active this._findActiveindex );

        
// trying to activate the already active panel
        
if ( active] === this.active] ) {
            return;
        }

        
// trying to collapse, simulate a click on the current active header
        
if ( !active.length ) {
            
active this.active;
        }

        
anchor active.find".ui-tabs-anchor" )[ ];
        
this._eventHandler({
            
targetanchor,
            
currentTargetanchor,
            
preventDefault: $.noop
        
});
    },

    
_findActive: function( index ) {
        return 
index === false ? $() : this.tabs.eqindex );
    },

    
_getIndex: function( index ) {
        
// meta-function to give users option to provide a href string instead of a numerical index.
        
if ( typeof index === "string" ) {
            
index this.anchors.indexthis.anchors.filter"[href$='" index "']" ) );
        }

        return 
index;
    },

    
_destroy: function() {
        if ( 
this.xhr ) {
            
this.xhr.abort();
        }

        
this.element.removeClass"ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" );

        
this.tablist
            
.removeClass"ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
            .
removeAttr"role" );

        
this.anchors
            
.removeClass"ui-tabs-anchor" )
            .
removeAttr"role" )
            .
removeAttr"tabIndex" )
            .
removeUniqueId();

        
this.tabs.addthis.panels ).each(function() {
            if ( $.
datathis"ui-tabs-destroy" ) ) {
                $( 
this ).remove();
            } else {
                $( 
this )
                    .
removeClass"ui-state-default ui-state-active ui-state-disabled " +
                        
"ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" )
                    .
removeAttr"tabIndex" )
                    .
removeAttr"aria-live" )
                    .
removeAttr"aria-busy" )
                    .
removeAttr"aria-selected" )
                    .
removeAttr"aria-labelledby" )
                    .
removeAttr"aria-hidden" )
                    .
removeAttr"aria-expanded" )
                    .
removeAttr"role" );
            }
        });

        
this.tabs.each(function() {
            var 
li = $( this ),
                
prev li.data"ui-tabs-aria-controls" );
            if ( 
prev ) {
                
li
                    
.attr"aria-controls"prev )
                    .
removeData"ui-tabs-aria-controls" );
            } else {
                
li.removeAttr"aria-controls" );
            }
        });

        
this.panels.show();

        if ( 
this.options.heightStyle !== "content" ) {
            
this.panels.css"height""" );
        }
    },

    
enable: function( index ) {
        var 
disabled this.options.disabled;
        if ( 
disabled === false ) {
            return;
        }

        if ( 
index === undefined ) {
            
disabled false;
        } else {
            
index this._getIndexindex );
            if ( $.
isArraydisabled ) ) {
                
disabled = $.mapdisabled, function( num ) {
                    return 
num !== index num null;
                });
            } else {
                
disabled = $.mapthis.tabs, function( linum ) {
                    return 
num !== index num null;
                });
            }
        }
        
this._setupDisableddisabled );
    },

    
disable: function( index ) {
        var 
disabled this.options.disabled;
        if ( 
disabled === true ) {
            return;
        }

        if ( 
index === undefined ) {
            
disabled true;
        } else {
            
index this._getIndexindex );
            if ( $.
inArrayindexdisabled ) !== -) {
                return;
            }
            if ( $.
isArraydisabled ) ) {
                
disabled = $.merge( [ index ], disabled ).sort();
            } else {
                
disabled = [ index ];
            }
        }
        
this._setupDisableddisabled );
    },

    
load: function( indexevent ) {
        
index this._getIndexindex );
        var 
that this,
            
tab this.tabs.eqindex ),
            
anchor tab.find".ui-tabs-anchor" ),
            
panel this._getPanelForTabtab ),
            
eventData = {
                
tabtab,
                
panelpanel
            
};

        
// not remote
        
if ( isLocalanchor] ) ) {
            return;
        }

        
this.xhr = $.ajaxthis._ajaxSettingsanchoreventeventData ) );

        
// support: jQuery <1.8
        // jQuery <1.8 returns false if the request is canceled in beforeSend,
        // but as of 1.8, $.ajax() always returns a jqXHR object.
        
if ( this.xhr && this.xhr.statusText !== "canceled" ) {
            
tab.addClass"ui-tabs-loading" );
            
panel.attr"aria-busy""true" );

            
this.xhr
                
.success(function( response ) {
                    
// support: jQuery <1.8
                    // http://bugs.jquery.com/ticket/11778
                    
setTimeout(function() {
                        
panel.htmlresponse );
                        
that._trigger"load"eventeventData );
                    }, 
);
                })
                .
complete(function( jqXHRstatus ) {
                    
// support: jQuery <1.8
                    // http://bugs.jquery.com/ticket/11778
                    
setTimeout(function() {
                        if ( 
status === "abort" ) {
                            
that.panels.stopfalsetrue );
                        }

                        
tab.removeClass"ui-tabs-loading" );
                        
panel.removeAttr"aria-busy" );

                        if ( 
jqXHR === that.xhr ) {
                            
delete that.xhr;
                        }
                    }, 
);
                });
        }
    },

    
_ajaxSettings: function( anchoreventeventData ) {
        var 
that this;
        return {
            
urlanchor.attr"href" ),
            
beforeSend: function( jqXHRsettings ) {
                return 
that._trigger"beforeLoad"event,
                    $.
extend( { jqXHR jqXHRajaxSettingssettings }, eventData ) );
            }
        };
    },

    
_getPanelForTab: function( tab ) {
        var 
id = $( tab ).attr"aria-controls" );
        return 
this.element.findthis._sanitizeSelector"#" id ) );
    }
});

})( 
jQuery );
(function( $ ) {

var 
increments 0;

function 
addDescribedByelemid ) {
    var 
describedby = (elem.attr"aria-describedby" ) || "").split( /s+/ );
    
describedby.pushid );
    
elem
        
.data"ui-tooltip-id"id )
        .
attr"aria-describedby", $.trimdescribedby.join" " ) ) );
}

function 
removeDescribedByelem ) {
    var 
id elem.data"ui-tooltip-id" ),
        
describedby = (elem.attr"aria-describedby" ) || "").split( /s+/ ),
        
index = $.inArrayiddescribedby );
    if ( 
index !== -) {
        
describedby.spliceindex);
    }

    
elem.removeData"ui-tooltip-id" );
    
describedby = $.trimdescribedby.join" " ) );
    if ( 
describedby ) {
        
elem.attr"aria-describedby"describedby );
    } else {
        
elem.removeAttr"aria-describedby" );
    }
}

$.
widget"ui.tooltip", {
    
version"1.10.1",
    
options: {
        
content: function() {
            
// support: IE<9, Opera in jQuery <1.7
            // .text() can't accept undefined, so coerce to a string
            
var title = $( this ).attr"title" ) || "";
            
// Escape title, since we're going from an attribute to raw HTML
            
return $( "<a>" ).texttitle ).html();
        },
        
hidetrue,
        
// Disabled elements have inconsistent behavior across browsers (#8661)
        
items"[title]:not([disabled])",
        
position: {
            
my"left top+15",
            
at"left bottom",
            
collision"flipfit flip"
        
},
        
showtrue,
        
tooltipClassnull,
        
trackfalse,

        
// callbacks
        
closenull,
        
opennull
    
},

    
_create: function() {
        
this._on({
            
mouseover"open",
            
focusin"open"
        
});

        
// IDs of generated tooltips, needed for destroy
        
this.tooltips = {};
        
// IDs of parent tooltips where we removed the title attribute
        
this.parents = {};

        if ( 
this.options.disabled ) {
            
this._disable();
        }
    },

    
_setOption: function( keyvalue ) {
        var 
that this;

        if ( 
key === "disabled" ) {
            
thisvalue "_disable" "_enable" ]();
            
this.optionskey ] = value;
            
// disable element style changes
            
return;
        }

        
this._superkeyvalue );

        if ( 
key === "content" ) {
            $.
eachthis.tooltips, function( idelement ) {
                
that._updateContentelement );
            });
        }
    },

    
_disable: function() {
        var 
that this;

        
// close open tooltips
        
$.eachthis.tooltips, function( idelement ) {
            var 
event = $.Event"blur" );
            
event.target event.currentTarget element[0];
            
that.closeeventtrue );
        });

        
// remove title attributes to prevent native tooltips
        
this.element.findthis.options.items ).addBack().each(function() {
            var 
element = $( this );
            if ( 
element.is"[title]" ) ) {
                
element
                    
.data"ui-tooltip-title"element.attr"title" ) )
                    .
attr"title""" );
            }
        });
    },

    
_enable: function() {
        
// restore title attributes
        
this.element.findthis.options.items ).addBack().each(function() {
            var 
element = $( this );
            if ( 
element.data"ui-tooltip-title" ) ) {
                
element.attr"title"element.data"ui-tooltip-title" ) );
            }
        });
    },

    
open: function( event ) {
        var 
that this,
            
target = $( event event.target this.element )
                
// we need closest here due to mouseover bubbling,
                // but always pointing at the same event target
                
.closestthis.options.items );

        
// No element to show a tooltip for or the tooltip is already open
        
if ( !target.length || target.data"ui-tooltip-id" ) ) {
            return;
        }

        if ( 
target.attr"title" ) ) {
            
target.data"ui-tooltip-title"target.attr"title" ) );
        }

        
target.data"ui-tooltip-open"true );

        
// kill parent tooltips, custom or native, for hover
        
if ( event && event.type === "mouseover" ) {
            
target.parents().each(function() {
                var 
parent = $( this ),
                    
blurEvent;
                if ( 
parent.data"ui-tooltip-open" ) ) {
                    
blurEvent = $.Event"blur" );
                    
blurEvent.target blurEvent.currentTarget this;
                    
that.closeblurEventtrue );
                }
                if ( 
parent.attr"title" ) ) {
                    
parent.uniqueId();
                    
that.parentsthis.id ] = {
                        
elementthis,
                        
titleparent.attr"title" )
                    };
                    
parent.attr"title""" );
                }
            });
        }

        
this._updateContenttargetevent );
    },

    
_updateContent: function( targetevent ) {
        var 
content,
            
contentOption this.options.content,
            
that this,
            
eventType event event.type null;

        if ( 
typeof contentOption === "string" ) {
            return 
this._openeventtargetcontentOption );
        }

        
content contentOption.calltarget[0], function( response ) {
            
// ignore async response if tooltip was closed already
            
if ( !target.data"ui-tooltip-open" ) ) {
                return;
            }
            
// IE may instantly serve a cached response for ajax requests
            // delay this call to _open so the other call to _open runs first
            
that._delay(function() {
                
// jQuery creates a special event for focusin when it doesn't
                // exist natively. To improve performance, the native event
                // object is reused and the type is changed. Therefore, we can't
                // rely on the type being correct after the event finished
                // bubbling, so we set it back to the previous value. (#8740)
                
if ( event ) {
                    
event.type eventType;
                }
                
this._openeventtargetresponse );
            });
        });
        if ( 
content ) {
            
this._openeventtargetcontent );
        }
    },

    
_open: function( eventtargetcontent ) {
        var 
tooltipeventsdelayedShow,
            
positionOption = $.extend( {}, this.options.position );

        if ( !
content ) {
            return;
        }

        
// Content can be updated multiple times. If the tooltip already
        // exists, then just update the content and bail.
        
tooltip this._findtarget );
        if ( 
tooltip.length ) {
            
tooltip.find".ui-tooltip-content" ).htmlcontent );
            return;
        }

        
// if we have a title, clear it to prevent the native tooltip
        // we have to check first to avoid defining a title if none exists
        // (we don't want to cause an element to start matching [title])
        //
        // We use removeAttr only for key events, to allow IE to export the correct
        // accessible attributes. For mouse events, set to empty string to avoid
        // native tooltip showing up (happens only when removing inside mouseover).
        
if ( target.is"[title]" ) ) {
            if ( 
event && event.type === "mouseover" ) {
                
target.attr"title""" );
            } else {
                
target.removeAttr"title" );
            }
        }

        
tooltip this._tooltiptarget );
        
addDescribedBytargettooltip.attr"id" ) );
        
tooltip.find".ui-tooltip-content" ).htmlcontent );

        function 
positionevent ) {
            
positionOption.of event;
            if ( 
tooltip.is":hidden" ) ) {
                return;
            }
            
tooltip.positionpositionOption );
        }
        if ( 
this.options.track && event && /^mouse/.testevent.type ) ) {
            
this._onthis.document, {
                
mousemoveposition
            
});
            
// trigger once to override element-relative positioning
            
positionevent );
        } else {
            
tooltip.position( $.extend({
                
oftarget
            
}, this.options.position ) );
        }

        
tooltip.hide();

        
this._showtooltipthis.options.show );
        
// Handle tracking tooltips that are shown with a delay (#8644). As soon
        // as the tooltip is visible, position the tooltip using the most recent
        // event.
        
if ( this.options.show && this.options.show.delay ) {
            
delayedShow this.delayedShow setInterval(function() {
                if ( 
tooltip.is":visible" ) ) {
                    
positionpositionOption.of );
                    
clearIntervaldelayedShow );
                }
            }, $.
fx.interval );
        }

        
this._trigger"open"event, { tooltiptooltip } );

        
events = {
            
keyup: function( event ) {
                if ( 
event.keyCode === $.ui.keyCode.ESCAPE ) {
                    var 
fakeEvent = $.Event(event);
                    
fakeEvent.currentTarget target[0];
                    
this.closefakeEventtrue );
                }
            },
            
remove: function() {
                
this._removeTooltiptooltip );
            }
        };
        if ( !
event || event.type === "mouseover" ) {
            
events.mouseleave "close";
        }
        if ( !
event || event.type === "focusin" ) {
            
events.focusout "close";
        }
        
this._ontruetargetevents );
    },

    
close: function( event ) {
        var 
that this,
            
target = $( event event.currentTarget this.element ),
            
tooltip this._findtarget );

        
// disabling closes the tooltip, so we need to track when we're closing
        // to avoid an infinite loop in case the tooltip becomes disabled on close
        
if ( this.closing ) {
            return;
        }

        
// Clear the interval for delayed tracking tooltips
        
clearIntervalthis.delayedShow );

        
// only set title if we had one before (see comment in _open())
        
if ( target.data"ui-tooltip-title" ) ) {
            
target.attr"title"target.data"ui-tooltip-title" ) );
        }

        
removeDescribedBytarget );

        
tooltip.stoptrue );
        
this._hidetooltipthis.options.hide, function() {
            
that._removeTooltip( $( this ) );
        });

        
target.removeData"ui-tooltip-open" );
        
this._offtarget"mouseleave focusout keyup" );
        
// Remove 'remove' binding only on delegated targets
        
if ( target[0] !== this.element[0] ) {
            
this._offtarget"remove" );
        }
        
this._offthis.document"mousemove" );

        if ( 
event && event.type === "mouseleave" ) {
            $.
eachthis.parents, function( idparent ) {
                $( 
parent.element ).attr"title"parent.title );
                
delete that.parentsid ];
            });
        }

        
this.closing true;
        
this._trigger"close"event, { tooltiptooltip } );
        
this.closing false;
    },

    
_tooltip: function( element ) {
        var 
id "ui-tooltip-" increments++,
            
tooltip = $( "<div>" )
                .
attr({
                    
idid,
                    
role"tooltip"
                
})
                .
addClass"ui-tooltip ui-widget ui-corner-all ui-widget-content " +
                    ( 
this.options.tooltipClass || "" ) );
        $( 
"<div>" )
            .
addClass"ui-tooltip-content" )
            .
appendTotooltip );
        
tooltip.appendTothis.document[0].body );
        
this.tooltipsid ] = element;
        return 
tooltip;
    },

    
_find: function( target ) {
        var 
id target.data"ui-tooltip-id" );
        return 
id ? $( "#" id ) : $();
    },

    
_removeTooltip: function( tooltip ) {
        
tooltip.remove();
        
delete this.tooltipstooltip.attr"id" ) ];
    },

    
_destroy: function() {
        var 
that this;

        
// close open tooltips
        
$.eachthis.tooltips, function( idelement ) {
            
// Delegate to close method to handle common cleanup
            
var event = $.Event"blur" );
            
event.target event.currentTarget element[0];
            
that.closeeventtrue );

            
// Remove immediately; destroying an open tooltip doesn't use the
            // hide animation
            
$( "#" id ).remove();

            
// Restore the title
            
if ( element.data"ui-tooltip-title" ) ) {
                
element.attr"title"element.data"ui-tooltip-title" ) );
                
element.removeData"ui-tooltip-title" );
            }
        });
    }
});

}( 
jQuery ) );
;(
jQuery.effects || (function($, undefined) {

var 
dataSpace "ui-effects-";

$.
effects = {
    
effect: {}
};

/*!
 * jQuery Color Animations v2.1.2
 * https://github.com/jquery/jquery-color
 *
 * Copyright 2013 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * Date: Wed Jan 16 08:47:09 2013 -0600
 */
(function( jQueryundefined ) {

    var 
stepHooks "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",

    
// plusequals test for += 100 -= 100
    
rplusequals = /^([-+])=s*(d+.?d*)/,
    
// a set of RE's that can match strings and generate color tuples.
    
stringParsers = [{
            
re: /rgba?(s*(d{1,3})s*,s*(d{1,3})s*,s*(d{1,3})s*(?:,s*(d?(?:.d+)?)s*)?)/,
            
parse: function( execResult ) {
                return [
                    
execResult],
                    
execResult],
                    
execResult],
                    
execResult]
                ];
            }
        }, {
            
re: /rgba?(s*(d+(?:.d+)?)%s*,s*(d+(?:.d+)?)%s*,s*(d+(?:.d+)?)%s*(?:,s*(d?(?:.d+)?)s*)?)/,
            
parse: function( execResult ) {
                return [
                    
execResult] * 2.55,
                    
execResult] * 2.55,
                    
execResult] * 2.55,
                    
execResult]
                ];
            }
        }, {
            
// this regex ignores A-F because it's compared against an already lowercased string
            
re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
            
parse: function( execResult ) {
                return [
                    
parseIntexecResult], 16 ),
                    
parseIntexecResult], 16 ),
                    
parseIntexecResult], 16 )
                ];
            }
        }, {
            
// this regex ignores A-F because it's compared against an already lowercased string
            
re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
            
parse: function( execResult ) {
                return [
                    
parseIntexecResult] + execResult], 16 ),
                    
parseIntexecResult] + execResult], 16 ),
                    
parseIntexecResult] + execResult], 16 )
                ];
            }
        }, {
            
re: /hsla?(s*(d+(?:.d+)?)s*,s*(d+(?:.d+)?)%s*,s*(d+(?:.d+)?)%s*(?:,s*(d?(?:.d+)?)s*)?)/,
            
space"hsla",
            
parse: function( execResult ) {
                return [
                    
execResult],
                    
execResult] / 100,
                    
execResult] / 100,
                    
execResult]
                ];
            }
        }],

    
// jQuery.Color( )
    
color jQuery.Color = function( colorgreenbluealpha ) {
        return new 
jQuery.Color.fn.parsecolorgreenbluealpha );
    },
    
spaces = {
        
rgba: {
            
props: {
                
red: {
                    
idx0,
                    
type"byte"
                
},
                
green: {
                    
idx1,
                    
type"byte"
                
},
                
blue: {
                    
idx2,
                    
type"byte"
                
}
            }
        },

        
hsla: {
            
props: {
                
hue: {
                    
idx0,
                    
type"degrees"
                
},
                
saturation: {
                    
idx1,
                    
type"percent"
                
},
                
lightness: {
                    
idx2,
                    
type"percent"
                
}
            }
        }
    },
    
propTypes = {
        
"byte": {
            
floortrue,
            
max255
        
},
        
"percent": {
            
max1
        
},
        
"degrees": {
            
mod360,
            
floortrue
        
}
    },
    
support color.support = {},

    
// element for support tests
    
supportElem jQuery"<p>" )[ ],

    
// colors = jQuery.Color.names
    
colors,

    
// local aliases of functions called often
    
each jQuery.each;

// determine rgba support immediately
supportElem.style.cssText "background-color:rgba(1,1,1,.5)";
support.rgba supportElem.style.backgroundColor.indexOf"rgba" ) > -1;

// define cache name and alpha properties
// for rgba and hsla spaces
eachspaces, function( spaceNamespace ) {
    
space.cache "_" spaceName;
    
space.props.alpha = {
        
idx3,
        
type"percent",
        
def1
    
};
});

function 
clampvaluepropallowEmpty ) {
    var 
type propTypesprop.type ] || {};

    if ( 
value == null ) {
        return (
allowEmpty || !prop.def) ? null prop.def;
    }

    
// ~~ is an short way of doing floor for positive numbers
    
value type.floor ? ~~value parseFloatvalue );

    
// IE will pass in empty strings as value for alpha,
    // which will hit this case
    
if ( isNaNvalue ) ) {
        return 
prop.def;
    }

    if ( 
type.mod ) {
        
// we add mod before modding to make sure that negatives values
        // get converted properly: -10 -> 350
        
return (value type.mod) % type.mod;
    }

    
// for now all property types without mod have min and max
    
return value type.max value type.max value;
}

function 
stringParse( string ) {
    var 
inst color(),
        
rgba inst._rgba = [];

    
string string.toLowerCase();

    
eachstringParsers, function( iparser ) {
        var 
parsed,
            
match parser.re.exec( string ),
            
values match && parser.parsematch ),
            
spaceName parser.space || "rgba";

        if ( 
values ) {
            
parsed instspaceName ]( values );

            
// if this was an rgba parse the assignment might happen twice
            // oh well....
            
instspacesspaceName ].cache ] = parsedspacesspaceName ].cache ];
            
rgba inst._rgba parsed._rgba;

            
// exit each( stringParsers ) here because we matched
            
return false;
        }
    });

    
// Found a stringParser that handled it
    
if ( rgba.length ) {

        
// if this came from a parsed string, force "transparent" when alpha is 0
        // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
        
if ( rgba.join() === "0,0,0,0" ) {
            
jQuery.extendrgbacolors.transparent );
        }
        return 
inst;
    }

    
// named colors
    
return colorsstring ];
}

color.fn = jQuery.extendcolor.prototype, {
    
parse: function( redgreenbluealpha ) {
        if ( 
red === undefined ) {
            
this._rgba = [ nullnullnullnull ];
            return 
this;
        }
        if ( 
red.jquery || red.nodeType ) {
            
red jQueryred ).cssgreen );
            
green undefined;
        }

        var 
inst this,
            
type jQuery.typered ),
            
rgba this._rgba = [];

        
// more than 1 argument specified - assume ( red, green, blue, alpha )
        
if ( green !== undefined ) {
            
red = [ redgreenbluealpha ];
            
type "array";
        }

        if ( 
type === "string" ) {
            return 
this.parsestringParsered ) || colors._default );
        }

        if ( 
type === "array" ) {
            
eachspaces.rgba.props, function( keyprop ) {
                
rgbaprop.idx ] = clampredprop.idx ], prop );
            });
            return 
this;
        }

        if ( 
type === "object" ) {
            if ( 
red instanceof color ) {
                
eachspaces, function( spaceNamespace ) {
                    if ( 
redspace.cache ] ) {
                        
instspace.cache ] = redspace.cache ].slice();
                    }
                });
            } else {
                
eachspaces, function( spaceNamespace ) {
                    var 
cache space.cache;
                    
eachspace.props, function( keyprop ) {

                        
// if the cache doesn't exist, and we know how to convert
                        
if ( !instcache ] && space.to ) {

                            
// if the value was null, we don't need to copy it
                            // if the key was alpha, we don't need to copy it either
                            
if ( key === "alpha" || redkey ] == null ) {
                                return;
                            }
                            
instcache ] = space.toinst._rgba );
                        }

                        
// this is the only case where we allow nulls for ALL properties.
                        // call clamp with alwaysAllowEmpty
                        
instcache ][ prop.idx ] = clampredkey ], proptrue );
                    });

                    
// everything defined but alpha?
                    
if ( instcache ] && jQuery.inArraynullinstcache ].slice0) ) < ) {
                        
// use the default of 1
                        
instcache ][ ] = 1;
                        if ( 
space.from ) {
                            
inst._rgba space.frominstcache ] );
                        }
                    }
                });
            }
            return 
this;
        }
    },
    
is: function( compare ) {
        var 
is colorcompare ),
            
same true,
            
inst this;

        
eachspaces, function( _space ) {
            var 
localCache,
                
isCache isspace.cache ];
            if (
isCache) {
                
localCache instspace.cache ] || space.to && space.toinst._rgba ) || [];
                
eachspace.props, function( _prop ) {
                    if ( 
isCacheprop.idx ] != null ) {
                        
same = ( isCacheprop.idx ] === localCacheprop.idx ] );
                        return 
same;
                    }
                });
            }
            return 
same;
        });
        return 
same;
    },
    
_space: function() {
        var 
used = [],
            
inst this;
        
eachspaces, function( spaceNamespace ) {
            if ( 
instspace.cache ] ) {
                
used.pushspaceName );
            }
        });
        return 
used.pop();
    },
    
transition: function( otherdistance ) {
        var 
end colorother ),
            
spaceName end._space(),
            
space spacesspaceName ],
            
startColor this.alpha() === color"transparent" ) : this,
            
start startColorspace.cache ] || space.tostartColor._rgba ),
            
result start.slice();

        
end endspace.cache ];
        
eachspace.props, function( keyprop ) {
            var 
index prop.idx,
                
startValue startindex ],
                
endValue endindex ],
                
type propTypesprop.type ] || {};

            
// if null, don't override start value
            
if ( endValue === null ) {
                return;
            }
            
// if null - use end
            
if ( startValue === null ) {
                
resultindex ] = endValue;
            } else {
                if ( 
type.mod ) {
                    if ( 
endValue startValue type.mod ) {
                        
startValue += type.mod;
                    } else if ( 
startValue endValue type.mod ) {
                        
startValue -= type.mod;
                    }
                }
                
resultindex ] = clamp( ( endValue startValue ) * distance startValueprop );
            }
        });
        return 
thisspaceName ]( result );
    },
    
blend: function( opaque ) {
        
// if we are already opaque - return ourself
        
if ( this._rgba] === ) {
            return 
this;
        }

        var 
rgb this._rgba.slice(),
            
rgb.pop(),
            
blend coloropaque )._rgba;

        return 
colorjQuery.maprgb, function( v) {
            return ( 
) * blend] + v;
        }));
    },
    
toRgbaString: function() {
        var 
prefix "rgba(",
            
rgba jQuery.mapthis._rgba, function( v) {
                return 
== null ? ( ) : v;
            });

        if ( 
rgba] === ) {
            
rgba.pop();
            
prefix "rgb(";
        }

        return 
prefix rgba.join() + ")";
    },
    
toHslaString: function() {
        var 
prefix "hsla(",
            
hsla jQuery.mapthis.hsla(), function( v) {
                if ( 
== null ) {
                    
0;
                }

                
// catch 1 and 2
                
if ( && ) {
                    
Math.round100 ) + "%";
                }
                return 
v;
            });

        if ( 
hsla] === ) {
            
hsla.pop();
            
prefix "hsl(";
        }
        return 
prefix hsla.join() + ")";
    },
    
toHexString: function( includeAlpha ) {
        var 
rgba this._rgba.slice(),
            
alpha rgba.pop();

        if ( 
includeAlpha ) {
            
rgba.push( ~~( alpha 255 ) );
        }

        return 
"#" jQuery.maprgba, function( ) {

            
// default to 0 when nulls exist
            
= ( || ).toString16 );
            return 
v.length === "0" v;
        }).
join("");
    },
    
toString: function() {
        return 
this._rgba] === "transparent" this.toRgbaString();
    }
});
color.fn.parse.prototype color.fn;

// hsla conversions adapted from:
// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021

function hue2rgbpq) {
    
= ( ) % 1;
    if ( 
) {
        return 
+ (p) * 6;
    }
    if ( 
1) {
        return 
q;
    }
    if ( 
) {
        return 
+ (p) * ((2/3) - h) * 6;
    }
    return 
p;
}

spaces.hsla.to = function ( rgba ) {
    if ( 
rgba] == null || rgba] == null || rgba] == null ) {
        return [ 
nullnullnullrgba] ];
    }
    var 
rgba] / 255,
        
rgba] / 255,
        
rgba] / 255,
        
rgba],
        
max Math.maxrg),
        
min Math.minrg),
        
diff max min,
        
add max min,
        
add 0.5,
        
hs;

    if ( 
min === max ) {
        
0;
    } else if ( 
=== max ) {
        
= ( 60 * ( ) / diff ) + 360;
    } else if ( 
=== max ) {
        
= ( 60 * ( ) / diff ) + 120;
    } else {
        
= ( 60 * ( ) / diff ) + 240;
    }

    
// chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
    // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
    
if ( diff === ) {
        
0;
    } else if ( 
<= 0.5 ) {
        
diff add;
    } else {
        
diff / ( add );
    }
    return [ 
Math.round(h) % 360sl== null ];
};

spaces.hsla.from = function ( hsla ) {
    if ( 
hsla] == null || hsla] == null || hsla] == null ) {
        return [ 
nullnullnullhsla] ];
    }
    var 
hsla] / 360,
        
hsla],
        
hsla],
        
hsla],
        
<= 0.5 * ( ) : s,
        
q;

    return [
        
Math.roundhue2rgbpq+ ( ) ) * 255 ),
        
Math.roundhue2rgbpq) * 255 ),
        
Math.roundhue2rgbpq- ( ) ) * 255 ),
        
a
    
];
};


eachspaces, function( spaceNamespace ) {
    var 
props space.props,
        
cache space.cache,
        
to space.to,
        
from space.from;

    
// makes rgba() and hsla()
    
color.fn[ spaceName ] = function( value ) {

        
// generate a cache for this space if it doesn't exist
        
if ( to && !thiscache ] ) {
            
thiscache ] = tothis._rgba );
        }
        if ( 
value === undefined ) {
            return 
thiscache ].slice();
        }

        var 
ret,
            
type jQuery.typevalue ),
            
arr = ( type === "array" || type === "object" ) ? value arguments,
            
local thiscache ].slice();

        
eachprops, function( keyprop ) {
            var 
val arrtype === "object" key prop.idx ];
            if ( 
val == null ) {
                
val localprop.idx ];
            }
            
localprop.idx ] = clampvalprop );
        });

        if ( 
from ) {
            
ret colorfromlocal ) );
            
retcache ] = local;
            return 
ret;
        } else {
            return 
colorlocal );
        }
    };

    
// makes red() green() blue() alpha() hue() saturation() lightness()
    
eachprops, function( keyprop ) {
        
// alpha is included in more than one space
        
if ( color.fn[ key ] ) {
            return;
        }
        
color.fn[ key ] = function( value ) {
            var 
vtype jQuery.typevalue ),
                fn = ( 
key === "alpha" ? ( this._hsla "hsla" "rgba" ) : spaceName ),
                
local this[ fn ](),
                
cur localprop.idx ],
                
match;

            if ( 
vtype === "undefined" ) {
                return 
cur;
            }

            if ( 
vtype === "function" ) {
                
value value.callthiscur );
                
vtype jQuery.typevalue );
            }
            if ( 
value == null && prop.empty ) {
                return 
this;
            }
            if ( 
vtype === "string" ) {
                
match rplusequals.execvalue );
                if ( 
match ) {
                    
value cur parseFloatmatch] ) * ( match] === "+" : -);
                }
            }
            
localprop.idx ] = value;
            return 
this[ fn ]( local );
        };
    });
});

// add cssHook and .fx.step function for each named hook.
// accept a space separated string of properties
color.hook = function( hook ) {
    var 
hooks hook.split" " );
    
eachhooks, function( ihook ) {
        
jQuery.cssHookshook ] = {
            
set: function( elemvalue ) {
                var 
parsedcurElem,
                    
backgroundColor "";

                if ( 
value !== "transparent" && ( jQuery.typevalue ) !== "string" || ( parsed stringParsevalue ) ) ) ) {
                    
value colorparsed || value );
                    if ( !
support.rgba && value._rgba] !== ) {
                        
curElem hook === "backgroundColor" elem.parentNode elem;
                        while (
                            (
backgroundColor === "" || backgroundColor === "transparent") &&
                            
curElem && curElem.style
                        
) {
                            try {
                                
backgroundColor jQuery.csscurElem"backgroundColor" );
                                
curElem curElem.parentNode;
                            } catch ( 
) {
                            }
                        }

                        
value value.blendbackgroundColor && backgroundColor !== "transparent" ?
                            
backgroundColor :
                            
"_default" );
                    }

                    
value value.toRgbaString();
                }
                try {
                    
elem.stylehook ] = value;
                } catch( 
) {
                    
// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
                
}
            }
        };
        
jQuery.fx.stephook ] = function( fx ) {
            if ( !
fx.colorInit ) {
                
fx.start colorfx.elemhook );
                
fx.end colorfx.end );
                
fx.colorInit true;
            }
            
jQuery.cssHookshook ].setfx.elemfx.start.transitionfx.endfx.pos ) );
        };
    });

};

color.hookstepHooks );

jQuery.cssHooks.borderColor = {
    
expand: function( value ) {
        var 
expanded = {};

        
each( [ "Top""Right""Bottom""Left" ], function( ipart ) {
            
expanded"border" part "Color" ] = value;
        });
        return 
expanded;
    }
};

// Basic color names only.
// Usage of any of the other color names requires adding yourself or including
// jquery.color.svg-names.js.
colors jQuery.Color.names = {
    
// 4.1. Basic color keywords
    
aqua"#00ffff",
    
black"#000000",
    
blue"#0000ff",
    
fuchsia"#ff00ff",
    
gray"#808080",
    
green"#008000",
    
lime"#00ff00",
    
maroon"#800000",
    
navy"#000080",
    
olive"#808000",
    
purple"#800080",
    
red"#ff0000",
    
silver"#c0c0c0",
    
teal"#008080",
    
white"#ffffff",
    
yellow"#ffff00",

    
// 4.2.3. "transparent" color keyword
    
transparent: [ nullnullnull],

    
_default"#ffffff"
};

})( 
jQuery );


/******************************************************************************/
/****************************** CLASS ANIMATIONS ******************************/
/******************************************************************************/
(function() {

var 
classAnimationActions = [ "add""remove""toggle" ],
    
shorthandStyles = {
        
border1,
        
borderBottom1,
        
borderColor1,
        
borderLeft1,
        
borderRight1,
        
borderTop1,
        
borderWidth1,
        
margin1,
        
padding1
    
};

$.
each([ "borderLeftStyle""borderRightStyle""borderBottomStyle""borderTopStyle" ], function( _prop ) {
    $.
fx.stepprop ] = function( fx ) {
        if ( 
fx.end !== "none" && !fx.setAttr || fx.pos === && !fx.setAttr ) {
            
jQuery.stylefx.elempropfx.end );
            
fx.setAttr true;
        }
    };
});

function 
getElementStyleselem ) {
    var 
keylen,
        
style elem.ownerDocument.defaultView ?
            
elem.ownerDocument.defaultView.getComputedStyleelemnull ) :
            
elem.currentStyle,
        
styles = {};

    if ( 
style && style.length && style] && stylestyle] ] ) {
        
len style.length;
        while ( 
len-- ) {
            
key stylelen ];
            if ( 
typeof stylekey ] === "string" ) {
                
styles[ $.camelCasekey ) ] = stylekey ];
            }
        }
    
// support: Opera, IE <9
    
} else {
        for ( 
key in style ) {
            if ( 
typeof stylekey ] === "string" ) {
                
styleskey ] = stylekey ];
            }
        }
    }

    return 
styles;
}


function 
styleDifferenceoldStylenewStyle ) {
    var 
diff = {},
        
namevalue;

    for ( 
name in newStyle ) {
        
value newStylename ];
        if ( 
oldStylename ] !== value ) {
            if ( !
shorthandStylesname ] ) {
                if ( $.
fx.stepname ] || !isNaNparseFloatvalue ) ) ) {
                    
diffname ] = value;
                }
            }
        }
    }

    return 
diff;
}

// support: jQuery <1.8
if ( !$.fn.addBack ) {
    $.fn.
addBack = function( selector ) {
        return 
this.addselector == null ?
            
this.prevObject this.prevObject.filterselector )
        );
    };
}

$.
effects.animateClass = function( valuedurationeasingcallback ) {
    var 
= $.speeddurationeasingcallback );

    return 
this.queue( function() {
        var 
animated = $( this ),
            
baseClass animated.attr"class" ) || "",
            
applyClassChange,
            
allAnimations o.children animated.find"*" ).addBack() : animated;

        
// map the animated objects to store the original styles.
        
allAnimations allAnimations.map(function() {
            var 
el = $( this );
            return {
                
elel,
                
startgetElementStylesthis )
            };
        });

        
// apply class change
        
applyClassChange = function() {
            $.
eachclassAnimationActions, function(iaction) {
                if ( 
valueaction ] ) {
                    
animatedaction "Class" ]( valueaction ] );
                }
            });
        };
        
applyClassChange();

        
// map all animated objects again - calculate new styles and diff
        
allAnimations allAnimations.map(function() {
            
this.end getElementStylesthis.el] );
            
this.diff styleDifferencethis.startthis.end );
            return 
this;
        });

        
// apply original class
        
animated.attr"class"baseClass );

        
// map all animated objects again - this time collecting a promise
        
allAnimations allAnimations.map(function() {
            var 
styleInfo this,
                
dfd = $.Deferred(),
                
opts = $.extend({}, o, {
                    
queuefalse,
                    
complete: function() {
                        
dfd.resolvestyleInfo );
                    }
                });

            
this.el.animatethis.diffopts );
            return 
dfd.promise();
        });

        
// once all animations have completed:
        
$.when.apply( $, allAnimations.get() ).done(function() {

            
// set the final class
            
applyClassChange();

            
// for each animated element,
            // clear all css properties that were animated
            
$.eacharguments, function() {
                var 
el this.el;
                $.
eachthis.diff, function(key) {
                    
el.csskey"" );
                });
            });

            
// this is guarnteed to be there if you use jQuery.speed()
            // it also handles dequeuing the next anim...
            
o.complete.callanimated] );
        });
    });
};

$.fn.
extend({
    
_addClass: $.fn.addClass,
    
addClass: function( classNamesspeedeasingcallback ) {
        return 
speed ?
            $.
effects.animateClass.callthis,
                { 
addclassNames }, speedeasingcallback ) :
            
this._addClassclassNames );
    },

    
_removeClass: $.fn.removeClass,
    
removeClass: function( classNamesspeedeasingcallback ) {
        return 
arguments.length ?
            $.
effects.animateClass.callthis,
                { 
removeclassNames }, speedeasingcallback ) :
            
this._removeClass.applythisarguments );
    },

    
_toggleClass: $.fn.toggleClass,
    
toggleClass: function( classNamesforcespeedeasingcallback ) {
        if ( 
typeof force === "boolean" || force === undefined ) {
            if ( !
speed ) {
                
// without speed parameter
                
return this._toggleClassclassNamesforce );
            } else {
                return $.
effects.animateClass.callthis,
                    (
force ? { addclassNames } : { removeclassNames }),
                    
speedeasingcallback );
            }
        } else {
            
// without force parameter
            
return $.effects.animateClass.callthis,
                { 
toggleclassNames }, forcespeedeasing );
        }
    },

    
switchClass: function( removeaddspeedeasingcallback) {
        return $.
effects.animateClass.callthis, {
            
addadd,
            
removeremove
        
}, speedeasingcallback );
    }
});

})();

/******************************************************************************/
/*********************************** EFFECTS **********************************/
/******************************************************************************/

(function() {

$.
extend( $.effects, {
    
version"1.10.1",

    
// Saves a set of properties in a data storage
    
save: function( elementset ) {
        for( var 
i=0set.lengthi++ ) {
            if ( 
set] !== null ) {
                
element.datadataSpace set], element].styleset] ] );
            }
        }
    },

    
// Restores a set of previously saved properties from a data storage
    
restore: function( elementset ) {
        var 
vali;
        for( 
i=0set.lengthi++ ) {
            if ( 
set] !== null ) {
                
val element.datadataSpace set] );
                
// support: jQuery 1.6.2
                // http://bugs.jquery.com/ticket/9917
                // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
                // We can't differentiate between "" and 0 here, so we just assume
                // empty string since it's likely to be a more common value...
                
if ( val === undefined ) {
                    
val "";
                }
                
element.cssset], val );
            }
        }
    },

    
setMode: function( elmode ) {
        if (
mode === "toggle") {
            
mode el.is":hidden" ) ? "show" "hide";
        }
        return 
mode;
    },

    
// Translates a [top,left] array into a baseline value
    // this should be a little more flexible in the future to handle a string & hash
    
getBaseline: function( originoriginal ) {
        var 
yx;
        switch ( 
origin] ) {
            case 
"top"0; break;
            case 
"middle"0.5; break;
            case 
"bottom"1; break;
            default: 
origin] / original.height;
        }
        switch ( 
origin] ) {
            case 
"left"0; break;
            case 
"center"0.5; break;
            case 
"right"1; break;
            default: 
origin] / original.width;
        }
        return {
            
xx,
            
yy
        
};
    },

    
// Wraps the element around a wrapper that copies position properties
    
createWrapper: function( element ) {

        
// if the element is already wrapped, return it
        
if ( element.parent().is".ui-effects-wrapper" )) {
            return 
element.parent();
        }

        
// wrap the element
        
var props = {
                
widthelement.outerWidth(true),
                
heightelement.outerHeight(true),
                
"float"element.css"float" )
            },
            
wrapper = $( "<div></div>" )
                .
addClass"ui-effects-wrapper" )
                .
css({
                    
fontSize"100%",
                    
background"transparent",
                    
border"none",
                    
margin0,
                    
padding0
                
}),
            
// Store the size in case width/height are defined in % - Fixes #5245
            
size = {
                
widthelement.width(),
                
heightelement.height()
            },
            
active document.activeElement;

        
// support: Firefox
        // Firefox incorrectly exposes anonymous content
        // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
        
try {
            
active.id;
        } catch( 
) {
            
active document.body;
        }

        
element.wrapwrapper );

        
// Fixes #7595 - Elements lose focus when wrapped.
        
if ( element] === active || $.containselement], active ) ) {
            $( 
active ).focus();
        }

        
wrapper element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element

        // transfer positioning properties to the wrapper
        
if ( element.css"position" ) === "static" ) {
            
wrapper.css({ position"relative" });
            
element.css({ position"relative" });
        } else {
            $.
extendprops, {
                
positionelement.css"position" ),
                
zIndexelement.css"z-index" )
            });
            $.
each([ "top""left""bottom""right" ], function(ipos) {
                
propspos ] = element.csspos );
                if ( 
isNaNparseIntpropspos ], 10 ) ) ) {
                    
propspos ] = "auto";
                }
            });
            
element.css({
                
position"relative",
                
top0,
                
left0,
                
right"auto",
                
bottom"auto"
            
});
        }
        
element.css(size);

        return 
wrapper.cssprops ).show();
    },

    
removeWrapper: function( element ) {
        var 
active document.activeElement;

        if ( 
element.parent().is".ui-effects-wrapper" ) ) {
            
element.parent().replaceWithelement );

            
// Fixes #7595 - Elements lose focus when wrapped.
            
if ( element] === active || $.containselement], active ) ) {
                $( 
active ).focus();
            }
        }


        return 
element;
    },

    
setTransition: function( element, list, factorvalue ) {
        
value value || {};
        $.
each( list, function( i) {
            var 
unit element.cssUnit);
            if ( 
unit] > ) {
                
value] = unit] * factor unit];
            }
        });
        return 
value;
    }
});

// return an effect options object for the given parameters:
function _normalizeArgumentseffectoptionsspeedcallback ) {

    
// allow passing all options as the first parameter
    
if ( $.isPlainObjecteffect ) ) {
        
options effect;
        
effect effect.effect;
    }

    
// convert to an object
    
effect = { effecteffect };

    
// catch (effect, null, ...)
    
if ( options == null ) {
        
options = {};
    }

    
// catch (effect, callback)
    
if ( $.isFunctionoptions ) ) {
        
callback options;
        
speed null;
        
options = {};
    }

    
// catch (effect, speed, ?)
    
if ( typeof options === "number" || $.fx.speedsoptions ] ) {
        
callback speed;
        
speed options;
        
options = {};
    }

    
// catch (effect, options, callback)
    
if ( $.isFunctionspeed ) ) {
        
callback speed;
        
speed null;
    }

    
// add options to effect
    
if ( options ) {
        $.
extendeffectoptions );
    }

    
speed speed || options.duration;
    
effect.duration = $.fx.off :
        
typeof speed === "number" speed :
        
speed in $.fx.speeds ? $.fx.speedsspeed ] :
        $.
fx.speeds._default;

    
effect.complete callback || options.complete;

    return 
effect;
}

function 
standardSpeedspeed ) {
    
// valid standard speeds
    
if ( !speed || typeof speed === "number" || $.fx.speedsspeed ] ) {
        return 
true;
    }

    
// invalid strings - treat as "normal" speed
    
return typeof speed === "string" && !$.effects.effectspeed ];
}

$.fn.
extend({
    
effect: function( /* effect, options, speed, callback */ ) {
        var 
args _normalizeArguments.applythisarguments ),
            
mode args.mode,
            
queue args.queue,
            
effectMethod = $.effects.effectargs.effect ];

        if ( $.
fx.off || !effectMethod ) {
            
// delegate to the original method (e.g., .show()) if possible
            
if ( mode ) {
                return 
thismode ]( args.durationargs.complete );
            } else {
                return 
this.each( function() {
                    if ( 
args.complete ) {
                        
args.complete.callthis );
                    }
                });
            }
        }

        function 
runnext ) {
            var 
elem = $( this ),
                
complete args.complete,
                
mode args.mode;

            function 
done() {
                if ( $.
isFunctioncomplete ) ) {
                    
complete.callelem[0] );
                }
                if ( $.
isFunctionnext ) ) {
                    
next();
                }
            }

            
// if the element is hiddden and mode is hide,
            // or element is visible and mode is show
            
if ( elem.is":hidden" ) ? mode === "hide" mode === "show" ) {
                
done();
            } else {
                
effectMethod.callelem[0], argsdone );
            }
        }

        return 
queue === false this.eachrun ) : this.queuequeue || "fx"run );
    },

    
_show: $.fn.show,
    
show: function( speed ) {
        if ( 
standardSpeedspeed ) ) {
            return 
this._show.applythisarguments );
        } else {
            var 
args _normalizeArguments.applythisarguments );
            
args.mode "show";
            return 
this.effect.callthisargs );
        }
    },

    
_hide: $.fn.hide,
    
hide: function( speed ) {
        if ( 
standardSpeedspeed ) ) {
            return 
this._hide.applythisarguments );
        } else {
            var 
args _normalizeArguments.applythisarguments );
            
args.mode "hide";
            return 
this.effect.callthisargs );
        }
    },

    
// jQuery core overloads toggle and creates _toggle
    
__toggle: $.fn.toggle,
    
toggle: function( speed ) {
        if ( 
standardSpeedspeed ) || typeof speed === "boolean" || $.isFunctionspeed ) ) {
            return 
this.__toggle.applythisarguments );
        } else {
            var 
args _normalizeArguments.applythisarguments );
            
args.mode "toggle";
            return 
this.effect.callthisargs );
        }
    },

    
// helper functions
    
cssUnit: function(key) {
        var 
style this.csskey ),
            
val = [];

        $.
each( [ "em""px""%""pt" ], function( iunit ) {
            if ( 
style.indexOfunit ) > ) {
                
val = [ parseFloatstyle ), unit ];
            }
        });
        return 
val;
    }
});

})();

/******************************************************************************/
/*********************************** EASING ***********************************/
/******************************************************************************/

(function() {

// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)

var baseEasings = {};

$.
each( [ "Quad""Cubic""Quart""Quint""Expo" ], function( iname ) {
    
baseEasingsname ] = function( ) {
        return 
Math.powp);
    };
});

$.
extendbaseEasings, {
    
Sine: function ( ) {
        return 
Math.cosMath.PI );
    },
    
Circ: function ( ) {
        return 
Math.sqrt);
    },
    
Elastic: function( ) {
        return 
=== || === :
            -
Math.pow2* (1) ) * Math.sin( ( (1) * 80 7.5 ) * Math.PI 15 );
    },
    
Back: function( ) {
        return 
* ( );
    },
    
Bounce: function ( ) {
        var 
pow2,
            
bounce 4;

        while ( 
< ( ( pow2 Math.pow2, --bounce ) ) - ) / 11 ) {}
        return 
Math.pow4bounce ) - 7.5625 Math.pow( ( pow2 ) / 22 p);
    }
});

$.
eachbaseEasings, function( nameeaseIn ) {
    $.
easing"easeIn" name ] = easeIn;
    $.
easing"easeOut" name ] = function( ) {
        return 
easeIn);
    };
    $.
easing"easeInOut" name ] = function( ) {
        return 
0.5 ?
            
easeIn) / :
            
easeIn* -) / 2;
    };
});

})();

})(
jQuery));
(function( $, 
undefined ) {

var 
rvertical = /up|down|vertical/,
    
rpositivemotion = /up|left|vertical|horizontal/;

$.
effects.effect.blind = function( odone ) {
    
// Create element
    
var el = $( this ),
        
props = [ "position""top""bottom""left""right""height""width" ],
        
mode = $.effects.setModeelo.mode || "hide" ),
        
direction o.direction || "up",
        
vertical rvertical.testdirection ),
        
ref vertical "height" "width",
        
ref2 vertical "top" "left",
        
motion rpositivemotion.testdirection ),
        
animation = {},
        
show mode === "show",
        
wrapperdistancemargin;

    
// if already wrapped, the wrapper's properties are my property. #6245
    
if ( el.parent().is".ui-effects-wrapper" ) ) {
        $.
effects.saveel.parent(), props );
    } else {
        $.
effects.saveelprops );
    }
    
el.show();
    
wrapper = $.effects.createWrapperel ).css({
        
overflow"hidden"
    
});

    
distance wrapperref ]();
    
margin parseFloatwrapper.cssref2 ) ) || 0;

    
animationref ] = show distance 0;
    if ( !
motion ) {
        
el
            
.cssvertical "bottom" "right")
            .
cssvertical "top" "left""auto" )
            .
css({ position"absolute" });

        
animationref2 ] = show margin distance margin;
    }

    
// start at 0 if we are showing
    
if ( show ) {
        
wrapper.cssref);
        if ( ! 
motion ) {
            
wrapper.cssref2margin distance );
        }
    }

    
// Animate
    
wrapper.animateanimation, {
        
durationo.duration,
        
easingo.easing,
        
queuefalse,
        
complete: function() {
            if ( 
mode === "hide" ) {
                
el.hide();
            }
            $.
effects.restoreelprops );
            $.
effects.removeWrapperel );
            
done();
        }
    });

};

})(
jQuery);
(function( $, 
undefined ) {

$.
effects.effect.bounce = function( odone ) {
    var 
el = $( this ),
        
props = [ "position""top""bottom""left""right""height""width" ],

        
// defaults:
        
mode = $.effects.setModeelo.mode || "effect" ),
        
hide mode === "hide",
        
show mode === "show",
        
direction o.direction || "up",
        
distance o.distance,
        
times o.times || 5,

        
// number of internal animations
        
anims times + ( show || hide ),
        
speed o.duration anims,
        
easing o.easing,

        
// utility:
        
ref = ( direction === "up" || direction === "down" ) ? "top" "left",
        
motion = ( direction === "up" || direction === "left" ),
        
i,
        
upAnim,
        
downAnim,

        
// we will need to re-assemble the queue to stack our animations in place
        
queue el.queue(),
        
queuelen queue.length;

    
// Avoid touching opacity to prevent clearType and PNG issues in IE
    
if ( show || hide ) {
        
props.push"opacity" );
    }

    $.
effects.saveelprops );
    
el.show();
    $.
effects.createWrapperel ); // Create Wrapper

    // default distance for the BIGGEST bounce is the outer Distance / 3
    
if ( !distance ) {
        
distance elref === "top" "outerHeight" "outerWidth" ]() / 3;
    }

    if ( 
show ) {
        
downAnim = { opacity};
        
downAnimref ] = 0;

        
// if we are showing, force opacity 0 and set the initial position
        // then do the "first" animation
        
el.css"opacity")
            .
cssrefmotion ? -distance distance )
            .
animatedownAnimspeedeasing );
    }

    
// start at the smallest distance if we are hiding
    
if ( hide ) {
        
distance distance Math.pow2times );
    }

    
downAnim = {};
    
downAnimref ] = 0;
    
// Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
    
for ( 0timesi++ ) {
        
upAnim = {};
        
upAnimref ] = ( motion "-=" "+=" ) + distance;

        
el.animateupAnimspeedeasing )
            .
animatedownAnimspeedeasing );

        
distance hide distance distance 2;
    }

    
// Last Bounce when Hiding
    
if ( hide ) {
        
upAnim = { opacity};
        
upAnimref ] = ( motion "-=" "+=" ) + distance;

        
el.animateupAnimspeedeasing );
    }

    
el.queue(function() {
        if ( 
hide ) {
            
el.hide();
        }
        $.
effects.restoreelprops );
        $.
effects.removeWrapperel );
        
done();
    });

    
// inject all the animations we just queued to be first in line (after "inprogress")
    
if ( queuelen 1) {
        
queue.splice.applyqueue,
            [ 
1].concatqueue.splicequeuelenanims ) ) );
    }
    
el.dequeue();

};

})(
jQuery);
(function( $, 
undefined ) {

$.
effects.effect.clip = function( odone ) {
    
// Create element
    
var el = $( this ),
        
props = [ "position""top""bottom""left""right""height""width" ],
        
mode = $.effects.setModeelo.mode || "hide" ),
        
show mode === "show",
        
direction o.direction || "vertical",
        
vert direction === "vertical",
        
size vert "height" "width",
        
position vert "top" "left",
        
animation = {},
        
wrapperanimatedistance;

    
// Save & Show
    
$.effects.saveelprops );
    
el.show();

    
// Create Wrapper
    
wrapper = $.effects.createWrapperel ).css({
        
overflow"hidden"
    
});
    
animate = ( el[0].tagName === "IMG" ) ? wrapper el;
    
distance animatesize ]();

    
// Shift
    
if ( show ) {
        
animate.csssize);
        
animate.csspositiondistance );
    }

    
// Create Animation Object:
    
animationsize ] = show distance 0;
    
animationposition ] = show distance 2;

    
// Animate
    
animate.animateanimation, {
        
queuefalse,
        
durationo.duration,
        
easingo.easing,
        
complete: function() {
            if ( !
show ) {
                
el.hide();
            }
            $.
effects.restoreelprops );
            $.
effects.removeWrapperel );
            
done();
        }
    });

};

})(
jQuery);
(function( $, 
undefined ) {

$.
effects.effect.drop = function( odone ) {

    var 
el = $( this ),
        
props = [ "position""top""bottom""left""right""opacity""height""width" ],
        
mode = $.effects.setModeelo.mode || "hide" ),
        
show mode === "show",
        
direction o.direction || "left",
        
ref = ( direction === "up" || direction === "down" ) ? "top" "left",
        
motion = ( direction === "up" || direction === "left" ) ? "pos" "neg",
        
animation = {
            
opacityshow 0
        
},
        
distance;

    
// Adjust
    
$.effects.saveelprops );
    
el.show();
    $.
effects.createWrapperel );

    
distance o.distance || elref === "top" "outerHeight""outerWidth" ]( true ) / 2;

    if ( 
show ) {
        
el
            
.css"opacity")
            .
cssrefmotion === "pos" ? -distance distance );
    }

    
// Animation
    
animationref ] = ( show ?
        ( 
motion === "pos" "+=" "-=" ) :
        ( 
motion === "pos" "-=" "+=" ) ) +
        
distance;

    
// Animate
    
el.animateanimation, {
        
queuefalse,
        
durationo.duration,
        
easingo.easing,
        
complete: function() {
            if ( 
mode === "hide" ) {
                
el.hide();
            }
            $.
effects.restoreelprops );
            $.
effects.removeWrapperel );
            
done();
        }
    });
};

})(
jQuery);
(function( $, 
undefined ) {

$.
effects.effect.explode = function( odone ) {

    var 
rows o.pieces Math.roundMath.sqrto.pieces ) ) : 3,
        
cells rows,
        
el = $( this ),
        
mode = $.effects.setModeelo.mode || "hide" ),
        
show mode === "show",

        
// show and then visibility:hidden the element before calculating offset
        
offset el.show().css"visibility""hidden" ).offset(),

        
// width and height of a piece
        
width Math.ceilel.outerWidth() / cells ),
        
height Math.ceilel.outerHeight() / rows ),
        
pieces = [],

        
// loop
        
ijlefttopmxmy;

    
// children animate complete:
    
function childComplete() {
        
pieces.pushthis );
        if ( 
pieces.length === rows cells ) {
            
animComplete();
        }
    }

    
// clone the element for each row and cell.
    
for( 0rows i++ ) { // ===>
        
top offset.top height;
        
my - ( rows ) / ;

        for( 
0cells j++ ) { // |||
            
left offset.left width;
            
mx - ( cells ) / ;

            
// Create a clone of the now hidden main element that will be absolute positioned
            // within a wrapper div off the -left and -top equal to size of our pieces
            
el
                
.clone()
                .
appendTo"body" )
                .
wrap"<div></div>" )
                .
css({
                    
position"absolute",
                    
visibility"visible",
                    
left: -width,
                    
top: -height
                
})

            
// select the wrapper - make it overflow: hidden and absolute positioned based on
            // where the original was located +left and +top equal to the size of pieces
                
.parent()
                .
addClass"ui-effects-explode" )
                .
css({
                    
position"absolute",
                    
overflow"hidden",
                    
widthwidth,
                    
heightheight,
                    
leftleft + ( show mx width ),
                    
toptop + ( show my height ),
                    
opacityshow 1
                
}).animate({
                    
leftleft + ( show mx width ),
                    
toptop + ( show my height ),
                    
opacityshow 0
                
}, o.duration || 500o.easingchildComplete );
        }
    }

    function 
animComplete() {
        
el.css({
            
visibility"visible"
        
});
        $( 
pieces ).remove();
        if ( !
show ) {
            
el.hide();
        }
        
done();
    }
};

})(
jQuery);
(function( $, 
undefined ) {

$.
effects.effect.fade = function( odone ) {
    var 
el = $( this ),
        
mode = $.effects.setModeelo.mode || "toggle" );

    
el.animate({
        
opacitymode
    
}, {
        
queuefalse,
        
durationo.duration,
        
easingo.easing,
        
completedone
    
});
};

})( 
jQuery );
(function( $, 
undefined ) {

$.
effects.effect.fold = function( odone ) {

    
// Create element
    
var el = $( this ),
        
props = [ "position""top""bottom""left""right""height""width" ],
        
mode = $.effects.setModeelo.mode || "hide" ),
        
show mode === "show",
        
hide mode === "hide",
        
size o.size || 15,
        
percent = /([0-9]+)%/.execsize ),
        
horizFirst = !!o.horizFirst,
        
widthFirst show !== horizFirst,
        
ref widthFirst ? [ "width""height" ] : [ "height""width" ],
        
duration o.duration 2,
        
wrapperdistance,
        
animation1 = {},
        
animation2 = {};

    $.
effects.saveelprops );
    
el.show();

    
// Create Wrapper
    
wrapper = $.effects.createWrapperel ).css({
        
overflow"hidden"
    
});
    
distance widthFirst ?
        [ 
wrapper.width(), wrapper.height() ] :
        [ 
wrapper.height(), wrapper.width() ];

    if ( 
percent ) {
        
size parseIntpercent], 10 ) / 100 distancehide ];
    }
    if ( 
show ) {
        
wrapper.csshorizFirst ? {
            
height0,
            
widthsize
        
} : {
            
heightsize,
            
width0
        
});
    }

    
// Animation
    
animation1ref] ] = show distance] : size;
    
animation2ref] ] = show distance] : 0;

    
// Animate
    
wrapper
        
.animateanimation1durationo.easing )
        .
animateanimation2durationo.easing, function() {
            if ( 
hide ) {
                
el.hide();
            }
            $.
effects.restoreelprops );
            $.
effects.removeWrapperel );
            
done();
        });

};

})(
jQuery);
(function( $, 
undefined ) {

$.
effects.effect.highlight = function( odone ) {
    var 
elem = $( this ),
        
props = [ "backgroundImage""backgroundColor""opacity" ],
        
mode = $.effects.setModeelemo.mode || "show" ),
        
animation = {
            
backgroundColorelem.css"backgroundColor" )
        };

    if (
mode === "hide") {
        
animation.opacity 0;
    }

    $.
effects.saveelemprops );

    
elem
        
.show()
        .
css({
            
backgroundImage"none",
            
backgroundColoro.color || "#ffff99"
        
})
        .
animateanimation, {
            
queuefalse,
            
durationo.duration,
            
easingo.easing,
            
complete: function() {
                if ( 
mode === "hide" ) {
                    
elem.hide();
                }
                $.
effects.restoreelemprops );
                
done();
            }
        });
};

})(
jQuery);
(function( $, 
undefined ) {

$.
effects.effect.pulsate = function( odone ) {
    var 
elem = $( this ),
        
mode = $.effects.setModeelemo.mode || "show" ),
        
show mode === "show",
        
hide mode === "hide",
        
showhide = ( show || mode === "hide" ),

        
// showing or hiding leaves of the "last" animation
        
anims = ( ( o.times || ) * ) + ( showhide ),
        
duration o.duration anims,
        
animateTo 0,
        
queue elem.queue(),
        
queuelen queue.length,
        
i;

    if ( 
show || !elem.is(":visible")) {
        
elem.css"opacity").show();
        
animateTo 1;
    }

    
// anims - 1 opacity "toggles"
    
for ( 1animsi++ ) {
        
elem.animate({
            
opacityanimateTo
        
}, durationo.easing );
        
animateTo animateTo;
    }

    
elem.animate({
        
opacityanimateTo
    
}, durationo.easing);

    
elem.queue(function() {
        if ( 
hide ) {
            
elem.hide();
        }
        
done();
    });

    
// We just queued up "anims" animations, we need to put them next in the queue
    
if ( queuelen ) {
        
queue.splice.applyqueue,
            [ 
1].concatqueue.splicequeuelenanims ) ) );
    }
    
elem.dequeue();
};

})(
jQuery);
(function( $, 
undefined ) {

$.
effects.effect.puff = function( odone ) {
    var 
elem = $( this ),
        
mode = $.effects.setModeelemo.mode || "hide" ),
        
hide mode === "hide",
        
percent parseInto.percent10 ) || 150,
        
factor percent 100,
        
original = {
            
heightelem.height(),
            
widthelem.width(),
            
outerHeightelem.outerHeight(),
            
outerWidthelem.outerWidth()
        };

    $.
extendo, {
        
effect"scale",
        
queuefalse,
        
fadetrue,
        
modemode,
        
completedone,
        
percenthide percent 100,
        
fromhide ?
            
original :
            {
                
heightoriginal.height factor,
                
widthoriginal.width factor,
                
outerHeightoriginal.outerHeight factor,
                
outerWidthoriginal.outerWidth factor
            
}
    });

    
elem.effect);
};

$.
effects.effect.scale = function( odone ) {

    
// Create element
    
var el = $( this ),
        
options = $.extendtrue, {}, ),
        
mode = $.effects.setModeelo.mode || "effect" ),
        
percent parseInto.percent10 ) ||
            ( 
parseInto.percent10 ) === : ( mode === "hide" 100 ) ),
        
direction o.direction || "both",
        
origin o.origin,
        
original = {
            
heightel.height(),
            
widthel.width(),
            
outerHeightel.outerHeight(),
            
outerWidthel.outerWidth()
        },
        
factor = {
            
ydirection !== "horizontal" ? (percent 100) : 1,
            
xdirection !== "vertical" ? (percent 100) : 1
        
};

    
// We are going to pass this effect to the size effect:
    
options.effect "size";
    
options.queue false;
    
options.complete done;

    
// Set default origin and restore for show/hide
    
if ( mode !== "effect" ) {
        
options.origin origin || ["middle","center"];
        
options.restore true;
    }

    
options.from o.from || ( mode === "show" ? {
        
height0,
        
width0,
        
outerHeight0,
        
outerWidth0
    
} : original );
    
options.to = {
        
heightoriginal.height factor.y,
        
widthoriginal.width factor.x,
        
outerHeightoriginal.outerHeight factor.y,
        
outerWidthoriginal.outerWidth factor.x
    
};

    
// Fade option to support puff
    
if ( options.fade ) {
        if ( 
mode === "show" ) {
            
options.from.opacity 0;
            
options.to.opacity 1;
        }
        if ( 
mode === "hide" ) {
            
options.from.opacity 1;
            
options.to.opacity 0;
        }
    }

    
// Animate
    
el.effectoptions );

};

$.
effects.effect.size = function( odone ) {

    
// Create element
    
var originalbaselinefactor,
        
el = $( this ),
        
props0 = [ "position""top""bottom""left""right""width""height""overflow""opacity" ],

        
// Always restore
        
props1 = [ "position""top""bottom""left""right""overflow""opacity" ],

        
// Copy for children
        
props2 = [ "width""height""overflow" ],
        
cProps = [ "fontSize" ],
        
vProps = [ "borderTopWidth""borderBottomWidth""paddingTop""paddingBottom" ],
        
hProps = [ "borderLeftWidth""borderRightWidth""paddingLeft""paddingRight" ],

        
// Set options
        
mode = $.effects.setModeelo.mode || "effect" ),
        
restore o.restore || mode !== "effect",
        
scale o.scale || "both",
        
origin o.origin || [ "middle""center" ],
        
position el.css"position" ),
        
props restore props0 props1,
        
zero = {
            
height0,
            
width0,
            
outerHeight0,
            
outerWidth0
        
};

    if ( 
mode === "show" ) {
        
el.show();
    }
    
original = {
        
heightel.height(),
        
widthel.width(),
        
outerHeightel.outerHeight(),
        
outerWidthel.outerWidth()
    };

    if ( 
o.mode === "toggle" && mode === "show" ) {
        
el.from o.to || zero;
        
el.to o.from || original;
    } else {
        
el.from o.from || ( mode === "show" zero original );
        
el.to o.to || ( mode === "hide" zero original );
    }

    
// Set scaling factor
    
factor = {
        
from: {
            
yel.from.height original.height,
            
xel.from.width original.width
        
},
        
to: {
            
yel.to.height original.height,
            
xel.to.width original.width
        
}
    };

    
// Scale the css box
    
if ( scale === "box" || scale === "both" ) {

        
// Vertical props scaling
        
if ( factor.from.!== factor.to.) {
            
props props.concatvProps );
            
el.from = $.effects.setTransitionelvPropsfactor.from.yel.from );
            
el.to = $.effects.setTransitionelvPropsfactor.to.yel.to );
        }

        
// Horizontal props scaling
        
if ( factor.from.!== factor.to.) {
            
props props.concathProps );
            
el.from = $.effects.setTransitionelhPropsfactor.from.xel.from );
            
el.to = $.effects.setTransitionelhPropsfactor.to.xel.to );
        }
    }

    
// Scale the content
    
if ( scale === "content" || scale === "both" ) {

        
// Vertical props scaling
        
if ( factor.from.!== factor.to.) {
            
props props.concatcProps ).concatprops2 );
            
el.from = $.effects.setTransitionelcPropsfactor.from.yel.from );
            
el.to = $.effects.setTransitionelcPropsfactor.to.yel.to );
        }
    }

    $.
effects.saveelprops );
    
el.show();
    $.
effects.createWrapperel );
    
el.css"overflow""hidden" ).cssel.from );

    
// Adjust
    
if (origin) { // Calculate baseline shifts
        
baseline = $.effects.getBaselineoriginoriginal );
        
el.from.top = ( original.outerHeight el.outerHeight() ) * baseline.y;
        
el.from.left = ( original.outerWidth el.outerWidth() ) * baseline.x;
        
el.to.top = ( original.outerHeight el.to.outerHeight ) * baseline.y;
        
el.to.left = ( original.outerWidth el.to.outerWidth ) * baseline.x;
    }
    
el.cssel.from ); // set top & left

    // Animate
    
if ( scale === "content" || scale === "both" ) { // Scale the children

        // Add margins/font-size
        
vProps vProps.concat([ "marginTop""marginBottom" ]).concat(cProps);
        
hProps hProps.concat([ "marginLeft""marginRight" ]);
        
props2 props0.concat(vProps).concat(hProps);

        
el.find"*[width]" ).each( function(){
            var 
child = $( this ),
                
c_original = {
                    
heightchild.height(),
                    
widthchild.width(),
                    
outerHeightchild.outerHeight(),
                    
outerWidthchild.outerWidth()
                };
            if (
restore) {
                $.
effects.save(childprops2);
            }

            
child.from = {
                
heightc_original.height factor.from.y,
                
widthc_original.width factor.from.x,
                
outerHeightc_original.outerHeight factor.from.y,
                
outerWidthc_original.outerWidth factor.from.x
            
};
            
child.to = {
                
heightc_original.height factor.to.y,
                
widthc_original.width factor.to.x,
                
outerHeightc_original.height factor.to.y,
                
outerWidthc_original.width factor.to.x
            
};

            
// Vertical props scaling
            
if ( factor.from.!== factor.to.) {
                
child.from = $.effects.setTransitionchildvPropsfactor.from.ychild.from );
                
child.to = $.effects.setTransitionchildvPropsfactor.to.ychild.to );
            }

            
// Horizontal props scaling
            
if ( factor.from.!== factor.to.) {
                
child.from = $.effects.setTransitionchildhPropsfactor.from.xchild.from );
                
child.to = $.effects.setTransitionchildhPropsfactor.to.xchild.to );
            }

            
// Animate children
            
child.csschild.from );
            
child.animatechild.too.durationo.easing, function() {

                
// Restore children
                
if ( restore ) {
                    $.
effects.restorechildprops2 );
                }
            });
        });
    }

    
// Animate
    
el.animateel.to, {
        
queuefalse,
        
durationo.duration,
        
easingo.easing,
        
complete: function() {
            if ( 
el.to.opacity === ) {
                
el.css"opacity"el.from.opacity );
            }
            if( 
mode === "hide" ) {
                
el.hide();
            }
            $.
effects.restoreelprops );
            if ( !
restore ) {

                
// we need to calculate our new positioning based on the scaling
                
if ( position === "static" ) {
                    
el.css({
                        
position"relative",
                        
topel.to.top,
                        
leftel.to.left
                    
});
                } else {
                    $.
each([ "top""left" ], function( idxpos ) {
                        
el.csspos, function( _str ) {
                            var 
val parseIntstr10 ),
                                
toRef idx el.to.left el.to.top;

                            
// if original was "auto", recalculate the new value from wrapper
                            
if ( str === "auto" ) {
                                return 
toRef "px";
                            }

                            return 
val toRef "px";
                        });
                    });
                }
            }

            $.
effects.removeWrapperel );
            
done();
        }
    });

};

})(
jQuery);
(function( $, 
undefined ) {

$.
effects.effect.shake = function( odone ) {

    var 
el = $( this ),
        
props = [ "position""top""bottom""left""right""height""width" ],
        
mode = $.effects.setModeelo.mode || "effect" ),
        
direction o.direction || "left",
        
distance o.distance || 20,
        
times o.times || 3,
        
anims times 1,
        
speed Math.round(o.duration/anims),
        
ref = (direction === "up" || direction === "down") ? "top" "left",
        
positiveMotion = (direction === "up" || direction === "left"),
        
animation = {},
        
animation1 = {},
        
animation2 = {},
        
i,

        
// we will need to re-assemble the queue to stack our animations in place
        
queue el.queue(),
        
queuelen queue.length;

    $.
effects.saveelprops );
    
el.show();
    $.
effects.createWrapperel );

    
// Animation
    
animationref ] = ( positiveMotion "-=" "+=" ) + distance;
    
animation1ref ] = ( positiveMotion "+=" "-=" ) + distance 2;
    
animation2ref ] = ( positiveMotion "-=" "+=" ) + distance 2;

    
// Animate
    
el.animateanimationspeedo.easing );

    
// Shakes
    
for ( 1timesi++ ) {
        
el.animateanimation1speedo.easing ).animateanimation2speedo.easing );
    }
    
el
        
.animateanimation1speedo.easing )
        .
animateanimationspeed 2o.easing )
        .
queue(function() {
            if ( 
mode === "hide" ) {
                
el.hide();
            }
            $.
effects.restoreelprops );
            $.
effects.removeWrapperel );
            
done();
        });

    
// inject all the animations we just queued to be first in line (after "inprogress")
    
if ( queuelen 1) {
        
queue.splice.applyqueue,
            [ 
1].concatqueue.splicequeuelenanims ) ) );
    }
    
el.dequeue();

};

})(
jQuery);
(function( $, 
undefined ) {

$.
effects.effect.slide = function( odone ) {

    
// Create element
    
var el = $( this ),
        
props = [ "position""top""bottom""left""right""width""height" ],
        
mode = $.effects.setModeelo.mode || "show" ),
        
show mode === "show",
        
direction o.direction || "left",
        
ref = (direction === "up" || direction === "down") ? "top" "left",
        
positiveMotion = (direction === "up" || direction === "left"),
        
distance,
        
animation = {};

    
// Adjust
    
$.effects.saveelprops );
    
el.show();
    
distance o.distance || elref === "top" "outerHeight" "outerWidth" ]( true );

    $.
effects.createWrapperel ).css({
        
overflow"hidden"
    
});

    if ( 
show ) {
        
el.cssrefpositiveMotion ? (isNaN(distance) ? "-" distance : -distance) : distance );
    }

    
// Animation
    
animationref ] = ( show ?
        ( 
positiveMotion "+=" "-=") :
        ( 
positiveMotion "-=" "+=")) +
        
distance;

    
// Animate
    
el.animateanimation, {
        
queuefalse,
        
durationo.duration,
        
easingo.easing,
        
complete: function() {
            if ( 
mode === "hide" ) {
                
el.hide();
            }
            $.
effects.restoreelprops );
            $.
effects.removeWrapperel );
            
done();
        }
    });
};

})(
jQuery);
(function( $, 
undefined ) {

$.
effects.effect.transfer = function( odone ) {
    var 
elem = $( this ),
        
target = $( o.to ),
        
targetFixed target.css"position" ) === "fixed",
        
body = $("body"),
        
fixTop targetFixed body.scrollTop() : 0,
        
fixLeft targetFixed body.scrollLeft() : 0,
        
endPosition target.offset(),
        
animation = {
            
topendPosition.top fixTop ,
            
leftendPosition.left fixLeft ,
            
heighttarget.innerHeight(),
            
widthtarget.innerWidth()
        },
        
startPosition elem.offset(),
        
transfer = $( "<div class='ui-effects-transfer'></div>" )
            .
appendTodocument.body )
            .
addClasso.className )
            .
css({
                
topstartPosition.top fixTop ,
                
leftstartPosition.left fixLeft ,
                
heightelem.innerHeight(),
                
widthelem.innerWidth(),
                
positiontargetFixed "fixed" "absolute"
            
})
            .
animateanimationo.durationo.easing, function() {
                
transfer.remove();
                
done();
            });
};

})(
jQuery);
?>
Онлайн: 3
Реклама