Index: Makefile
===================================================================
--- Makefile	(revision 1581)
+++ Makefile	(revision 1655)
@@ -70,5 +70,4 @@
 	find $(DC)/admin/js/jsToolBar/*.js -exec ./build-tools/min-js.php \{\} \;
 	find $(DC)/admin/js/jsUpload/*.js -exec ./build-tools/min-js.php \{\} \;
-	find $(DC)/admin/js/tool-man/*.js -exec ./build-tools/min-js.php \{\} \;
 	find $(DC)/plugins -name '*.js' -exec ./build-tools/min-js.php \{\} \;
 	find $(DC)/themes/default/js/*.js -exec ./build-tools/min-js.php \{\} \;
Index: admin/blogs.php
===================================================================
--- admin/blogs.php	(revision 1553)
+++ admin/blogs.php	(revision 1668)
@@ -134,11 +134,10 @@
 		
 		echo
-		'<table class="clear"><tr>'.
-		'<th>'.__('Blog name').'</th>'.
-		'<th class="nowrap">'.__('Last update').'</th>'.
-		'<th class="nowrap">'.__('Entries (all types)').'</th>'.
-		'<th class="nowrap">'.__('Blog ID').'</th>'.
-		'<th>&nbsp;</th>'.
-		'<th class="nowrap">'.__('Status').'</th>'.
+		'<table class="clear"><caption class="hidden">'.__('Blogs list').'</caption><tr>'.
+		'<th scope="col" class="nowrap">'.__('Blog id').'</th>'.
+		'<th scope="col">'.__('Blog name').'</th>'.
+		'<th scope="col" class="nowrap">'.__('Entries (all types)').'</th>'.
+		'<th scope="col" class="nowrap">'.__('Last update').'</th>'.
+		'<th scope="col" class="nowrap">'.__('Status').'</th>'.
 		'</tr>';
 		
@@ -164,7 +163,6 @@
 	if ($GLOBALS['core']->auth->isSuperAdmin()) {
 		$edit_link = 
-		'<a href="blog.php?id='.$blog_id.'" '.
-		'title="'.sprintf(__('Edit blog %s'),$blog_id).'">'.
-		__('edit').'</a>';
+		'<a href="blog.php?id='.$blog_id.'"  title="'.sprintf(__('Edit blog settings for %s'),$blog_id).'">'.
+		'<img src="images/edit-mini.png" alt="'.__('Edit blog settings').'" /> '.$blog_id.'</a> ';
 	}
 	
@@ -177,11 +175,10 @@
 	return
 	'<tr class="line">'.
+	'<td class="nowrap">'.$edit_link.'</td>'.
 	'<td class="maximal"><a href="index.php?switchblog='.$rs->blog_id.'" '.
 	'title="'.sprintf(__('Switch to blog %s'),$rs->blog_id).'">'.
 	html::escapeHTML($rs->blog_name).'</a></td>'.
-	'<td class="nowrap">'.$blog_upddt.'</td>'.
-	'<td class="nowrap">'.$core->countBlogPosts($rs->blog_id).'</td>'.
-	'<td class="nowrap">'.$blog_id.'</td>'.
-	'<td>'.$edit_link.'</td>'.
+	'<td class="nowrap count">'.$core->countBlogPosts($rs->blog_id).'</td>'.
+	'<td class="nowrap count">'.$blog_upddt.'</td>'.
 	'<td class="status">'.$img_status.'</td>'.
 	'</tr>';
Index: admin/categories.php
===================================================================
--- admin/categories.php	(revision 1636)
+++ admin/categories.php	(revision 1662)
@@ -87,10 +87,10 @@
 $rs = $core->blog->getCategories(array('post_type'=>'post'));
 
-$starting_script = dcPage::jsToolMan()."\n";
+$starting_script = "";
 if (!$core->auth->user_prefs->accessibility->nodragdrop
 	&& $core->auth->check('categories',$core->blog->id)
 	&& $rs->count()>1) {
-        $starting_script .= dcPage::jsLoad('js/jquery/jquery-ui.custom.js');
-	$starting_script .= dcPage::jsLoad('js/jquery/jquery.mjs.nestedSortable.js');
+		$starting_script .= dcPage::jsLoad('js/jquery/jquery-ui.custom.js');
+		$starting_script .= dcPage::jsLoad('js/jquery/jquery.mjs.nestedSortable.js');
 }
 $starting_script .= dcPage::jsLoad('js/_categories.js');
Index: admin/js/_posts_list.js
===================================================================
--- admin/js/_posts_list.js	(revision 1034)
+++ admin/js/_posts_list.js	(revision 1640)
@@ -28,23 +28,30 @@
 
 dotclear.viewPostsContent = function(img,lines) {
-	lines.each(function() {
-		var td = this.firstChild;
-		td.firstChild.click();
-	});
+	
+	action = 'toggle';
 
 	if (img.alt == dotclear.img_plus_alt) {
 		img.src = dotclear.img_minus_src;
 		img.alt = dotclear.img_minus_alt;
+		action = 'open';
 	} else {
 		img.src = dotclear.img_plus_src;
 		img.alt = dotclear.img_plus_alt;
+		action = 'close';
 	}
+	
+	lines.each(function() {
+		var td = this.firstChild;
+		dotclear.viewPostContent(td.firstChild,td.firstChild.line,action);
+	});
 };
 
-dotclear.viewPostContent = function(img,line) {
+dotclear.viewPostContent = function(img,line,action) {
+	
+	var action = action || 'toggle';
 	var postId = line.id.substr(1);
 	var tr = document.getElementById('pe'+postId);
 	
-	if (!tr) {
+	if ( !tr && ( action == 'toggle' || action == 'open' ) ) {
 		tr = document.createElement('tr');
 		tr.id = 'pe'+postId;
@@ -78,21 +85,35 @@
 		});
 		
-		$(line).toggleClass('expand');
+		$(line).addClass('expand');
 		line.parentNode.insertBefore(tr,line.nextSibling);
 	}
-	else if (tr.style.display == 'none')
+	else if (tr && tr.style.display == 'none' && ( action == 'toggle' || action == 'open' ) )
 	{
-		$(tr).toggle();
-		$(line).toggleClass('expand');
+		$(tr).css('display', 'table-row');
+		$(line).addClass('expand');
 		img.src = dotclear.img_minus_src;
 		img.alt = dotclear.img_minus_alt;
 	}
-	else
+	else if (tr && tr.style.display != 'none' && ( action == 'toggle' || action == 'close' ) )
 	{
-		$(tr).toggle();
-		$(line).toggleClass('expand');
+		$(tr).css('display', 'none');
+		$(line).removeClass('expand');
 		img.src = dotclear.img_plus_src;
 		img.alt = dotclear.img_plus_alt;
 	}
+	
+	parentTable = $(line).parents('table');
+	if( parentTable.find('tr.expand').length == parentTable.find('tr.line').length ) {
+		img = parentTable.find('tr:not(.line) th:first img');
+		img.attr('src',dotclear.img_minus_src);
+		img.attr('alt',dotclear.img_minus_alt);
+	}
+	
+	if( parentTable.find('tr.expand').length == 0 ) {
+		img = parentTable.find('tr:not(.line) th:first img');
+		img.attr('src',dotclear.img_plus_src);
+		img.attr('alt',dotclear.img_plus_alt);
+	}
+	
 };
 
Index: admin/js/jquery/jquery-ui.custom.js
===================================================================
--- admin/js/jquery/jquery-ui.custom.js	(revision 1048)
+++ admin/js/jquery/jquery-ui.custom.js	(revision 1648)
@@ -1,6 +1,6 @@
-/*! jQuery UI - v1.9.2 - 2012-11-29
+/*! jQuery UI - v1.10.3 - 2013-08-23
 * http://jqueryui.com
-* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.sortable.js, jquery.ui.accordion.js
-* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */
+* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.sortable.js, jquery.ui.accordion.js
+* Copyright 2013 jQuery Foundation and other contributors Licensed MIT */
 
 (function( $, undefined ) {
@@ -9,14 +9,9 @@
 	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 might exist from components with no dependencies, e.g., $.ui.position
 $.ui = $.ui || {};
-if ( $.ui.version ) {
-	return;
-}
 
 $.extend( $.ui, {
-	version: "1.9.2",
+	version: "1.10.3",
 
 	keyCode: {
@@ -48,32 +43,33 @@
 // 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.call( elem );
-					}
-				}, delay );
-			}) :
-			this._focus.apply( this, arguments );
-	},
+	focus: (function( orig ) {
+		return function( delay, fn ) {
+			return typeof delay === "number" ?
+				this.each(function() {
+					var elem = this;
+					setTimeout(function() {
+						$( elem ).focus();
+						if ( fn ) {
+							fn.call( elem );
+						}
+					}, delay );
+				}) :
+				orig.apply( this, arguments );
+		};
+	})( $.fn.focus ),
 
 	scrollParent: function() {
 		var scrollParent;
-		if (($.ui.ie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
+		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'));
+				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'));
+				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;
+		return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent;
 	},
 
@@ -148,5 +144,5 @@
 function visible( element ) {
 	return $.expr.filters.visible( element ) &&
-		!$( element ).parents().andSelf().filter(function() {
+		!$( element ).parents().addBack().filter(function() {
 			return $.css( this, "visibility" ) === "hidden";
 		}).length;
@@ -176,29 +172,4 @@
 });
 
-// support
-$(function() {
-	var body = document.body,
-		div = body.appendChild( div = document.createElement( "div" ) );
-
-	// access offsetHeight before setting the style to prevent a layout bug
-	// in IE 9 which causes the element to continue to take up space even
-	// after it is removed from the DOM (#8026)
-	div.offsetHeight;
-
-	$.extend( div.style, {
-		minHeight: "100px",
-		height: "auto",
-		padding: 0,
-		borderWidth: 0
-	});
-
-	$.support.minHeight = div.offsetHeight === 100;
-	$.support.selectstart = "onselectstart" in div;
-
-	// set display to none to avoid a layout bug in IE
-	// http://dev.jquery.com/ticket/4014
-	body.removeChild( div ).style.display = "none";
-});
-
 // support: jQuery <1.8
 if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
@@ -248,4 +219,13 @@
 }
 
+// support: jQuery <1.8
+if ( !$.fn.addBack ) {
+	$.fn.addBack = function( selector ) {
+		return this.add( selector == null ?
+			this.prevObject : this.prevObject.filter( selector )
+		);
+	};
+}
+
 // 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" ) ) {
@@ -266,11 +246,7 @@
 
 // deprecated
-
-(function() {
-	var uaMatch = /msie ([\w.]+)/.exec( navigator.userAgent.toLowerCase() ) || [];
-	$.ui.ie = uaMatch.length ? true : false;
-	$.ui.ie6 = parseFloat( uaMatch[ 1 ], 10 ) === 6;
-})();
-
+$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
+
+$.support.selectstart = "onselectstart" in document.createElement( "div" );
 $.fn.extend({
 	disableSelection: function() {
@@ -287,5 +263,5 @@
 
 $.extend( $.ui, {
-	// $.ui.plugin is deprecated.  Use the proxy pattern instead.
+	// $.ui.plugin is deprecated. Use $.widget() extensions instead.
 	plugin: {
 		add: function( module, option, set ) {
@@ -312,6 +288,4 @@
 	},
 
-	contains: $.contains,
-
 	// only used by resizable
 	hasScroll: function( el, a ) {
@@ -336,14 +310,4 @@
 		el[ scroll ] = 0;
 		return has;
-	},
-
-	// these are odd functions, fix the API or move into individual plugins
-	isOverAxis: function( x, reference, size ) {
-		//Determines when x coordinate is over "b" element axis
-		return ( x > reference ) && ( x < ( reference + size ) );
-	},
-	isOver: function( y, x, top, left, height, width ) {
-		//Determines when x, y coordinates is over "b" element
-		return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
 	}
 });
@@ -367,4 +331,7 @@
 $.widget = function( name, base, prototype ) {
 	var fullName, existingConstructor, constructor, basePrototype,
+		// 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( "." )[ 0 ];
 
@@ -413,29 +380,31 @@
 	basePrototype.options = $.widget.extend( {}, basePrototype.options );
 	$.each( prototype, function( prop, value ) {
-		if ( $.isFunction( value ) ) {
-			prototype[ prop ] = (function() {
-				var _super = function() {
-						return base.prototype[ prop ].apply( this, arguments );
-					},
-					_superApply = function( args ) {
-						return base.prototype[ prop ].apply( this, args );
-					};
-				return function() {
-					var __super = this._super,
-						__superApply = this._superApply,
-						returnValue;
-
-					this._super = _super;
-					this._superApply = _superApply;
-
-					returnValue = value.apply( this, arguments );
-
-					this._super = __super;
-					this._superApply = __superApply;
-
-					return returnValue;
+		if ( !$.isFunction( value ) ) {
+			proxiedPrototype[ prop ] = value;
+			return;
+		}
+		proxiedPrototype[ prop ] = (function() {
+			var _super = function() {
+					return base.prototype[ prop ].apply( this, arguments );
+				},
+				_superApply = function( args ) {
+					return base.prototype[ prop ].apply( this, args );
 				};
-			})();
-		}
+			return function() {
+				var __super = this._super,
+					__superApply = this._superApply,
+					returnValue;
+
+				this._super = _super;
+				this._superApply = _superApply;
+
+				returnValue = value.apply( this, arguments );
+
+				this._super = __super;
+				this._superApply = __superApply;
+
+				return returnValue;
+			};
+		})();
 	});
 	constructor.prototype = $.widget.extend( basePrototype, {
@@ -444,10 +413,8 @@
 		// don't prefix for widgets that aren't DOM-based
 		widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
-	}, prototype, {
+	}, proxiedPrototype, {
 		constructor: constructor,
 		namespace: namespace,
 		widgetName: name,
-		// TODO remove widgetBaseClass, see #8155
-		widgetBaseClass: fullName,
 		widgetFullName: fullName
 	});
@@ -575,7 +542,4 @@
 
 		if ( element !== this ) {
-			// 1.9 BC for #7810
-			// TODO remove dual storage
-			$.data( element, this.widgetName, this );
 			$.data( element, this.widgetFullName, this );
 			this._on( true, this.element, {
@@ -844,5 +808,5 @@
 			element.delay( options.delay );
 		}
-		if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) {
+		if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
 			element[ method ]( options );
 		} else if ( effectName !== method && element[ effectName ] ) {
@@ -860,23 +824,16 @@
 });
 
-// DEPRECATED
-if ( $.uiBackCompat !== false ) {
-	$.Widget.prototype._getCreateOptions = function() {
-		return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
-	};
-}
-
 })( jQuery );
 (function( $, undefined ) {
 
 var mouseHandled = false;
-$( document ).mouseup( function( e ) {
+$( document ).mouseup( function() {
 	mouseHandled = false;
 });
 
 $.widget("ui.mouse", {
-	version: "1.9.2",
+	version: "1.10.3",
 	options: {
-		cancel: 'input,textarea,button,select,option',
+		cancel: "input,textarea,button,select,option",
 		distance: 1,
 		delay: 0
@@ -886,10 +843,10 @@
 
 		this.element
-			.bind('mousedown.'+this.widgetName, function(event) {
+			.bind("mousedown."+this.widgetName, function(event) {
 				return that._mouseDown(event);
 			})
-			.bind('click.'+this.widgetName, function(event) {
-				if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) {
-					$.removeData(event.target, that.widgetName + '.preventClickEvent');
+			.bind("click."+this.widgetName, function(event) {
+				if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
+					$.removeData(event.target, that.widgetName + ".preventClickEvent");
 					event.stopImmediatePropagation();
 					return false;
@@ -903,9 +860,9 @@
 	// other instances of mouse
 	_mouseDestroy: function() {
-		this.element.unbind('.'+this.widgetName);
+		this.element.unbind("."+this.widgetName);
 		if ( this._mouseMoveDelegate ) {
 			$(document)
-				.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
-				.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+				.unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
+				.unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
 		}
 	},
@@ -945,6 +902,6 @@
 
 		// Click event may never have fired (Gecko & Opera)
-		if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
-			$.removeData(event.target, this.widgetName + '.preventClickEvent');
+		if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
+			$.removeData(event.target, this.widgetName + ".preventClickEvent");
 		}
 
@@ -957,6 +914,6 @@
 		};
 		$(document)
-			.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
-			.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+			.bind("mousemove."+this.widgetName, this._mouseMoveDelegate)
+			.bind("mouseup."+this.widgetName, this._mouseUpDelegate);
 
 		event.preventDefault();
@@ -968,5 +925,5 @@
 	_mouseMove: function(event) {
 		// IE mouseup check - mouseup happened when mouse was out of window
-		if ($.ui.ie && !(document.documentMode >= 9) && !event.button) {
+		if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
 			return this._mouseUp(event);
 		}
@@ -988,6 +945,6 @@
 	_mouseUp: function(event) {
 		$(document)
-			.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
-			.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+			.unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
+			.unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
 
 		if (this._mouseStarted) {
@@ -995,5 +952,5 @@
 
 			if (event.target === this._mouseDownEvent.target) {
-				$.data(event.target, this.widgetName + '.preventClickEvent', true);
+				$.data(event.target, this.widgetName + ".preventClickEvent", true);
 			}
 
@@ -1012,13 +969,13 @@
 	},
 
-	_mouseDelayMet: function(event) {
+	_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; }
+	_mouseStart: function(/* event */) {},
+	_mouseDrag: function(/* event */) {},
+	_mouseStop: function(/* event */) {},
+	_mouseCapture: function(/* event */) { return true; }
 });
 
@@ -1026,6 +983,959 @@
 (function( $, undefined ) {
 
+$.widget("ui.draggable", $.ui.mouse, {
+	version: "1.10.3",
+	widgetEventPrefix: "drag",
+	options: {
+		addClasses: true,
+		appendTo: "parent",
+		axis: false,
+		connectToSortable: false,
+		containment: false,
+		cursor: "auto",
+		cursorAt: false,
+		grid: false,
+		handle: false,
+		helper: "original",
+		iframeFix: false,
+		opacity: false,
+		refreshPositions: false,
+		revert: false,
+		revertDuration: 500,
+		scope: "default",
+		scroll: true,
+		scrollSensitivity: 20,
+		scrollSpeed: 20,
+		snap: false,
+		snapMode: "both",
+		snapTolerance: 20,
+		stack: false,
+		zIndex: false,
+
+		// callbacks
+		drag: null,
+		start: null,
+		stop: null
+	},
+	_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 o = 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({
+				width: this.offsetWidth+"px", height: this.offsetHeight+"px",
+				position: "absolute", opacity: "0.001", zIndex: 1000
+			})
+			.css($(this).offset())
+			.appendTo("body");
+		});
+
+		return true;
+
+	},
+
+	_mouseStart: function(event) {
+
+		var o = 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();
+		this.offsetParent = this.helper.offsetParent();
+		this.offsetParentCssPosition = this.offsetParent.css( "position" );
+
+		//The element's absolute position on the page minus margins
+		this.offset = this.positionAbs = this.element.offset();
+		this.offset = {
+			top: this.offset.top - this.margins.top,
+			left: this.offset.left - this.margins.left
+		};
+
+		//Reset scroll cache
+		this.offset.scroll = false;
+
+		$.extend(this.offset, {
+			click: { //Where the click happened, relative to the element
+				left: event.pageX - this.offset.left,
+				top: event.pageY - this.offset.top
+			},
+			parent: this._getParentOffset(),
+			relative: this._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
+		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(this, event);
+		}
+
+
+		this._mouseDrag(event, true); //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(this, event);
+		}
+
+		return true;
+	},
+
+	_mouseDrag: function(event, noPropagation) {
+		// reset any necessary cached properties (see #5009)
+		if ( this.offsetParentCssPosition === "fixed" ) {
+			this.offset.parent = this._getParentOffset();
+		}
+
+		//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", event, ui) === 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(this, event);
+		}
+
+		return false;
+	},
+
+	_mouseStop: function(event) {
+
+		//If we are using droppables, inform the manager about the drop
+		var that = this,
+			dropped = false;
+		if ($.ui.ddmanager && !this.options.dropBehaviour) {
+			dropped = $.ui.ddmanager.drop(this, event);
+		}
+
+		//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)
+		if ( this.options.helper === "original" && !$.contains( this.element[ 0 ].ownerDocument, this.element[ 0 ] ) ) {
+			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.element, dropped))) {
+			$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), 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(this, event);
+		}
+
+		return $.ui.mouse.prototype._mouseUp.call(this, event);
+	},
+
+	cancel: function() {
+
+		if(this.helper.is(".ui-draggable-dragging")) {
+			this._mouseUp({});
+		} else {
+			this._clear();
+		}
+
+		return this;
+
+	},
+
+	_getHandle: function(event) {
+		return this.options.handle ?
+			!!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
+			true;
+	},
+
+	_createHelper: function(event) {
+
+		var o = 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
+		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 = { top: 0, left: 0 };
+		}
+
+		return {
+			top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
+			left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+		};
+
+	},
+
+	_getRelativeOffset: function() {
+
+		if(this.cssPosition === "relative") {
+			var p = this.element.position();
+			return {
+				top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
+				left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
+			};
+		} else {
+			return { top: 0, left: 0 };
+		}
+
+	},
+
+	_cacheMargins: function() {
+		this.margins = {
+			left: (parseInt(this.element.css("marginLeft"),10) || 0),
+			top: (parseInt(this.element.css("marginTop"),10) || 0),
+			right: (parseInt(this.element.css("marginRight"),10) || 0),
+			bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
+		};
+	},
+
+	_cacheHelperProportions: function() {
+		this.helperProportions = {
+			width: this.helper.outerWidth(),
+			height: this.helper.outerHeight()
+		};
+	},
+
+	_setContainment: function() {
+
+		var over, c, ce,
+			o = this.options;
+
+		if ( !o.containment ) {
+			this.containment = null;
+			return;
+		}
+
+		if ( o.containment === "window" ) {
+			this.containment = [
+				$( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
+				$( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
+				$( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left,
+				$( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
+			];
+			return;
+		}
+
+		if ( o.containment === "document") {
+			this.containment = [
+				0,
+				0,
+				$( document ).width() - this.helperProportions.width - this.margins.left,
+				( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
+			];
+			return;
+		}
+
+		if ( o.containment.constructor === Array ) {
+			this.containment = o.containment;
+			return;
+		}
+
+		if ( o.containment === "parent" ) {
+			o.containment = this.helper[ 0 ].parentNode;
+		}
+
+		c = $( o.containment );
+		ce = c[ 0 ];
+
+		if( !ce ) {
+			return;
+		}
+
+		over = c.css( "overflow" ) !== "hidden";
+
+		this.containment = [
+			( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
+			( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ) ,
+			( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - this.helperProportions.width - this.margins.left - this.margins.right,
+			( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - this.helperProportions.height - this.margins.top  - this.margins.bottom
+		];
+		this.relative_container = c;
+	},
+
+	_convertPositionTo: function(d, pos) {
+
+		if(!pos) {
+			pos = this.position;
+		}
+
+		var mod = d === "absolute" ? 1 : -1,
+			scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent;
+
+		//Cache the scroll
+		if (!this.offset.scroll) {
+			this.offset.scroll = {top : scroll.scrollTop(), left : scroll.scrollLeft()};
+		}
+
+		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() : this.offset.scroll.top ) * 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() : this.offset.scroll.left ) * mod )
+			)
+		};
+
+	},
+
+	_generatePosition: function(event) {
+
+		var containment, co, top, left,
+			o = this.options,
+			scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent,
+			pageX = event.pageX,
+			pageY = event.pageY;
+
+		//Cache the scroll
+		if (!this.offset.scroll) {
+			this.offset.scroll = {top : scroll.scrollTop(), left : scroll.scrollLeft()};
+		}
+
+		/*
+		 * - Position constraining -
+		 * Constrain the position to a mix of grid, containment.
+		 */
+
+		// If we are not dragging yet, we won't check for options
+		if ( this.originalPosition ) {
+			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() : this.offset.scroll.top )
+			),
+			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() : this.offset.scroll.left )
+			)
+		};
+
+	},
+
+	_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(type, event, ui) {
+		ui = ui || this._uiHash();
+		$.ui.plugin.call(this, type, [event, ui]);
+		//The absolute position has to be recalculated after plugins
+		if(type === "drag") {
+			this.positionAbs = this._convertPositionTo("absolute");
+		}
+		return $.Widget.prototype._trigger.call(this, type, event, ui);
+	},
+
+	plugins: {},
+
+	_uiHash: function() {
+		return {
+			helper: this.helper,
+			position: this.position,
+			originalPosition: this.originalPosition,
+			offset: this.positionAbs
+		};
+	}
+
+});
+
+$.ui.plugin.add("draggable", "connectToSortable", {
+	start: function(event, ui) {
+
+		var inst = $(this).data("ui-draggable"), o = inst.options,
+			uiSortable = $.extend({}, ui, { item: inst.element });
+		inst.sortables = [];
+		$(o.connectToSortable).each(function() {
+			var sortable = $.data(this, "ui-sortable");
+			if (sortable && !sortable.options.disabled) {
+				inst.sortables.push({
+					instance: sortable,
+					shouldRevert: sortable.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", event, uiSortable);
+			}
+		});
+
+	},
+	stop: function(event, ui) {
+
+		//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, { item: inst.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 = this.shouldRevert;
+				}
+
+				//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", event, uiSortable);
+			}
+
+		});
+
+	},
+	drag: function(event, ui) {
+
+		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(event, true);
+					this.instance._mouseStart(event, true, true);
+
+					//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", event, this.instance._uiHash(this.instance));
+
+					this.instance._mouseStop(event, true);
+					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 t = $("body"), o = $(this).data("ui-draggable").options;
+		if (t.css("cursor")) {
+			o._cursor = t.css("cursor");
+		}
+		t.css("cursor", o.cursor);
+	},
+	stop: function() {
+		var o = $(this).data("ui-draggable").options;
+		if (o._cursor) {
+			$("body").css("cursor", o._cursor);
+		}
+	}
+});
+
+$.ui.plugin.add("draggable", "opacity", {
+	start: function(event, ui) {
+		var t = $(ui.helper), o = $(this).data("ui-draggable").options;
+		if(t.css("opacity")) {
+			o._opacity = t.css("opacity");
+		}
+		t.css("opacity", o.opacity);
+	},
+	stop: function(event, ui) {
+		var o = $(this).data("ui-draggable").options;
+		if(o._opacity) {
+			$(ui.helper).css("opacity", o._opacity);
+		}
+	}
+});
+
+$.ui.plugin.add("draggable", "scroll", {
+	start: function() {
+		var i = $(this).data("ui-draggable");
+		if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") {
+			i.overflowOffset = i.scrollParent.offset();
+		}
+	},
+	drag: function( event ) {
+
+		var i = $(this).data("ui-draggable"), o = i.options, scrolled = 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(i, event);
+		}
+
+	}
+});
+
+$.ui.plugin.add("draggable", "snap", {
+	start: function() {
+
+		var i = $(this).data("ui-draggable"),
+			o = 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({
+					item: this,
+					width: $t.outerWidth(), height: $t.outerHeight(),
+					top: $o.top, left: $o.left
+				});
+			}
+		});
+
+	},
+	drag: function(event, ui) {
+
+		var ts, bs, ls, rs, l, r, t, b, i, first,
+			inst = $(this).data("ui-draggable"),
+			o = inst.options,
+			d = o.snapTolerance,
+			x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
+			y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
+
+		for (i = inst.snapElements.length - 1; i >= 0; i--){
+
+			l = inst.snapElements[i].left;
+			r = l + inst.snapElements[i].width;
+			t = inst.snapElements[i].top;
+			b = t + inst.snapElements[i].height;
+
+			if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
+				if(inst.snapElements[i].snapping) {
+					(inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
+				}
+				inst.snapElements[i].snapping = false;
+				continue;
+			}
+
+			if(o.snapMode !== "inner") {
+				ts = Math.abs(t - y2) <= d;
+				bs = Math.abs(b - y1) <= d;
+				ls = Math.abs(l - x2) <= d;
+				rs = Math.abs(r - x1) <= d;
+				if(ts) {
+					ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
+				}
+				if(bs) {
+					ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
+				}
+				if(ls) {
+					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
+				}
+				if(rs) {
+					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
+				}
+			}
+
+			first = (ts || bs || ls || rs);
+
+			if(o.snapMode !== "outer") {
+				ts = Math.abs(t - y1) <= d;
+				bs = Math.abs(b - y2) <= d;
+				ls = Math.abs(l - x1) <= d;
+				rs = Math.abs(r - x2) <= d;
+				if(ts) {
+					ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
+				}
+				if(bs) {
+					ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
+				}
+				if(ls) {
+					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
+				}
+				if(rs) {
+					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.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.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
+			}
+			inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
+
+		}
+
+	}
+});
+
+$.ui.plugin.add("draggable", "stack", {
+	start: function() {
+		var min,
+			o = 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(event, ui) {
+		var t = $(ui.helper), o = $(this).data("ui-draggable").options;
+		if(t.css("zIndex")) {
+			o._zIndex = t.css("zIndex");
+		}
+		t.css("zIndex", o.zIndex);
+	},
+	stop: function(event, ui) {
+		var o = $(this).data("ui-draggable").options;
+		if(o._zIndex) {
+			$(ui.helper).css("zIndex", o._zIndex);
+		}
+	}
+});
+
+})(jQuery);
+(function( $, undefined ) {
+
+/*jshint loopfunc: true */
+
+function isOverAxis( x, reference, size ) {
+	return ( x > reference ) && ( x < ( reference + size ) );
+}
+
+function isFloating(item) {
+	return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
+}
+
 $.widget("ui.sortable", $.ui.mouse, {
-	version: "1.9.2",
+	version: "1.10.3",
 	widgetEventPrefix: "sort",
 	ready: false,
@@ -1035,5 +1945,5 @@
 		connectWith: false,
 		containment: false,
-		cursor: 'auto',
+		cursor: "auto",
 		cursorAt: false,
 		dropOnEmpty: true,
@@ -1043,5 +1953,5 @@
 		handle: false,
 		helper: "original",
-		items: '> *',
+		items: "> *",
 		opacity: false,
 		placeholder: false,
@@ -1052,5 +1962,19 @@
 		scope: "default",
 		tolerance: "intersect",
-		zIndex: 1000
+		zIndex: 1000,
+
+		// callbacks
+		activate: null,
+		beforeStop: null,
+		change: null,
+		deactivate: null,
+		out: null,
+		over: null,
+		receive: null,
+		remove: null,
+		sort: null,
+		start: null,
+		stop: null,
+		update: null
 	},
 	_create: function() {
@@ -1064,5 +1988,5 @@
 
 		//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;
+		this.floating = this.items.length ? o.axis === "x" || isFloating(this.items[0].item) : false;
 
 		//Let's determine the parent's offset
@@ -1073,5 +1997,5 @@
 
 		//We're ready to go
-		this.ready = true
+		this.ready = true;
 
 	},
@@ -1082,6 +2006,7 @@
 		this._mouseDestroy();
 
-		for ( var i = this.items.length - 1; i >= 0; i-- )
+		for ( var i = this.items.length - 1; i >= 0; i-- ) {
 			this.items[i].item.removeData(this.widgetName + "-item");
+		}
 
 		return this;
@@ -1100,5 +2025,7 @@
 
 	_mouseCapture: function(event, overrideHandle) {
-		var that = this;
+		var currentItem = null,
+			validHandle = false,
+			that = this;
 
 		if (this.reverting) {
@@ -1106,5 +2033,7 @@
 		}
 
-		if(this.options.disabled || this.options.type == 'static') return false;
+		if(this.options.disabled || this.options.type === "static") {
+			return false;
+		}
 
 		//We have to refresh the items data once first
@@ -1112,18 +2041,26 @@
 
 		//Find out if the clicked node (or one of its parents) is a actual item in this.items
-		var currentItem = null, nodes = $(event.target).parents().each(function() {
-			if($.data(this, that.widgetName + '-item') == that) {
+		$(event.target).parents().each(function() {
+			if($.data(this, that.widgetName + "-item") === that) {
 				currentItem = $(this);
 				return false;
 			}
 		});
-		if($.data(event.target, that.widgetName + '-item') == that) currentItem = $(event.target);
-
-		if(!currentItem) return false;
+		if($.data(event.target, that.widgetName + "-item") === that) {
+			currentItem = $(event.target);
+		}
+
+		if(!currentItem) {
+			return false;
+		}
 		if(this.options.handle && !overrideHandle) {
-			var validHandle = false;
-
-			$(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
-			if(!validHandle) return false;
+			$(this.options.handle, currentItem).find("*").addBack().each(function() {
+				if(this === event.target) {
+					validHandle = true;
+				}
+			});
+			if(!validHandle) {
+				return false;
+			}
 		}
 
@@ -1136,5 +2073,7 @@
 	_mouseStart: function(event, overrideHandle, noActivation) {
 
-		var o = this.options;
+		var i, body,
+			o = this.options;
+
 		this.currentContainer = this;
 
@@ -1185,5 +2124,5 @@
 		this.originalPageY = event.pageY;
 
-		//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
+		//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
 		(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
 
@@ -1192,5 +2131,5 @@
 
 		//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]) {
+		if(this.helper[0] !== this.currentItem[0]) {
 			this.currentItem.hide();
 		}
@@ -1200,25 +2139,36 @@
 
 		//Set a containment if given in the options
-		if(o.containment)
+		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.cursor && o.cursor !== "auto" ) { // cursor option
+			body = this.document.find( "body" );
+
+			// support: IE
+			this.storedCursor = body.css( "cursor" );
+			body.css( "cursor", o.cursor );
+
+			this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
 		}
 
 		if(o.opacity) { // opacity option
-			if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
+			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");
+			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')
+		if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") {
 			this.overflowOffset = this.scrollParent.offset();
+		}
 
 		//Call callbacks
@@ -1226,19 +2176,24 @@
 
 		//Recache the helper size
-		if(!this._preserveHelperProportions)
+		if(!this._preserveHelperProportions) {
 			this._cacheHelperProportions();
-
-
-		//Post 'activate' events to possible containers
-		if(!noActivation) {
-			 for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)); }
+		}
+
+
+		//Post "activate" events to possible containers
+		if( !noActivation ) {
+			for ( i = this.containers.length - 1; i >= 0; i-- ) {
+				this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
+			}
 		}
 
 		//Prepare possible droppables
-		if($.ui.ddmanager)
+		if($.ui.ddmanager) {
 			$.ui.ddmanager.current = this;
-
-		if ($.ui.ddmanager && !o.dropBehaviour)
+		}
+
+		if ($.ui.ddmanager && !o.dropBehaviour) {
 			$.ui.ddmanager.prepareOffsets(this, event);
+		}
 
 		this.dragging = true;
@@ -1251,4 +2206,7 @@
 
 	_mouseDrag: function(event) {
+		var i, item, itemElement, intersection,
+			o = this.options,
+			scrolled = false;
 
 		//Compute the helpers position
@@ -1262,33 +2220,37 @@
 		//Do scrolling
 		if(this.options.scroll) {
-			var o = this.options, scrolled = false;
-			if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
-
-				if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
+			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)
+				} 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)
+				}
+
+				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)
+				} 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)
+				if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
 					scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
-				else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
+				} else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
 					scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
-
-				if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
+				}
+
+				if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
 					scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
-				else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
+				} else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
 					scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
-
-			}
-
-			if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
+				}
+
+			}
+
+			if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
 				$.ui.ddmanager.prepareOffsets(this, event);
+			}
 		}
 
@@ -1297,13 +2259,21 @@
 
 		//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';
+		if(!this.options.axis || this.options.axis !== "y") {
+			this.helper[0].style.left = this.position.left+"px";
+		}
+		if(!this.options.axis || this.options.axis !== "x") {
+			this.helper[0].style.top = this.position.top+"px";
+		}
 
 		//Rearrange
-		for (var i = this.items.length - 1; i >= 0; i--) {
+		for (i = this.items.length - 1; i >= 0; i--) {
 
 			//Cache variables and intersection, continue if no intersection
-			var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
-			if (!intersection) continue;
+			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
@@ -1314,16 +2284,20 @@
 			// 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;
-
-			if (itemElement != this.currentItem[0] //cannot intersect with itself
-				&&	this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
-				&&	!$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
-				&& (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
-				//&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same 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 === 1 ? "next" : "prev"]()[0] !== itemElement &&
+				!$.contains(this.placeholder[0], itemElement) &&
+				(this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
 			) {
 
-				this.direction = intersection == 1 ? "down" : "up";
-
-				if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
+				this.direction = intersection === 1 ? "down" : "up";
+
+				if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
 					this._rearrange(event, item);
 				} else {
@@ -1340,8 +2314,10 @@
 
 		//Interconnect with droppables
-		if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
+		if($.ui.ddmanager) {
+			$.ui.ddmanager.drag(this, event);
+		}
 
 		//Call callbacks
-		this._trigger('sort', event, this._uiHash());
+		this._trigger("sort", event, this._uiHash());
 
 		this.lastPositionAbs = this.positionAbs;
@@ -1352,20 +2328,27 @@
 	_mouseStop: function(event, noPropagation) {
 
-		if(!event) return;
+		if(!event) {
+			return;
+		}
 
 		//If we are using droppables, inform the manager about the drop
-		if ($.ui.ddmanager && !this.options.dropBehaviour)
+		if ($.ui.ddmanager && !this.options.dropBehaviour) {
 			$.ui.ddmanager.drop(this, event);
+		}
 
 		if(this.options.revert) {
-			var that = this;
-			var cur = this.placeholder.offset();
-
+			var that = this,
+				cur = this.placeholder.offset(),
+				axis = this.options.axis,
+				animation = {};
+
+			if ( !axis || axis === "x" ) {
+				animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollLeft);
+			}
+			if ( !axis || axis === "y" ) {
+				animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollTop);
+			}
 			this.reverting = true;
-
-			$(this.helper).animate({
-				left: cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
-				top: cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
-			}, parseInt(this.options.revert, 10) || 500, function() {
+			$(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
 				that._clear(event);
 			});
@@ -1384,8 +2367,9 @@
 			this._mouseUp({ target: null });
 
-			if(this.options.helper == "original")
+			if(this.options.helper === "original") {
 				this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
-			else
+			} else {
 				this.currentItem.show();
+			}
 
 			//Post deactivating events to containers
@@ -1402,6 +2386,10 @@
 		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();
+			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, {
@@ -1425,17 +2413,20 @@
 	serialize: function(o) {
 
-		var items = this._getItemsAsjQuery(o && o.connected);
-		var str = []; o = o || {};
+		var items = this._getItemsAsjQuery(o && o.connected),
+			str = [];
+		o = o || {};
 
 		$(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]));
+			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('&');
+			str.push(o.key + "=");
+		}
+
+		return str.join("&");
 
 	},
@@ -1443,8 +2434,10 @@
 	toArray: function(o) {
 
-		var items = this._getItemsAsjQuery(o && o.connected);
-		var ret = []; o = o || {};
-
-		items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
+		var items = this._getItemsAsjQuery(o && o.connected),
+			ret = [];
+
+		o = o || {};
+
+		items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
 		return ret;
 
@@ -1457,27 +2450,26 @@
 			x2 = x1 + this.helperProportions.width,
 			y1 = this.positionAbs.top,
-			y2 = y1 + this.helperProportions.height;
-
-		var l = item.left,
+			y2 = y1 + this.helperProportions.height,
+			l = item.left,
 			r = l + item.width,
 			t = item.top,
-			b = t + item.height;
-
-		var dyClick = this.offset.click.top,
-			dxClick = this.offset.click.left;
-
-		var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (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'])
+			b = t + item.height,
+			dyClick = this.offset.click.top,
+			dxClick = this.offset.click.left,
+			isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
+			isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
+			isOverElement = isOverElementHeight && isOverElementWidth;
+
+		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 (l < x1 + (this.helperProportions.width / 2) // Right Half
-				&& x2 - (this.helperProportions.width / 2) < r // Left Half
-				&& t < y1 + (this.helperProportions.height / 2) // Bottom Half
-				&& y2 - (this.helperProportions.height / 2) < b ); // Top Half
+			return (l < x1 + (this.helperProportions.width / 2) && // Right Half
+				x2 - (this.helperProportions.width / 2) < r && // Left Half
+				t < y1 + (this.helperProportions.height / 2) && // Bottom Half
+				y2 - (this.helperProportions.height / 2) < b ); // Top Half
 
 		}
@@ -1486,16 +2478,17 @@
 	_intersectsWithPointer: function(item) {
 
-		var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
-			isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
+		var isOverElementHeight = (this.options.axis === "x") || isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
+			isOverElementWidth = (this.options.axis === "y") || isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
 			isOverElement = isOverElementHeight && isOverElementWidth,
 			verticalDirection = this._getDragVerticalDirection(),
 			horizontalDirection = this._getDragHorizontalDirection();
 
-		if (!isOverElement)
+		if (!isOverElement) {
 			return false;
+		}
 
 		return this.floating ?
-			( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
-			: ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
+			( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
+			: ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
 
 	},
@@ -1503,13 +2496,13 @@
 	_intersectsWithSides: function(item) {
 
-		var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
-			isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
+		var isOverBottomHalf = isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
+			isOverRightHalf = isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
 			verticalDirection = this._getDragVerticalDirection(),
 			horizontalDirection = this._getDragHorizontalDirection();
 
 		if (this.floating && horizontalDirection) {
-			return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
+			return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
 		} else {
-			return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
+			return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
 		}
 
@@ -1518,10 +2511,10 @@
 	_getDragVerticalDirection: function() {
 		var delta = this.positionAbs.top - this.lastPositionAbs.top;
-		return delta != 0 && (delta > 0 ? "down" : "up");
+		return delta !== 0 && (delta > 0 ? "down" : "up");
 	},
 
 	_getDragHorizontalDirection: function() {
 		var delta = this.positionAbs.left - this.lastPositionAbs.left;
-		return delta != 0 && (delta > 0 ? "right" : "left");
+		return delta !== 0 && (delta > 0 ? "right" : "left");
 	},
 
@@ -1534,34 +2527,33 @@
 	_connectWith: function() {
 		var options = this.options;
-		return options.connectWith.constructor == String
-			? [options.connectWith]
-			: options.connectWith;
+		return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
 	},
 
 	_getItemsAsjQuery: function(connected) {
 
-		var items = [];
-		var queries = [];
-		var connectWith = this._connectWith();
+		var i, j, cur, inst,
+			items = [],
+			queries = [],
+			connectWith = this._connectWith();
 
 		if(connectWith && connected) {
-			for (var i = connectWith.length - 1; i >= 0; i--){
-				var cur = $(connectWith[i]);
-				for (var j = cur.length - 1; j >= 0; j--){
-					var inst = $.data(cur[j], this.widgetName);
-					if(inst && inst != this && !inst.options.disabled) {
-						queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
+			for (i = connectWith.length - 1; i >= 0; i--){
+				cur = $(connectWith[i]);
+				for ( j = cur.length - 1; j >= 0; j--){
+					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.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
 					}
-				};
-			};
-		}
-
-		queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
-
-		for (var i = queries.length - 1; i >= 0; i--){
+				}
+			}
+		}
+
+		queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
+
+		for (i = queries.length - 1; i >= 0; i--){
 			queries[i][0].each(function() {
 				items.push(this);
 			});
-		};
+		}
 
 		return $(items);
@@ -1575,7 +2567,8 @@
 		this.items = $.grep(this.items, function (item) {
 			for (var j=0; j < list.length; j++) {
-				if(list[j] == item.item[0])
+				if(list[j] === item.item[0]) {
 					return false;
-			};
+				}
+			}
 			return true;
 		});
@@ -1587,29 +2580,31 @@
 		this.items = [];
 		this.containers = [this];
-		var items = this.items;
-		var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
-		var connectWith = this._connectWith();
+
+		var i, j, cur, inst, targetData, _queries, item, queriesLength,
+			items = this.items,
+			queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
+			connectWith = this._connectWith();
 
 		if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
-			for (var i = connectWith.length - 1; i >= 0; i--){
-				var cur = $(connectWith[i]);
-				for (var j = cur.length - 1; j >= 0; j--){
-					var inst = $.data(cur[j], this.widgetName);
-					if(inst && inst != this && !inst.options.disabled) {
+			for (i = connectWith.length - 1; i >= 0; i--){
+				cur = $(connectWith[i]);
+				for (j = cur.length - 1; j >= 0; j--){
+					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, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
 						this.containers.push(inst);
 					}
-				};
-			};
-		}
-
-		for (var i = queries.length - 1; i >= 0; i--) {
-			var targetData = queries[i][1];
-			var _queries = queries[i][0];
-
-			for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
-				var item = $(_queries[j]);
-
-				item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager)
+				}
+			}
+		}
+
+		for (i = queries.length - 1; i >= 0; i--) {
+			targetData = queries[i][1];
+			_queries = queries[i][0];
+
+			for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
+				item = $(_queries[j]);
+
+				item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
 
 				items.push({
@@ -1619,6 +2614,6 @@
 					left: 0, top: 0
 				});
-			};
-		};
+			}
+		}
 
 	},
@@ -1631,12 +2626,15 @@
 		}
 
-		for (var i = this.items.length - 1; i >= 0; i--){
-			var item = this.items[i];
+		var i, item, t, p;
+
+		for (i = this.items.length - 1; i >= 0; i--){
+			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])
+			if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
 				continue;
-
-			var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
+			}
+
+			t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
 
 			if (!fast) {
@@ -1645,19 +2643,19 @@
 			}
 
-			var p = t.offset();
+			p = t.offset();
 			item.left = p.left;
 			item.top = p.top;
-		};
+		}
 
 		if(this.options.custom && this.options.custom.refreshContainers) {
 			this.options.custom.refreshContainers.call(this);
 		} else {
-			for (var i = this.containers.length - 1; i >= 0; i--){
-				var p = this.containers[i].element.offset();
+			for (i = this.containers.length - 1; i >= 0; i--){
+				p = 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();
-			};
+			}
 		}
 
@@ -1667,19 +2665,32 @@
 	_createPlaceholder: function(that) {
 		that = that || this;
-		var o = that.options;
-
-		if(!o.placeholder || o.placeholder.constructor == String) {
-			var className = o.placeholder;
+		var className,
+			o = 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;
+					var nodeName = that.currentItem[0].nodeName.toLowerCase(),
+						element = $( "<" + nodeName + ">", that.document[0] )
+							.addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
+							.removeClass("ui-sortable-helper");
+
+					if ( nodeName === "tr" ) {
+						that.currentItem.children().each(function() {
+							$( "<td>&#160;</td>", that.document[0] )
+								.attr( "colspan", $( this ).attr( "colspan" ) || 1 )
+								.appendTo( element );
+						});
+					} else if ( nodeName === "img" ) {
+						element.attr( "src", that.currentItem.attr( "src" ) );
+					}
+
+					if ( !className ) {
+						element.css( "visibility", "hidden" );
+					}
+
+					return element;
 				},
 				update: function(container, p) {
@@ -1687,9 +2698,11 @@
 					// 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(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')||0, 10) - parseInt(that.currentItem.css('paddingBottom')||0, 10)); };
-					if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css('paddingLeft')||0, 10) - parseInt(that.currentItem.css('paddingRight')||0, 10)); };
+					if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
+					if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
 				}
 			};
@@ -1708,20 +2721,22 @@
 
 	_contactContainers: function(event) {
+		var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, base, cur, nearBottom, floating,
+			innermostContainer = null,
+			innermostIndex = null;
 
 		// get innermost container that intersects with item
-		var innermostContainer = null, innermostIndex = null;
-
-
-		for (var i = this.containers.length - 1; i >= 0; i--){
+		for (i = this.containers.length - 1; i >= 0; i--) {
 
 			// never consider a container that's located within the item itself
-			if($.contains(this.currentItem[0], this.containers[i].element[0]))
+			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]))
+				if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
 					continue;
+				}
 
 				innermostContainer = this.containers[i];
@@ -1739,22 +2754,35 @@
 
 		// if no intersecting containers found, return
-		if(!innermostContainer) 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", event, this._uiHash(this));
-			this.containers[innermostIndex].containerCache.over = 1;
+			if (!this.containers[innermostIndex].containerCache.over) {
+				this.containers[innermostIndex]._trigger("over", event, this._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
-			var dist = 10000; var itemWithLeastDistance = null;
-			var posProperty = this.containers[innermostIndex].floating ? 'left' : 'top';
-			var sizeProperty = this.containers[innermostIndex].floating ? 'width' : 'height';
-			var base = this.positionAbs[posProperty] + this.offset.click[posProperty];
-			for (var j = this.items.length - 1; j >= 0; j--) {
-				if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
-				if(this.items[j].item[0] == this.currentItem[0]) continue;
-				var cur = this.items[j].item.offset()[posProperty];
-				var nearBottom = false;
+			dist = 10000;
+			itemWithLeastDistance = null;
+			floating = innermostContainer.floating || isFloating(this.currentItem);
+			posProperty = floating ? "left" : "top";
+			sizeProperty = floating ? "width" : "height";
+			base = this.positionAbs[posProperty] + this.offset.click[posProperty];
+			for (j = this.items.length - 1; j >= 0; j--) {
+				if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
+					continue;
+				}
+				if(this.items[j].item[0] === this.currentItem[0]) {
+					continue;
+				}
+				if (floating && !isOverAxis(this.positionAbs.top + this.offset.click.top, this.items[j].top, this.items[j].height)) {
+					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;
@@ -1768,11 +2796,17 @@
 			}
 
-			if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
+			//Check if dropOnEmpty is enabled
+			if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
 				return;
-
-			this.currentContainer = this.containers[innermostIndex];
+			}
+
+			if(this.currentContainer === this.containers[innermostIndex]) {
+				return;
+			}
+
 			itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
 			this._trigger("change", event, this._uiHash());
 			this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
+			this.currentContainer = this.containers[innermostIndex];
 
 			//Update the placeholder
@@ -1788,15 +2822,22 @@
 	_createHelper: function(event) {
 
-		var o = this.options;
-		var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
-
-		if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
-			$(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
-
-		if(helper[0] == this.currentItem[0])
+		var o = this.options,
+			helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.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 = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
-
-		if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
-		if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
+		}
+
+		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;
@@ -1805,20 +2846,20 @@
 
 	_adjustOffsetFromHelper: function(obj) {
-		if (typeof obj == 'string') {
-			obj = obj.split(' ');
+		if (typeof obj === "string") {
+			obj = obj.split(" ");
 		}
 		if ($.isArray(obj)) {
 			obj = {left: +obj[0], top: +obj[1] || 0};
 		}
-		if ('left' in obj) {
+		if ("left" in obj) {
 			this.offset.click.left = obj.left + this.margins.left;
 		}
-		if ('right' in obj) {
+		if ("right" in obj) {
 			this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
 		}
-		if ('top' in obj) {
+		if ("top" in obj) {
 			this.offset.click.top = obj.top + this.margins.top;
 		}
-		if ('bottom' in obj) {
+		if ("bottom" in obj) {
 			this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
 		}
@@ -1836,12 +2877,14 @@
 		// 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])) {
+		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();
 		}
 
-		if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
-		|| (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix
+		// 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 = { top: 0, left: 0 };
+		}
 
 		return {
@@ -1854,5 +2897,5 @@
 	_getRelativeOffset: function() {
 
-		if(this.cssPosition == "relative") {
+		if(this.cssPosition === "relative") {
 			var p = this.currentItem.position();
 			return {
@@ -1882,17 +2925,22 @@
 	_setContainment: function() {
 
-		var o = this.options;
-		if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
-		if(o.containment == 'document' || o.containment == 'window') this.containment = [
-			0 - this.offset.relative.left - this.offset.parent.left,
-			0 - 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
-		];
+		var ce, co, over,
+			o = this.options;
+		if(o.containment === "parent") {
+			o.containment = this.helper[0].parentNode;
+		}
+		if(o.containment === "document" || o.containment === "window") {
+			this.containment = [
+				0 - this.offset.relative.left - this.offset.parent.left,
+				0 - 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)) {
-			var ce = $(o.containment)[0];
-			var co = $(o.containment).offset();
-			var over = ($(ce).css("overflow") != 'hidden');
+			ce = $(o.containment)[0];
+			co = $(o.containment).offset();
+			over = ($(ce).css("overflow") !== "hidden");
 
 			this.containment = [
@@ -1908,20 +2956,23 @@
 	_convertPositionTo: function(d, pos) {
 
-		if(!pos) pos = this.position;
-		var mod = d == "absolute" ? 1 : -1;
-		var o = 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);
+		if(!pos) {
+			pos = this.position;
+		}
+		var mod = d === "absolute" ? 1 : -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 ? 0 : scroll.scrollTop() ) ) * mod)
+				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 ? 0 : 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 ? 0 : scroll.scrollLeft() ) * mod)
+				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 ? 0 : scroll.scrollLeft() ) * mod)
 			)
 		};
@@ -1931,5 +2982,9 @@
 	_generatePosition: function(event) {
 
-		var o = 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);
+		var top, left,
+			o = 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.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
 
 		// This is another very weird special case that only happens for relative elements:
@@ -1937,10 +2992,7 @@
 		// 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])) {
+		if(this.cssPosition === "relative" && !(this.scrollParent[0] !== document && this.scrollParent[0] !== this.offsetParent[0])) {
 			this.offset.relative = this._getRelativeOffset();
 		}
-
-		var pageX = event.pageX;
-		var pageY = event.pageY;
 
 		/*
@@ -1952,16 +3004,24 @@
 
 			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(event.pageX - this.offset.click.left < this.containment[0]) {
+					pageX = this.containment[0] + this.offset.click.left;
+				}
+				if(event.pageY - this.offset.click.top < this.containment[1]) {
+					pageY = this.containment[1] + this.offset.click.top;
+				}
+				if(event.pageX - this.offset.click.left > this.containment[2]) {
+					pageX = this.containment[2] + this.offset.click.left;
+				}
+				if(event.pageY - this.offset.click.top > this.containment[3]) {
+					pageY = this.containment[3] + this.offset.click.top;
+				}
 			}
 
 			if(o.grid) {
-				var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
-				pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
-
-				var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
-				pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+				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;
 			}
 
@@ -1970,16 +3030,16 @@
 		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 ? 0 : scroll.scrollTop() ) ))
+				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 ? 0 : 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 ? 0 : scroll.scrollLeft() ))
+				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 ? 0 : scroll.scrollLeft() ))
 			)
 		};
@@ -1989,5 +3049,5 @@
 	_rearrange: function(event, i, a, hardRefresh) {
 
-		a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));
+		a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
 
 		//Various things done here to improve the performance:
@@ -2000,5 +3060,7 @@
 
 		this._delay(function() {
-			if(counter == this.counter) this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
+			if(counter === this.counter) {
+				this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
+			}
 		});
 
@@ -2010,14 +3072,19 @@
 		// 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 delayedTriggers = [];
+		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);
+		if(!this._noFinalSort && this.currentItem.parent().length) {
+			this.placeholder.before(this.currentItem);
+		}
 		this._noFinalSort = null;
 
-		if(this.helper[0] == this.currentItem[0]) {
-			for(var i in this._storedCSS) {
-				if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
+		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");
@@ -2026,6 +3093,10 @@
 		}
 
-		if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._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", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
+		if(this.fromOutside && !noPropagation) {
+			delayedTriggers.push(function(event) { this._trigger("receive", event, this._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", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
+		}
 
 		// Check if the items Container has Changed and trigger appropriate
@@ -2041,6 +3112,8 @@
 
 		//Post events to containers
-		for (var i = this.containers.length - 1; i >= 0; i--){
-			if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); };  }).call(this, this.containers[i]));
+		for (i = this.containers.length - 1; i >= 0; i--){
+			if(!noPropagation) {
+				delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); };  }).call(this, this.containers[i]));
+			}
 			if(this.containers[i].containerCache.over) {
 				delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); };  }).call(this, this.containers[i]));
@@ -2050,7 +3123,14 @@
 
 		//Do what was originally in plugins
-		if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
-		if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity
-		if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
+		if ( this.storedCursor ) {
+			this.document.find( "body" ).css( "cursor", this.storedCursor );
+			this.storedStylesheet.remove();
+		}
+		if(this._storedOpacity) {
+			this.helper.css("opacity", this._storedOpacity);
+		}
+		if(this._storedZIndex) {
+			this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
+		}
 
 		this.dragging = false;
@@ -2058,5 +3138,7 @@
 			if(!noPropagation) {
 				this._trigger("beforeStop", event, this._uiHash());
-				for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
+				for (i=0; i < delayedTriggers.length; i++) {
+					delayedTriggers[i].call(this, event);
+				} //Trigger all delayed events
 				this._trigger("stop", event, this._uiHash());
 			}
@@ -2066,13 +3148,20 @@
 		}
 
-		if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());
+		if(!noPropagation) {
+			this._trigger("beforeStop", event, this._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(this.helper[0] !== this.currentItem[0]) {
+			this.helper.remove();
+		}
+		this.helper = null;
 
 		if(!noPropagation) {
-			for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
+			for (i=0; i < delayedTriggers.length; i++) {
+				delayedTriggers[i].call(this, event);
+			} //Trigger all delayed events
 			this._trigger("stop", event, this._uiHash());
 		}
@@ -2117,5 +3206,5 @@
 
 $.widget( "ui.accordion", {
-	version: "1.9.2",
+	version: "1.10.3",
 	options: {
 		active: 0,
@@ -2136,19 +3225,9 @@
 
 	_create: function() {
-		var accordionId = this.accordionId = "ui-accordion-" +
-				(this.element.attr( "id" ) || ++uid),
-			options = this.options;
-
+		var options = this.options;
 		this.prevShow = this.prevHide = $();
-		this.element.addClass( "ui-accordion ui-widget ui-helper-reset" );
-
-		this.headers = this.element.find( options.header )
-			.addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" );
-		this._hoverable( this.headers );
-		this._focusable( this.headers );
-
-		this.headers.next()
-			.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
-			.hide();
+		this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
+			// ARIA
+			.attr( "role", "tablist" );
 
 		// don't allow collapsible: false and active: false / null
@@ -2156,73 +3235,11 @@
 			options.active = 0;
 		}
+
+		this._processPanels();
 		// handle negative values
 		if ( options.active < 0 ) {
 			options.active += this.headers.length;
 		}
-		this.active = this._findActive( options.active )
-			.addClass( "ui-accordion-header-active ui-state-active" )
-			.toggleClass( "ui-corner-all ui-corner-top" );
-		this.active.next()
-			.addClass( "ui-accordion-content-active" )
-			.show();
-
-		this._createIcons();
-		this.refresh();
-
-		// ARIA
-		this.element.attr( "role", "tablist" );
-
-		this.headers
-			.attr( "role", "tab" )
-			.each(function( i ) {
-				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
-			.not( this.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( 0 ).attr( "tabIndex", 0 );
-		} else {
-			this.active.attr({
-				"aria-selected": "true",
-				tabIndex: 0
-			})
-			.next()
-				.attr({
-					"aria-expanded": "true",
-					"aria-hidden": "false"
-				});
-		}
-
-		this._on( this.headers, { keydown: "_keydown" });
-		this._on( this.headers.next(), { keydown: "_panelKeyDown" });
-		this._setupEvents( options.event );
+		this._refresh();
 	},
 
@@ -2230,4 +3247,5 @@
 		return {
 			header: this.active,
+			panel: !this.active.length ? $() : this.active.next(),
 			content: !this.active.length ? $() : this.active.next()
 		};
@@ -2331,4 +3349,5 @@
 
 	_keydown: function( event ) {
+		/*jshint maxcomplexity:15*/
 		if ( event.altKey || event.ctrlKey ) {
 			return;
@@ -2376,18 +3395,114 @@
 
 	refresh: function() {
-		var maxHeight, overflow,
-			heightStyle = this.options.heightStyle,
-			parent = this.element.parent();
-
+		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
+		} else if ( options.active === false ) {
+			this._activate( 0 );
+		// was active, but active panel is gone
+		} else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
+			// 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._activate( Math.max( 0, options.active - 1 ) );
+			}
+		// was active, active panel still exists
+		} else {
+			// make sure active index is correct
+			options.active = this.headers.index( this.active );
+		}
+
+		this._destroyIcons();
+
+		this._refresh();
+	},
+
+	_processPanels: function() {
+		this.headers = this.element.find( this.options.header )
+			.addClass( "ui-accordion-header ui-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._findActive( options.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( i ) {
+				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
+			.not( this.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( 0 ).attr( "tabIndex", 0 );
+		} else {
+			this.active.attr({
+				"aria-selected": "true",
+				tabIndex: 0
+			})
+			.next()
+				.attr({
+					"aria-expanded": "true",
+					"aria-hidden": "false"
+				});
+		}
+
+		this._createIcons();
+
+		this._setupEvents( options.event );
 
 		if ( heightStyle === "fill" ) {
-			// IE 6 treats height like minHeight, so we need to turn off overflow
-			// in order to get a reliable height
-			// we use the minHeight support test because we assume that only
-			// browsers that don't support minHeight will treat height as minHeight
-			if ( !$.support.minHeight ) {
-				overflow = parent.css( "overflow" );
-				parent.css( "overflow", "hidden");
-			}
 			maxHeight = parent.height();
 			this.element.siblings( ":visible" ).each(function() {
@@ -2400,7 +3515,4 @@
 				maxHeight -= elem.outerHeight( true );
 			});
-			if ( overflow ) {
-				parent.css( "overflow", overflow );
-			}
 
 			this.headers.each(function() {
@@ -2447,12 +3559,18 @@
 
 	_setupEvents: function( event ) {
-		var events = {};
-		if ( !event ) {
-			return;
-		}
-		$.each( event.split(" "), function( index, eventName ) {
-			events[ eventName ] = "_eventHandler";
-		});
+		var events = {
+			keydown: "_keydown"
+		};
+		if ( event ) {
+			$.each( event.split(" "), function( index, eventName ) {
+				events[ eventName ] = "_eventHandler";
+			});
+		}
+
+		this._off( this.headers.add( this.headers.next() ) );
 		this._on( this.headers, events );
+		this._on( this.headers.next(), { keydown: "_panelKeyDown" });
+		this._hoverable( this.headers );
+		this._focusable( this.headers );
 	},
 
@@ -2633,191 +3751,3 @@
 });
 
-
-
-// DEPRECATED
-if ( $.uiBackCompat !== false ) {
-	// navigation options
-	(function( $, prototype ) {
-		$.extend( prototype.options, {
-			navigation: false,
-			navigationFilter: function() {
-				return this.href.toLowerCase() === location.href.toLowerCase();
-			}
-		});
-
-		var _create = prototype._create;
-		prototype._create = function() {
-			if ( this.options.navigation ) {
-				var that = this,
-					headers = this.element.find( this.options.header ),
-					content = headers.next(),
-					current = headers.add( content )
-						.find( "a" )
-						.filter( this.options.navigationFilter )
-						[ 0 ];
-				if ( current ) {
-					headers.add( content ).each( function( index ) {
-						if ( $.contains( this, current ) ) {
-							that.options.active = Math.floor( index / 2 );
-							return false;
-						}
-					});
-				}
-			}
-			_create.call( this );
-		};
-	}( jQuery, jQuery.ui.accordion.prototype ) );
-
-	// height options
-	(function( $, prototype ) {
-		$.extend( prototype.options, {
-			heightStyle: null, // remove default so we fall back to old values
-			autoHeight: true, // use heightStyle: "auto"
-			clearStyle: false, // use heightStyle: "content"
-			fillSpace: false // use heightStyle: "fill"
-		});
-
-		var _create = prototype._create,
-			_setOption = prototype._setOption;
-
-		$.extend( prototype, {
-			_create: function() {
-				this.options.heightStyle = this.options.heightStyle ||
-					this._mergeHeightStyle();
-
-				_create.call( this );
-			},
-
-			_setOption: function( key ) {
-				if ( key === "autoHeight" || key === "clearStyle" || key === "fillSpace" ) {
-					this.options.heightStyle = this._mergeHeightStyle();
-				}
-				_setOption.apply( this, arguments );
-			},
-
-			_mergeHeightStyle: function() {
-				var options = this.options;
-
-				if ( options.fillSpace ) {
-					return "fill";
-				}
-
-				if ( options.clearStyle ) {
-					return "content";
-				}
-
-				if ( options.autoHeight ) {
-					return "auto";
-				}
-			}
-		});
-	}( jQuery, jQuery.ui.accordion.prototype ) );
-
-	// icon options
-	(function( $, prototype ) {
-		$.extend( prototype.options.icons, {
-			activeHeader: null, // remove default so we fall back to old values
-			headerSelected: "ui-icon-triangle-1-s"
-		});
-
-		var _createIcons = prototype._createIcons;
-		prototype._createIcons = function() {
-			if ( this.options.icons ) {
-				this.options.icons.activeHeader = this.options.icons.activeHeader ||
-					this.options.icons.headerSelected;
-			}
-			_createIcons.call( this );
-		};
-	}( jQuery, jQuery.ui.accordion.prototype ) );
-
-	// expanded active option, activate method
-	(function( $, prototype ) {
-		prototype.activate = prototype._activate;
-
-		var _findActive = prototype._findActive;
-		prototype._findActive = function( index ) {
-			if ( index === -1 ) {
-				index = false;
-			}
-			if ( index && typeof index !== "number" ) {
-				index = this.headers.index( this.headers.filter( index ) );
-				if ( index === -1 ) {
-					index = false;
-				}
-			}
-			return _findActive.call( this, index );
-		};
-	}( jQuery, jQuery.ui.accordion.prototype ) );
-
-	// resize method
-	jQuery.ui.accordion.prototype.resize = jQuery.ui.accordion.prototype.refresh;
-
-	// change events
-	(function( $, prototype ) {
-		$.extend( prototype.options, {
-			change: null,
-			changestart: null
-		});
-
-		var _trigger = prototype._trigger;
-		prototype._trigger = function( type, event, data ) {
-			var ret = _trigger.apply( this, arguments );
-			if ( !ret ) {
-				return false;
-			}
-
-			if ( type === "beforeActivate" ) {
-				ret = _trigger.call( this, "changestart", event, {
-					oldHeader: data.oldHeader,
-					oldContent: data.oldPanel,
-					newHeader: data.newHeader,
-					newContent: data.newPanel
-				});
-			} else if ( type === "activate" ) {
-				ret = _trigger.call( this, "change", event, {
-					oldHeader: data.oldHeader,
-					oldContent: data.oldPanel,
-					newHeader: data.newHeader,
-					newContent: data.newPanel
-				});
-			}
-			return ret;
-		};
-	}( jQuery, jQuery.ui.accordion.prototype ) );
-
-	// animated option
-	// NOTE: this only provides support for "slide", "bounceslide", and easings
-	// not the full $.ui.accordion.animations API
-	(function( $, prototype ) {
-		$.extend( prototype.options, {
-			animate: null,
-			animated: "slide"
-		});
-
-		var _create = prototype._create;
-		prototype._create = function() {
-			var options = this.options;
-			if ( options.animate === null ) {
-				if ( !options.animated ) {
-					options.animate = false;
-				} else if ( options.animated === "slide" ) {
-					options.animate = 300;
-				} else if ( options.animated === "bounceslide" ) {
-					options.animate = {
-						duration: 200,
-						down: {
-							easing: "easeOutBounce",
-							duration: 1000
-						}
-					};
-				} else {
-					options.animate = options.animated;
-				}
-			}
-
-			_create.call( this );
-		};
-	}( jQuery, jQuery.ui.accordion.prototype ) );
-}
-
 })( jQuery );
Index: dmin/js/tool-man/cookies.js
===================================================================
--- admin/js/tool-man/cookies.js	(revision 0)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/* Copyright (c) 2005 Tim Taylor Consulting (see LICENSE.txt)
-
-based on http://www.quirksmode.org/js/cookies.html
-*/
-
-ToolMan._cookieOven = {
-	
-	set : function(name, value, expirationInDays) {
-		if (expirationInDays) {
-			var date = new Date()
-			date.setTime(date.getTime() + (expirationInDays * 24 * 60 * 60 * 1000))
-			var expires = "; expires=" + date.toGMTString()
-		} else {
-			var expires = ""
-		}
-		document.cookie = name + "=" + value + expires + "; path=/"
-	},
-	
-	get : function(name) {
-		var namePattern = name + "="
-		var cookies = document.cookie.split(';')
-		for(var i = 0, n = cookies.length; i < n; i++) {
-			var c = cookies[i]
-			while (c.charAt(0) == ' ') c = c.substring(1, c.length)
-			if (c.indexOf(namePattern) == 0)
-				return c.substring(namePattern.length, c.length)
-		}
-		return null
-	},
-	
-	eraseCookie : function(name) {
-		createCookie(name, "", -1)
-	}
-};
Index: dmin/js/tool-man/coordinates.js
===================================================================
--- admin/js/tool-man/coordinates.js	(revision 0)
+++ 	(revision )
@@ -1,154 +1,0 @@
-/* Copyright (c) 2005 Tim Taylor Consulting (see LICENSE.txt) */
-
-/* FIXME: assumes position styles are specified in 'px' */
-
-ToolMan._coordinatesFactory = {
-	
-	create : function(x, y) {
-		// FIXME: Safari won't parse 'throw' and aborts trying to do anything with this file
-		//if (isNaN(x) || isNaN(y)) throw "invalid x,y: " + x + "," + y
-		return new _ToolManCoordinate(this, x, y)
-	},
-	
-	origin : function() {
-		return this.create(0, 0)
-	},
-	
-	/*
-	 * FIXME: Safari 1.2, returns (0,0) on absolutely positioned elements
-	 */
-	topLeftPosition : function(element) {
-		var left = parseInt(ToolMan.css().readStyle(element, "left"))
-		var left = isNaN(left) ? 0 : left
-		var top = parseInt(ToolMan.css().readStyle(element, "top"))
-		var top = isNaN(top) ? 0 : top
-		
-		return this.create(left, top)
-	},
-	
-	bottomRightPosition : function(element) {
-		return this.topLeftPosition(element).plus(this._size(element))
-	},
-	
-	topLeftOffset : function(element) {
-		var offset = this._offset(element) 
-		
-		var parent = element.offsetParent
-		while (parent) {
-			offset = offset.plus(this._offset(parent))
-			parent = parent.offsetParent
-		}
-		return offset
-	},
-	
-	bottomRightOffset : function(element) {
-		return this.topLeftOffset(element).plus(
-				this.create(element.offsetWidth, element.offsetHeight))
-	},
-	
-	scrollOffset : function() {
-		if (window.pageXOffset) {
-			return this.create(window.pageXOffset, window.pageYOffset)
-		} else if (document.documentElement) {
-			return this.create(
-					document.body.scrollLeft + document.documentElement.scrollLeft, 
-					document.body.scrollTop + document.documentElement.scrollTop)
-		} else if (document.body.scrollLeft >= 0) {
-			return this.create(document.body.scrollLeft, document.body.scrollTop)
-		} else {
-			return this.create(0, 0)
-		}
-	},
-	
-	clientSize : function() {
-		if (window.innerHeight >= 0) {
-			return this.create(window.innerWidth, window.innerHeight)
-		} else if (document.documentElement) {
-			return this.create(document.documentElement.clientWidth,
-					document.documentElement.clientHeight)
-		} else if (document.body.clientHeight >= 0) {
-			return this.create(document.body.clientWidth,
-					document.body.clientHeight)
-		} else {
-			return this.create(0, 0)
-		}
-	},
-	
-	/**
-	 * mouse coordinate relative to the window (technically the
-	 * browser client area) i.e. the part showing your page
-	 *
-	 * NOTE: in Safari the coordinate is relative to the document
-	 */
-	mousePosition : function(event) {
-		event = ToolMan.events().fix(event)
-		return this.create(event.clientX, event.clientY)
-	},
-	
-	/**
-	 * mouse coordinate relative to the document
-	 */
-	mouseOffset : function(event) {
-		event = ToolMan.events().fix(event)
-		if (event.pageX >= 0 || event.pageX < 0) {
-			return this.create(event.pageX, event.pageY)
-		} else if (event.clientX >= 0 || event.clientX < 0) {
-			return this.mousePosition(event).plus(this.scrollOffset())
-		}
-	},
-	
-	_size : function(element) {
-	/* TODO: move to a Dimension class */
-		return this.create(element.offsetWidth, element.offsetHeight)
-	},
-	
-	_offset : function(element) {
-		return this.create(element.offsetLeft, element.offsetTop)
-	}
-}
-
-function _ToolManCoordinate(factory, x, y) {
-	this.factory = factory
-	this.x = isNaN(x) ? 0 : x
-	this.y = isNaN(y) ? 0 : y
-}
-
-_ToolManCoordinate.prototype = {
-	toString : function() {
-		return "(" + this.x + "," + this.y + ")"
-	},
-	
-	plus : function(that) {
-		return this.factory.create(this.x + that.x, this.y + that.y)
-	},
-	
-	minus : function(that) {
-		return this.factory.create(this.x - that.x, this.y - that.y)
-	},
-	
-	min : function(that) {
-		return this.factory.create(
-				Math.min(this.x , that.x), Math.min(this.y , that.y))
-	},
-	
-	max : function(that) {
-		return this.factory.create(
-				Math.max(this.x , that.x), Math.max(this.y , that.y))
-	},
-	
-	constrainTo : function (one, two) {
-		var min = one.min(two)
-		var max = one.max(two)
-		
-		return this.max(min).min(max)
-	},
-	
-	distance : function (that) {
-		return Math.sqrt(Math.pow(this.x - that.x, 2) + Math.pow(this.y - that.y, 2))
-	},
-	
-	reposition : function(element) {
-		element.style["top"] = this.y + "px"
-		element.style["left"] = this.x + "px"
-	}
-}
Index: dmin/js/tool-man/core.js
===================================================================
--- admin/js/tool-man/core.js	(revision 0)
+++ 	(revision )
@@ -1,170 +1,0 @@
-/*
-Copyright (c) 2005 Tim Taylor Consulting <http://tool-man.org/>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-IN THE SOFTWARE.
-*/
-
-var ToolMan = {
-	events : function() {
-		if (!ToolMan._eventsFactory) throw "ToolMan Events module isn't loaded";
-		return ToolMan._eventsFactory
-	},
-	
-	css : function() {
-		if (!ToolMan._cssFactory) throw "ToolMan CSS module isn't loaded";
-		return ToolMan._cssFactory
-	},
-	
-	coordinates : function() {
-		if (!ToolMan._coordinatesFactory) throw "ToolMan Coordinates module isn't loaded";
-		return ToolMan._coordinatesFactory
-	},
-	
-	drag : function() {
-		if (!ToolMan._dragFactory) throw "ToolMan Drag module isn't loaded";
-		return ToolMan._dragFactory
-	},
-	
-	dragsort : function() {
-		if (!ToolMan._dragsortFactory) throw "ToolMan DragSort module isn't loaded";
-		return ToolMan._dragsortFactory
-	},
-	
-	helpers : function() {
-		return ToolMan._helpers
-	},
-	
-	cookies : function() {
-		if (!ToolMan._cookieOven) throw "ToolMan Cookie module isn't loaded";
-		return ToolMan._cookieOven
-	},
-	
-	junkdrawer : function() {
-		return ToolMan._junkdrawer
-	}
-	
-}
-
-ToolMan._helpers = {
-	map : function(array, func) {
-		for (var i = 0, n = array.length; i < n; i++) func(array[i])
-	},
-	
-	nextItem : function(item, nodeName) {
-		if (item == null) return false;
-		var next = item.nextSibling
-		while (next != null) {
-			if (next.nodeName == nodeName) return next
-			next = next.nextSibling
-		}
-		return null
-	},
-	
-	previousItem : function(item, nodeName) {
-		var previous = item.previousSibling
-		while (previous != null) {
-			if (previous.nodeName == nodeName) return previous
-			previous = previous.previousSibling
-		}
-		return null
-	},
-	
-	moveBefore : function(item1, item2) {
-		var parent = item1.parentNode
-		parent.removeChild(item1)
-		parent.insertBefore(item1, item2)
-	},
-	
-	moveAfter : function(item1, item2) {
-		var parent = item1.parentNode
-		parent.removeChild(item1)
-		parent.insertBefore(item1, item2 ? item2.nextSibling : null)
-	}
-}
-
-/** 
- * scripts without a proper home
- *
- * stuff here is subject to change unapologetically and without warning
- */
-ToolMan._junkdrawer = {
-	serializeList : function(list) {
-		var items = list.getElementsByTagName("li")
-		var array = new Array()
-		for (var i = 0, n = items.length; i < n; i++) {
-			var item = items[i]
-			
-			array.push(ToolMan.junkdrawer()._identifier(item))
-		}
-		return array.join('|')
-	},
-	
-	inspectListOrder : function(id) {
-		alert(ToolMan.junkdrawer().serializeList(document.getElementById(id)))
-	},
-	
-	restoreListOrder : function(listID) {
-		var list = document.getElementById(listID)
-		if (list == null) return
-		
-		var cookie = ToolMan.cookies().get("list-" + listID)
-		if (!cookie) return;
-		
-		var IDs = cookie.split('|')
-		var items = ToolMan.junkdrawer()._itemsByID(list)
-		
-		for (var i = 0, n = IDs.length; i < n; i++) {
-			var itemID = IDs[i]
-			if (itemID in items) {
-				var item = items[itemID]
-				list.removeChild(item)
-				list.insertBefore(item, null)
-			}
-		}
-	},
-	
-	_identifier : function(item) {
-		var trim = ToolMan.junkdrawer().trim
-		var identifier
-		
-		identifier = trim(item.getAttribute("id"))
-		if (identifier != null && identifier.length > 0) return identifier;
-		
-		identifier = trim(item.getAttribute("itemID"))
-		if (identifier != null && identifier.length > 0) return identifier;
-		
-		// FIXME: strip out special chars or make this an MD5 hash or something
-		return trim(item.innerHTML)
-	},
-	
-	_itemsByID : function(list) {
-		var array = new Array()
-		var items = list.getElementsByTagName('li')
-		for (var i = 0, n = items.length; i < n; i++) {
-			var item = items[i]
-			array[ToolMan.junkdrawer()._identifier(item)] = item
-		}
-		return array
-	},
-	
-	trim : function(text) {
-		if (text == null) return null
-		return text.replace(/^(\s+)?(.*\S)(\s+)?$/, '$2')
-	}
-}
Index: dmin/js/tool-man/css.js
===================================================================
--- admin/js/tool-man/css.js	(revision 0)
+++ 	(revision )
@@ -1,17 +1,0 @@
-/* Copyright (c) 2005 Tim Taylor Consulting (see LICENSE.txt) */
-
-// TODO: write unit tests
-ToolMan._cssFactory = {
-	readStyle : function(element, property) {
-		if (element.style[property]) {
-			return element.style[property]
-		} else if (element.currentStyle) {
-			return element.currentStyle[property]
-		} else if (document.defaultView && document.defaultView.getComputedStyle) {
-			var style = document.defaultView.getComputedStyle(element, null)
-			return style.getPropertyValue(property)
-		} else {
-			return null
-		}
-	}
-}
Index: dmin/js/tool-man/drag.js
===================================================================
--- admin/js/tool-man/drag.js	(revision 0)
+++ 	(revision )
@@ -1,249 +1,0 @@
-/* Copyright (c) 2005 Tim Taylor Consulting (see LICENSE.txt) */
-
-ToolMan._dragFactory = {
-	createSimpleGroup : function(element, handle) {
-		handle = handle ? handle : element
-		var group = this.createGroup(element)
-		group.setHandle(handle)
-		//group.transparentDrag()
-		group.onTopWhileDragging()
-		return group
-	},
-	
-	createGroup : function(element) {
-		var group = new _ToolManDragGroup(this, element)
-		
-		var position = ToolMan.css().readStyle(element, 'position')
-		if (position == 'static') {
-			element.style["position"] = 'relative'
-		} else if (position == 'absolute') {
-			/* for Safari 1.2 */
-			ToolMan.coordinates().topLeftOffset(element).reposition(element)
-		}
-		
-		// TODO: only if ToolMan.isDebugging()
-		group.register('draginit', this._showDragEventStatus)
-		group.register('dragmove', this._showDragEventStatus)
-		group.register('dragend', this._showDragEventStatus)
-		
-		return group
-	},
-	
-	_showDragEventStatus : function(dragEvent) {
-		window.status = dragEvent.toString()
-	},
-	
-	constraints : function() {
-		return this._constraintFactory
-	},
-	
-	_createEvent : function(type, event, group) {
-		return new _ToolManDragEvent(type, event, group)
-	}
-}
-
-function _ToolManDragGroup(factory, element) {
-	this.factory = factory
-	this.element = element
-	this._handle = null
-	this._thresholdDistance = 0
-	this._transforms = new Array()
-	// TODO: refactor into a helper object, move into events.js
-	this._listeners = new Array()
-	this._listeners['draginit'] = new Array()
-	this._listeners['dragstart'] = new Array()
-	this._listeners['dragmove'] = new Array()
-	this._listeners['dragend'] = new Array()
-}
-
-_ToolManDragGroup.prototype = {
-	/*
-	 * TODO:
-	 *   - unregister(type, func)
-	 *   - move custom event listener stuff into Event library
-	 *   - keyboard nudging of "selected" group
-	 */
-	
-	setHandle : function(handle) {
-		var events = ToolMan.events()
-		
-		handle.toolManDragGroup = this
-		events.register(handle, 'mousedown', this._dragInit)
-		//handle.onmousedown = function() { return false }
-		
-		if (this.element != handle)
-			events.unregister(this.element, 'mousedown', this._dragInit)
-	},
-	
-	register : function(type, func) {
-		this._listeners[type].push(func)
-	},
-	
-	addTransform : function(transformFunc) {
-		this._transforms.push(transformFunc)
-	},
-	
-	verticalOnly : function() {
-		this.addTransform(this.factory.constraints().vertical())
-	},
-	
-	horizontalOnly : function() {
-		this.addTransform(this.factory.constraints().horizontal())
-	},
-	
-	setThreshold : function(thresholdDistance) {
-		this._thresholdDistance = thresholdDistance
-	},
-	
-	transparentDrag : function(opacity) {
-		if (typeof(opacity) == "undefined") {
-			opacity = 0.75;
-		}
-		var originalOpacity = ToolMan.css().readStyle(this.element, "opacity")
-		
-		this.register('dragstart', function(dragEvent) {
-			var element = dragEvent.group.element
-			element.style.opacity = opacity
-			element.style.filter = 'alpha(opacity=' + (opacity * 100) + ')'
-		})
-		this.register('dragend', function(dragEvent) {
-			var element = dragEvent.group.element
-			element.style.opacity = originalOpacity
-			element.style.filter = 'alpha(opacity=100)'
-		})
-	},
-	
-	onTopWhileDragging : function(zIndex) {
-		if (typeof(zIndex) == "undefined") {
-			zIndex = 100000;
-		}
-		
-		var originalZIndex = ToolMan.css().readStyle(this.element, "z-index")
-		
-		this.register('dragstart', function(dragEvent) {
-			dragEvent.group.element.style.zIndex = zIndex
-		})
-		this.register('dragend', function(dragEvent) {
-			if (typeof(originalZIndex) != "undefined") {
-				dragEvent.group.element.style.zIndex = originalZIndex
-			}
-			//dragEvent.group.element.style.backgroundColor = '#f00';
-		})
-	},
-	
-	_dragInit : function(event) {
-		event = ToolMan.events().fix(event)
-		var group = document.toolManDragGroup = this.toolManDragGroup
-		var dragEvent = group.factory._createEvent('draginit', event, group)
-		
-		group._isThresholdExceeded = false
-		group._initialMouseOffset = dragEvent.mouseOffset
-		group._grabOffset = dragEvent.mouseOffset.minus(dragEvent.topLeftOffset)
-		ToolMan.events().register(document, 'mousemove', group._drag)
-		document.onmousemove = function() { return false }
-		ToolMan.events().register(document, 'mouseup', group._dragEnd)
-		
-		ToolMan.events().register(document, 'mousedown',group._drag);
-		document.onmousedown = function() { return false; };
-		
-		group._notifyListeners(dragEvent)
-	},
-	
-	_drag : function(event) {
-		event = ToolMan.events().fix(event)
-		var coordinates = ToolMan.coordinates()
-		var group = this.toolManDragGroup
-		if (!group) return
-		var dragEvent = group.factory._createEvent('dragmove', event, group)
-		
-		var newTopLeftOffset = dragEvent.mouseOffset.minus(group._grabOffset)
-		
-		// TODO: replace with DragThreshold object
-		if (!group._isThresholdExceeded) {
-			var distance = 
-					dragEvent.mouseOffset.distance(group._initialMouseOffset)
-			if (distance < group._thresholdDistance) return
-			group._isThresholdExceeded = true
-			group._notifyListeners(
-					group.factory._createEvent('dragstart', event, group))
-		}
-		
-		for (i in group._transforms) {
-			var transform = group._transforms[i]
-			newTopLeftOffset = transform(newTopLeftOffset, dragEvent)
-		}
-		
-		var dragDelta = newTopLeftOffset.minus(dragEvent.topLeftOffset)
-		var newTopLeftPosition = dragEvent.topLeftPosition.plus(dragDelta)
-		newTopLeftPosition.reposition(group.element)
-		dragEvent.transformedMouseOffset = newTopLeftOffset.plus(group._grabOffset)
-		
-		group._notifyListeners(dragEvent)
-		
-		var errorDelta = newTopLeftOffset.minus(coordinates.topLeftOffset(group.element))
-		if (errorDelta.x != 0 || errorDelta.y != 0) {
-			coordinates.topLeftPosition(group.element).plus(errorDelta).reposition(group.element)
-		}
-	},
-	
-	_dragEnd : function(event) {
-		event = ToolMan.events().fix(event)
-		var group = this.toolManDragGroup
-		var dragEvent = group.factory._createEvent('dragend', event, group)
-		
-		group._notifyListeners(dragEvent)
-		
-		this.toolManDragGroup = null
-		ToolMan.events().unregister(document, 'mousemove', group._drag)
-		document.onmousemove = null
-		ToolMan.events().unregister(document, 'mouseup', group._dragEnd)
-		
-		ToolMan.events().register(document, 'mousedown', group._drag);
-		document.onmousedown = function() { return true };
-	},
-	
-	_notifyListeners : function(dragEvent) {
-		var listeners = this._listeners[dragEvent.type]
-		for (i in listeners) {
-			listeners[i](dragEvent)
-		}
-	}
-}
-
-function _ToolManDragEvent(type, event, group) {
-	this.type = type
-	this.group = group
-	this.mousePosition = ToolMan.coordinates().mousePosition(event)
-	this.mouseOffset = ToolMan.coordinates().mouseOffset(event)
-	this.transformedMouseOffset = this.mouseOffset
-	this.topLeftPosition = ToolMan.coordinates().topLeftPosition(group.element)
-	this.topLeftOffset = ToolMan.coordinates().topLeftOffset(group.element)
-}
-
-_ToolManDragEvent.prototype = {
-	toString : function() {
-		return "mouse: " + this.mousePosition + this.mouseOffset + "    " +
-				"xmouse: " + this.transformedMouseOffset + "    " +
-				"left,top: " + this.topLeftPosition + this.topLeftOffset
-	}
-}
-
-ToolMan._dragFactory._constraintFactory = {
-	vertical : function() {
-		return function(coordinate, dragEvent) {
-			var x = dragEvent.topLeftOffset.x
-			return coordinate.x != x
-					? coordinate.factory.create(x, coordinate.y) 
-					: coordinate
-		}
-	},
-	
-	horizontal : function() {
-		return function(coordinate, dragEvent) {
-			var y = dragEvent.topLeftOffset.y
-			return coordinate.y != y
-					? coordinate.factory.create(coordinate.x, y) 
-					: coordinate
-		}
-	}
-}
Index: dmin/js/tool-man/dragsort.js
===================================================================
--- admin/js/tool-man/dragsort.js	(revision 0)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/* Copyright (c) 2005 Tim Taylor Consulting (see LICENSE.txt) */
-
-ToolMan._dragsortFactory = {
-	makeSortable : function(item) {
-		var group = ToolMan.drag().createSimpleGroup(item)
-		
-		group.register('dragstart', this._onDragStart)
-		group.register('dragmove', this._onDragMove)
-		group.register('dragend', this._onDragEnd)
-		
-		return group
-	},
-	
-	/** 
-	 * Iterates over a list's items, making them sortable, applying
-	 * optional functions to each item.
-	 *
-	 * example: makeListSortable(myList, myFunc1, myFunc2, ... , myFuncN)
-	 */
-	makeListSortable : function(list) {
-		var helpers = ToolMan.helpers()
-		var coordinates = ToolMan.coordinates()
-		var items = list.getElementsByTagName("li")
-		
-		helpers.map(items, function(item) {
-			var dragGroup = dragsort.makeSortable(item)
-			dragGroup.setThreshold(4)
-			var min, max
-			dragGroup.addTransform(function(coordinate, dragEvent) {
-				return coordinate.constrainTo(min, max)
-			})
-			dragGroup.register('dragstart', function() {
-				var items = list.getElementsByTagName("li")
-				min = max = coordinates.topLeftOffset(items[0])
-				for (var i = 1, n = items.length; i < n; i++) {
-					var offset = coordinates.topLeftOffset(items[i])
-					min = min.min(offset)
-					max = max.max(offset)
-				}
-			})
-		})
-		for (var i = 1, n = arguments.length; i < n; i++)
-			helpers.map(items, arguments[i])
-	},
-	
-	_onDragStart : function(dragEvent) {
-	},
-	
-	_onDragMove : function(dragEvent) {
-		var helpers = ToolMan.helpers()
-		var coordinates = ToolMan.coordinates()
-		
-		var item = dragEvent.group.element
-		var xmouse = dragEvent.transformedMouseOffset
-		var moveTo = null
-		
-		var previous = helpers.previousItem(item, item.nodeName)
-		while (previous != null) {
-			var bottomRight = coordinates.bottomRightOffset(previous)
-			if (xmouse.y <= bottomRight.y && xmouse.x <= bottomRight.x) {
-				moveTo = previous
-			}
-			previous = helpers.previousItem(previous, item.nodeName)
-		}
-		if (moveTo != null) {
-			helpers.moveBefore(item, moveTo)
-			return
-		}
-		
-		var next = helpers.nextItem(item, item.nodeName)
-		while (next != null) {
-			var topLeft = coordinates.topLeftOffset(next)
-			if (topLeft.y <= xmouse.y && topLeft.x <= xmouse.x) {
-				moveTo = next
-			}
-			next = helpers.nextItem(next, item.nodeName)
-		}
-		if (moveTo != null) {
-			helpers.moveBefore(item, helpers.nextItem(moveTo, item.nodeName))
-			return
-		}
-	},
-	
-	_onDragEnd : function(dragEvent) {
-		ToolMan.coordinates().create(0, 0).reposition(dragEvent.group.element)
-	}
-}
Index: dmin/js/tool-man/events.js
===================================================================
--- admin/js/tool-man/events.js	(revision 0)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/* Copyright (c) 2005 Tim Taylor Consulting (see LICENSE.txt) */
-
-ToolMan._eventsFactory = {
-	fix : function(event) {
-		if (!event) event = window.event
-		
-		if (event.target) {
-			if (event.target.nodeType == 3) event.target = event.target.parentNode
-		} else if (event.srcElement) {
-			event.target = event.srcElement
-		}
-		
-		return event
-	},
-	
-	register : function(element, type, func) {
-		if (element.addEventListener) {
-			element.addEventListener(type, func, false)
-		} else if (element.attachEvent) {
-			if (!element._listeners) element._listeners = new Array()
-			if (!element._listeners[type]) element._listeners[type] = new Array()
-			var workaroundFunc = function() {
-				func.apply(element, new Array())
-			}
-			element._listeners[type][func] = workaroundFunc
-			element.attachEvent('on' + type, workaroundFunc)
-		}
-	},
-	
-	unregister : function(element, type, func) {
-		if (element.removeEventListener) {
-			element.removeEventListener(type, func, false)
-		} else if (element.detachEvent) {
-			if (element._listeners 
-					&& element._listeners[type] 
-					&& element._listeners[type][func]) {
-						
-				element.detachEvent('on' + type, 
-						element._listeners[type][func])
-			}
-		}
-	}
-}
Index: admin/media.php
===================================================================
--- admin/media.php	(revision 1636)
+++ admin/media.php	(revision 1678)
@@ -422,5 +422,5 @@
 {
 	echo
-	'<p class="zip-dl"><a href="'.html::escapeURL($page_url).'&amp;zipdl=1">'.
+	'<p class="zip-dl"><a class="submit" href="'.html::escapeURL($page_url).'&amp;zipdl=1">'.
 	__('Download this directory as a zip file').'</a></p>';
 }
Index: admin/style/default.css
===================================================================
--- admin/style/default.css	(revision 1636)
+++ admin/style/default.css	(revision 1678)
@@ -575,5 +575,9 @@
 	padding: 1em 3em;
 	vertical-align: top;
-	border: 1px solid #ccc;
+	border: 1px solid #ddd;
+	border-collapse: collapse;
+}
+.db-item h3 {
+	font-weight: normal;
 }
 #dashboard-items img {
@@ -749,5 +753,5 @@
 	position: static;
 }
-.media-col-0 {
+/*.media-col-0 {
 	clear: left;
 }
@@ -776,5 +780,5 @@
 	margin: 0 0 0 60px;
 	padding: 0;
-}
+}*/
 li.media-action {
 	display: block;
@@ -792,4 +796,30 @@
 li.media-action input {
 	border: none;
+}
+.media-item {
+	position: relative;
+	border: 1px solid #ccc;
+	margin: 1em;
+	padding: 1em;
+	width: 300px;
+	height: 120px;
+	display: inline-block;
+	vertical-align: top;
+}
+div.media-list .media-item {
+}
+a.media-icon {
+	display: block;
+	border-bottom: none;
+	margin: 0 auto; 
+}
+.media-icon img {
+	display: block;
+}
+.media-item ul {
+	display: block;
+	list-style: none;
+	margin: 0;
+	padding: 0;
 }
 /* ------------------------------------------------------------------ preferences */
@@ -1303,5 +1333,5 @@
 	border-style: solid;
 	border-color: #e3e3e3;
-	padding: .3em .5em;
+	padding: .3em 1em .3em .5em;
 	vertical-align: top;
 }
@@ -1311,5 +1341,5 @@
 	border-color: #ccc;
 	background: #f3f3ff;
-	padding: .3em .5em;
+	padding: .3em 1em .3em .5em;
 	vertical-align: top;
 	text-align: left;
@@ -1336,4 +1366,8 @@
 	white-space: nowrap;
 	vertical-align: top;
+}
+table .count {
+	text-align: right;
+	padding-right: 1.5em;
 }
 table.settings, table.prefs {
Index: inc/admin/lib.dc.page.php
===================================================================
--- inc/admin/lib.dc.page.php	(revision 1599)
+++ inc/admin/lib.dc.page.php	(revision 1655)
@@ -792,16 +792,4 @@
 }
 
-public static function jsToolMan()
-{
-	return
-	'<script type="text/javascript" src="js/tool-man/core.js"></script>'.
-	'<script type="text/javascript" src="js/tool-man/events.js"></script>'.
-	'<script type="text/javascript" src="js/tool-man/css.js"></script>'.
-	'<script type="text/javascript" src="js/tool-man/coordinates.js"></script>'.
-	'<script type="text/javascript" src="js/tool-man/drag.js"></script>'.
-	'<script type="text/javascript" src="js/tool-man/dragsort.js"></script>'.
-	'<script type="text/javascript" src="js/dragsort-tablerows.js"></script>';
-}
-
 public static function jsMetaEditor()
 {
Index: inc/admin/lib.pager.php
===================================================================
--- inc/admin/lib.pager.php	(revision 1622)
+++ inc/admin/lib.pager.php	(revision 1670)
@@ -136,9 +136,9 @@
 		'<td class="maximal" scope="row"><a href="'.$this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id).'">'.
 		html::escapeHTML($this->rs->post_title).'</a></td>'.
-		'<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>'.
+		'<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>'.
 		'<td class="nowrap">'.$cat_title.'</td>'.
 		'<td class="nowrap">'.html::escapeHTML($this->rs->user_id).'</td>'.
-		'<td class="nowrap">'.$this->rs->nb_comment.'</td>'.
-		'<td class="nowrap">'.$this->rs->nb_trackback.'</td>'.
+		'<td class="nowrap count">'.$this->rs->nb_comment.'</td>'.
+		'<td class="nowrap count">'.$this->rs->nb_trackback.'</td>'.
 		'<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>'.
 		'</tr>';
@@ -234,5 +234,5 @@
 		'title="'.html::escapeHTML($this->rs->getURL()).'">'.
 		html::escapeHTML($this->rs->post_title).'</a></td>'.
-		'<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>'.
+		'<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>'.
 		'<td class="nowrap">'.html::escapeHTML($this->rs->user_id).'</td>'.
 		'<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>'.
@@ -260,5 +260,6 @@
 			$html_block =
 			'<table><caption class="hidden">'.__('Comments and trackbacks list').'</caption><tr>'.
-			'<th colspan="3" scope="col" abbr="comm" class="first">'.__('Type and author').'</th>'.
+			'<th colspan="2" scope="col" abbr="comm" class="first">'.__('Type').'</th>'.
+			'<th scope="col">'.__('Author').'</th>'.
 			'<th scope="col">'.__('Date').'</th>'.
 			'<th scope="col" class="txt-center">'.__('Status').'</th>'.
@@ -326,4 +327,7 @@
 			$post_title = mb_strcut($post_title,0,57).'...';
 		}
+		$comment_title = sprintf(__('Edit the %1$s from %2$s'),
+			$this->rs->comment_trackback ? __('trackback') : __('comment'),
+			html::escapeHTML($this->rs->comment_author));
 		
 		$res = '<tr class="line'.($this->rs->comment_status != 1 ? ' offline' : '').'"'.
@@ -333,11 +337,10 @@
 		'<td class="nowrap">'.
 		form::checkbox(array('comments[]'),$this->rs->comment_id,'','','',0).'</td>'.
-		'<td class="status txt-center">'.
-			'<a href="'.$comment_url.'">'.
-			'<img src="images/edit-mini.png" alt="" title="'.__('Edit').'" /> '.
-			'</a>'.'</td>'.
-		'<td class="maximal" scope="row">'.($this->rs->comment_trackback ? __('trackback from') : __('comment from')).' '.
-			'<a href="'.$author_url.'">'.html::escapeHTML($this->rs->comment_author).'</a></td>'.
-		'<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->comment_dt).'</td>'.
+		'<td class="nowrap" abbr="'.__('Type and author').'" scope="raw">'.
+			'<a href="'.$comment_url.'" title="'.$comment_title.'">'.
+			'<img src="images/edit-mini.png" alt="'.__('Edit').'"/> '.
+			($this->rs->comment_trackback ? __('trackback') : __('comment')).' '.'</a></td>'.
+		'<td class="nowrap maximal"><a href="'.$author_url.'">'.html::escapeHTML($this->rs->comment_author).'</a></td>'.
+		'<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->comment_dt).'</td>'.
 		'<td class="nowrap status txt-center">'.$img_status.'</td>'.
 		'<td class="nowrap"><a href="'.$post_url.'">'.
@@ -372,5 +375,5 @@
 			'<th scope="col">'.__('Last Name').'</th>'.
 			'<th scope="col">'.__('Display name').'</th>'.
-			'<th scope="col" class="nowrap">'.__('Entries').'</th>'.
+			'<th scope="col" class="nowrap">'.__('Entries (all types)').'</th>'.
 			'</tr>%s</table>';
 			
@@ -418,5 +421,5 @@
 		'<td class="nowrap">'.html::escapeHTML($this->rs->user_name).'</td>'.
 		'<td class="nowrap">'.html::escapeHTML($this->rs->user_displayname).'</td>'.
-		'<td class="nowrap"><a href="posts.php?user_id='.$this->rs->user_id.'">'.
+		'<td class="nowrap count"><a href="posts.php?user_id='.$this->rs->user_id.'">'.
 		$this->rs->nb_post.'</a></td>'.
 		'</tr>';
Index: inc/core/class.dc.trackback.php
===================================================================
--- inc/core/class.dc.trackback.php	(revision 1179)
+++ inc/core/class.dc.trackback.php	(revision 1674)
@@ -80,36 +80,56 @@
 		}
 		
-		$data = array(
-			'title' => $post_title,
-			'excerpt' => $post_excerpt,
-			'url' => $post_url,
-			'blog_name' => trim(html::escapeHTML(html::clean($this->core->blog->name)))
-			//,'__debug' => false
-		);
-		
-		# Ping
-		try
-		{
-			$http = self::initHttp($url,$path);
-			$http->post($path,$data,'UTF-8');
-			$res = $http->getContent();
-		}
-		catch (Exception $e)
-		{
-			throw new Exception(__('Unable to ping URL'));
-		}
-		
-		$pattern =
-		'|<response>.*<error>(.*)</error>(.*)'.
-		'(<message>(.*)</message>(.*))?'.
-		'</response>|msU';
-		
-		if (!preg_match($pattern,$res,$match))
-		{
-			throw new Exception(sprintf(__('%s is not a ping URL'),$url));
-		}
-		
-		$ping_error = trim($match[1]);
-		$ping_msg = (!empty($match[4])) ? $match[4] : '';
+		$ping_parts = explode('|',$url);
+		
+		# Let's walk by the trackback way
+		if (count($ping_parts) < 2) {
+			$data = array(
+				'title' => $post_title,
+				'excerpt' => $post_excerpt,
+				'url' => $post_url,
+				'blog_name' => trim(html::escapeHTML(html::clean($this->core->blog->name)))
+				//,'__debug' => false
+			);
+			
+			# Ping
+			try
+			{
+				$http = self::initHttp($url,$path);
+				$http->post($path,$data,'UTF-8');
+				$res = $http->getContent();
+			}
+			catch (Exception $e)
+			{
+				throw new Exception(__('Unable to ping URL'));
+			}
+			
+			$pattern =
+			'|<response>.*<error>(.*)</error>(.*)'.
+			'(<message>(.*)</message>(.*))?'.
+			'</response>|msU';
+			
+			if (!preg_match($pattern,$res,$match))
+			{
+				throw new Exception(sprintf(__('%s is not a ping URL'),$url));
+			}
+			
+			$ping_error = trim($match[1]);
+			$ping_msg = (!empty($match[4])) ? $match[4] : '';
+		}
+		# Damnit ! Let's play pingback
+		else {
+			try {
+				$xmlrpc = new xmlrpcClient($ping_parts[0]);
+				$res = $xmlrpc->query('pingback.ping', $post_url, $ping_parts[1]);
+				$ping_error = '0';
+			}
+			catch (xmlrpcException $e) {
+				$ping_error = $e->getCode();
+				$ping_msg = $e->getMessage();	
+			}
+			catch (Exception $e) {
+				throw new Exception(__('Unable to ping URL'));
+			}
+		}
 		
 		if ($ping_error != '0') {
@@ -289,4 +309,147 @@
 	}
 	//@}
+
+	/// @name Receive pingbacks
+	//@{
+	/**
+	Receives a pingback and insert it as a comment of given post.
+	
+	@param	from_url		<b>string</b>		Source URL
+	@param	to_url			<b>string</b>		Target URL
+	*/
+	public function receive_pb($from_url, $to_url)
+	{
+		$reg = '!^'.preg_quote($this->core->blog->url).'(.*)!';
+		$type = $args = $next = '';
+		
+		# Are you dumb?
+		if (!preg_match($reg, $to_url, $m)) {
+			throw new Exception(__('Any chance you ping one of my contents? No? Really?'), 0);
+		}
+		
+		# Does the targeted URL look like a registered post type? 
+		$url_part = $m[1];
+		$p_type = '';
+		$post_types = $this->core->getPostTypes();
+		foreach ($post_types as $k => $v) {
+			$reg = '!^'.preg_quote(str_replace('%s', '', $v['public_url'])).'(.*)!';
+			if (preg_match($reg, $url_part, $n)) {
+				$p_type = $k;
+				$post_url = $n[1];
+				break;
+			}
+		}
+		
+		if (empty($p_type)) {
+			throw new Exception(__('Sorry but you can not ping this type of content.'), 33);
+		}
+
+		# Time to see if we've got a winner...
+		$params = array(
+			'post_type' => $p_type,
+			'post_url' => $post_url,
+		);
+		$posts = $this->core->blog->getPosts($params);
+		
+		# Missed! 
+		if ($posts->isEmpty()) {
+			throw new Exception(__('Oops. Kinda "not found" stuff. Please check the target URL twice.'), 33);
+		}
+		
+		# Nice try. But, sorry, no.
+		if (!$posts->trackbacksActive()) {
+			throw new Exception(__('Sorry, dude. This entry does not accept pingback at the moment.'), 33);
+		}
+
+		# OK. We've found our champion. Time to check the remote part.
+		try {
+			$http = self::initHttp($from_url, $from_path);
+			
+			# First round : just to be sure the ping comes from an acceptable resource type.
+			$http->setHeadersOnly(true);
+			$http->get($from_path);
+			$c_type = explode(';', $http->getHeader('content-type'));
+
+			# Bad luck. Bye, bye...
+			if (!in_array($c_type[0],array('text/html', 'application/xhtml+xml'))) {
+				throw new Exception(__('Your source URL does not look like a supported content type. Sorry. Bye, bye!'), 0);
+			}
+			
+			# Second round : let's go fetch and parse the remote content
+			$http->setHeadersOnly(false);
+			$http->get($from_path);
+			$remote_content = $http->getContent();
+
+			$charset = mb_detect_encoding($remote_content,
+				'UTF-8,ISO-8859-1,ISO-8859-2,ISO-8859-3,'.
+				'ISO-8859-4,ISO-8859-5,ISO-8859-6,ISO-8859-7,ISO-8859-8,'.
+				'ISO-8859-9,ISO-8859-10,ISO-8859-13,ISO-8859-14,ISO-8859-15');
+
+			if (strtolower($charset) != 'utf-8') {
+				$remote_content = iconv($charset,'UTF-8',$remote_content);
+			}
+			
+			# We want a title...
+			if (!preg_match('!<title>([^<].*?)</title>!mis', $remote_content, $m)) {
+				throw new Exception(__('Where\'s your title?'), 0);
+			}
+			$title = trim(html::clean($m[1]));
+			$title = html::decodeEntities($title);
+			$title = html::escapeHTML($title);
+			$title = text::cutString($title,60);
+			
+			preg_match('!<body[^>]*?>(.*)?</body>!msi', $remote_content, $m);
+			$source = $m[1];
+			$source = preg_replace('![\r\n\s]+!ms',' ',$source);
+			$source = preg_replace( "/<\/*(h\d|p|th|td|li|dt|dd|pre|caption|input|textarea|button)[^>]*>/", "\n\n", $source );
+			$source = strip_tags($source, '<a>');
+			$source = explode("\n\n",$source);
+			
+			$excerpt = '';
+			foreach ($source as $line) {
+				if (strpos($line, $to_url) !== false) {
+					if (preg_match("!<a[^>]+?".$to_url."[^>]*>([^>]+?)</a>!", $line, $m)) {
+						$excerpt = strip_tags($line);
+						break;
+					}
+				}
+			}
+			if ($excerpt) {
+				$excerpt = '(&#8230;) '.text::cutString(html::escapeHTML($excerpt),255).' (&#8230;)';
+			}
+			else {
+				$excerpt = '(??)';
+			}
+
+			$comment =
+			"<!-- TB -->\n".
+			'<p><strong>'.$title."</strong></p>\n".
+			'<p>'.$excerpt.'</p>';
+			
+			$cur = $this->core->con->openCursor($this->core->prefix.'comment');
+			$cur->comment_author = 'Anonymous blog';
+			$cur->comment_site = (string) $from_url;
+			$cur->comment_content = (string) $comment;
+			$cur->post_id = $posts->post_id;
+			$cur->comment_trackback = 1;
+			$cur->comment_status = $this->core->blog->settings->system->trackbacks_pub ? 1 : -1;
+			$cur->comment_ip = http::realIP();
+			
+			# --BEHAVIOR-- publicBeforeTrackbackCreate
+			$this->core->callBehavior('publicBeforeTrackbackCreate',$cur);
+			if ($cur->post_id) {
+				$comment_id = $this->core->blog->addComment($cur);
+				
+				# --BEHAVIOR-- publicAfterTrackbackCreate
+				$this->core->callBehavior('publicAfterTrackbackCreate',$cur,$comment_id);
+			}
+		}
+		catch (Exception $e) {
+			throw new Exception(__('Sorry, an internal problem has occured.'), 0);
+		}
+		
+		return __('Thanks, mate. It was a pleasure.');
+	}
+	//@}
 	
 	private static function initHttp($url,&$path)
@@ -346,5 +509,5 @@
 			for ($i = 0; $i<count($match); $i++)
 			{
-				if (preg_match('/href="(http:\/\/[^"]+)"/ms', $match[$i][1], $matches)) {
+				if (preg_match('/href="((https?:\/)?\/[^"]+)"/ms', $match[$i][1], $matches)) {
 					$res[$matches[1]] = 1;
 				}
@@ -358,5 +521,5 @@
 			for ($i = 0; $i<count($match); $i++)
 			{
-				if (preg_match('/cite="(http:\/\/[^"]+)"/ms', $match[$i][2], $matches)) {
+				if (preg_match('/cite="((https?:\/)?\/[^"]+)"/ms', $match[$i][2], $matches)) {
 					$res[$matches[1]] = 1;
 				}
@@ -369,4 +532,8 @@
 	private function getPingURL($url)
 	{
+		if (strpos($url,'/') === 0) {
+			$url = http::getHost().$url;
+		}
+		
 		try
 		{
@@ -374,4 +541,5 @@
 			$http->get($path);
 			$page_content = $http->getContent();
+			$pb_url = $http->getHeader('x-pingback');
 		}
 		catch (Exception $e)
@@ -380,4 +548,20 @@
 		}
 		
+		# If we've got a X-Pingback header and it's a valid URL, it will be enough
+		if ($pb_url && filter_var($pb_url,FILTER_VALIDATE_URL) && preg_match('!^https?:!',$pb_url)) {
+			return $pb_url.'|'.$url;
+		}
+		
+		# No X-Pingback header. A link rel=pingback, maybe ?
+		$pattern_pingback = '!<link rel="pingback" href="(.*?)"( /)?>!msi';
+		
+		if (preg_match($pattern_pingback,$page_content,$m)) {
+			$pb_url = $m[1];
+			if (filter_var($pb_url,FILTER_VALIDATE_URL) && preg_match('!^https?:!',$pb_url)) {
+				return $pb_url.'|'.$url;
+			}
+		}
+
+		# No pingback ? OK, let's check for a trackback data chunk...
 		$pattern_rdf =
 		'/<rdf:RDF.*?>.*?'.
@@ -388,9 +572,12 @@
 		preg_match_all($pattern_rdf,$page_content,$rdf_all,PREG_SET_ORDER);
 		
+		$url_path = parse_url($url, PHP_URL_PATH);
+		$sanitized_url = str_replace($url_path, html::sanitizeURL($url_path), $url);
+		
 		for ($i=0; $i<count($rdf_all); $i++)
 		{
 			$rdf = $rdf_all[$i][1];
-			
-			if (preg_match('/dc:identifier="'.preg_quote($url,'/').'"/msi',$rdf)) {
+			if (preg_match('/dc:identifier="'.preg_quote($url,'/').'"/msi',$rdf) ||
+				preg_match('/dc:identifier="'.preg_quote($sanitized_url,'/').'"/msi',$rdf)) {
 				if (preg_match('/trackback:ping="(.*?)"/msi',$rdf,$tb_link)) {
 					return $tb_link[1];
Index: inc/core/class.dc.xmlrpc.php
===================================================================
--- inc/core/class.dc.xmlrpc.php	(revision 1179)
+++ inc/core/class.dc.xmlrpc.php	(revision 1674)
@@ -214,4 +214,9 @@
 			array('array','integer','string','string'),
 			'Retrieve all of the comment statuses.');
+			
+		# Pingback support
+		$this->addCallback('pingback.ping',array($this,'pingback_ping'),
+			array('string', 'string', 'string'),
+			'Notify a link to a post.');
 	}
 	
@@ -270,5 +275,5 @@
 	}
 	
-	private function setBlog()
+	private function setBlog($bypass = false)
 	{
 		if (!$this->blog_id) {
@@ -288,6 +293,7 @@
 		}
 		
-		if (!$this->core->blog->settings->system->enable_xmlrpc ||
-		!$this->core->auth->check('usage,contentadmin',$this->core->blog->id)) {
+		if (!$bypass &&
+			(!$this->core->blog->settings->system->enable_xmlrpc ||
+			!$this->core->auth->check('usage,contentadmin',$this->core->blog->id))) {
 			$this->core->blog = null;
 			throw new Exception('Not enough permissions on this blog.');
@@ -1629,4 +1635,18 @@
 		);
 	}
+
+	/* Pingback support
+	--------------------------------------------------- */
+	public function pingback_ping($from_url, $to_url)
+	{
+		# Come on, buddy! Don't make me waste time with this kind of silliness...
+		if (!(filter_var($from_url, FILTER_VALIDATE_URL) && preg_match('!^https?://!',$from_url))) {
+			throw new Exception(__('No valid source URL provided? Try again!'), 0);
+		}
+		
+		$this->setBlog(true);
+		$tb = new dcTrackback($this->core);
+		return $tb->receive_pb($from_url, $to_url);
+	}
 }
 ?>
Index: inc/public/class.dc.template.php
===================================================================
--- inc/public/class.dc.template.php	(revision 1611)
+++ inc/public/class.dc.template.php	(revision 1674)
@@ -70,4 +70,5 @@
 		$this->addValue('BlogID',array($this,'BlogID'));
 		$this->addValue('BlogURL',array($this,'BlogURL'));
+		$this->addValue('BlogXMLRPCURL',array($this,'BlogXMLRPCURL'));
 		$this->addValue('BlogPublicURL',array($this,'BlogPublicURL'));
 		$this->addValue('BlogQmarkURL',array($this,'BlogQmarkURL'));
@@ -906,4 +907,13 @@
 	
 	/*dtd
+	<!ELEMENT tpl:BlogXMLRPCURL - O -- Blog XML-RPC URL -->
+	*/
+	public function BlogXMLRPCURL($attr)
+	{
+		$f = $this->getFilters($attr);
+		return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getURLFor(\'xmlrpc\',$core->blog->id)').'; ?>';
+	}
+	
+	/*dtd
 	<!ELEMENT tpl:BlogURL - O -- Blog URL -->
 	*/
Index: inc/public/default-templates/post.html
===================================================================
--- inc/public/default-templates/post.html	(revision 932)
+++ inc/public/default-templates/post.html	(revision 1674)
@@ -25,4 +25,5 @@
   <link rel="top" href="{{tpl:BlogURL}}" title="{{tpl:lang Home}}" />
   <link rel="contents" href="{{tpl:BlogArchiveURL}}" title="{{tpl:lang Archives}}" />
+  <tpl:EntryIf pings_active="1"><link rel="pingback" href="{{tpl:BlogXMLRPCURL}}" /></tpl:EntryIf>
   
   <tpl:EntryNext><link rel="next" href="{{tpl:EntryURL}}"
Index: inc/public/lib.urlhandlers.php
===================================================================
--- inc/public/lib.urlhandlers.php	(revision 1610)
+++ inc/public/lib.urlhandlers.php	(revision 1674)
@@ -480,4 +480,7 @@
 				
 				# The entry
+				if ($_ctx->posts->trackbacksActive()) {
+					header('X-Pingback: '.$core->blog->url.$core->url->getURLFor("xmlrpc",$core->blog->id));
+				}
 				self::serveDocument('post.html');
 			}
Index: locales/bn/plugins.po
===================================================================
--- locales/bn/plugins.po	(revision 1636)
+++ locales/bn/plugins.po	(revision 1668)
@@ -1060,14 +1060,14 @@
 msgstr ""
 
-msgid "Page status:"
-msgstr ""
-
-msgid "Page position:"
-msgstr ""
-
-msgid "Page lang:"
-msgstr ""
-
-msgid "Page password:"
+msgid "Page status"
+msgstr ""
+
+msgid "Page position"
+msgstr ""
+
+msgid "Page lang"
+msgstr ""
+
+msgid "Page password"
 msgstr ""
 
Index: locales/ca/plugins.po
===================================================================
--- locales/ca/plugins.po	(revision 1636)
+++ locales/ca/plugins.po	(revision 1668)
@@ -1056,14 +1056,14 @@
 msgstr ""
 
-msgid "Page status:"
-msgstr ""
-
-msgid "Page position:"
-msgstr ""
-
-msgid "Page lang:"
-msgstr ""
-
-msgid "Page password:"
+msgid "Page status"
+msgstr ""
+
+msgid "Page position"
+msgstr ""
+
+msgid "Page lang"
+msgstr ""
+
+msgid "Page password"
 msgstr ""
 
Index: locales/cs/plugins.po
===================================================================
--- locales/cs/plugins.po	(revision 1636)
+++ locales/cs/plugins.po	(revision 1668)
@@ -1065,14 +1065,14 @@
 msgstr ""
 
-msgid "Page status:"
+msgid "Page status"
 msgstr "Stav stránky:"
 
-msgid "Page position:"
+msgid "Page position"
 msgstr "Pozice stránky:"
 
-msgid "Page lang:"
+msgid "Page lang"
 msgstr "Jazyk stránky:"
 
-msgid "Page password:"
+msgid "Page password"
 msgstr "Heslo stránky:"
 
Index: locales/da/plugins.po
===================================================================
--- locales/da/plugins.po	(revision 1636)
+++ locales/da/plugins.po	(revision 1668)
@@ -1056,14 +1056,14 @@
 msgstr ""
 
-msgid "Page status:"
-msgstr ""
-
-msgid "Page position:"
-msgstr ""
-
-msgid "Page lang:"
-msgstr ""
-
-msgid "Page password:"
+msgid "Page status"
+msgstr ""
+
+msgid "Page position"
+msgstr ""
+
+msgid "Page lang"
+msgstr ""
+
+msgid "Page password"
 msgstr ""
 
Index: locales/de/plugins.po
===================================================================
--- locales/de/plugins.po	(revision 1636)
+++ locales/de/plugins.po	(revision 1668)
@@ -1066,14 +1066,14 @@
 msgstr ""
 
-msgid "Page status:"
+msgid "Page status"
 msgstr "Status der Seite:"
 
-msgid "Page position:"
+msgid "Page position"
 msgstr "Position der Seite:"
 
-msgid "Page lang:"
+msgid "Page lang"
 msgstr "Sprache der Seite:"
 
-msgid "Page password:"
+msgid "Page password"
 msgstr "Passwort der Seite:"
 
Index: locales/en/main.po
===================================================================
--- locales/en/main.po	(revision 1637)
+++ locales/en/main.po	(revision 1670)
@@ -547,5 +547,5 @@
 
 msgid "Entries (all types)"
-msgstr "Entries &amp; pages"
+msgstr "Entries"
 
 msgid "Status"
Index: locales/en/plugins.po
===================================================================
--- locales/en/plugins.po	(revision 1636)
+++ locales/en/plugins.po	(revision 1668)
@@ -1076,14 +1076,14 @@
 msgstr ""
 
-msgid "Page status:"
-msgstr ""
-
-msgid "Page position:"
-msgstr ""
-
-msgid "Page lang:"
-msgstr ""
-
-msgid "Page password:"
+msgid "Page status"
+msgstr ""
+
+msgid "Page position"
+msgstr ""
+
+msgid "Page lang"
+msgstr ""
+
+msgid "Page password"
 msgstr ""
 
Index: locales/eo/plugins.po
===================================================================
--- locales/eo/plugins.po	(revision 1636)
+++ locales/eo/plugins.po	(revision 1668)
@@ -1056,14 +1056,14 @@
 msgstr ""
 
-msgid "Page status:"
-msgstr ""
-
-msgid "Page position:"
-msgstr ""
-
-msgid "Page lang:"
-msgstr ""
-
-msgid "Page password:"
+msgid "Page status"
+msgstr ""
+
+msgid "Page position"
+msgstr ""
+
+msgid "Page lang"
+msgstr ""
+
+msgid "Page password"
 msgstr ""
 
Index: locales/es-ar/plugins.po
===================================================================
--- locales/es-ar/plugins.po	(revision 1636)
+++ locales/es-ar/plugins.po	(revision 1668)
@@ -1068,14 +1068,14 @@
 msgstr ""
 
-msgid "Page status:"
+msgid "Page status"
 msgstr "Estado de la pagina:"
 
-msgid "Page position:"
+msgid "Page position"
 msgstr "Posición de la pagina:"
 
-msgid "Page lang:"
+msgid "Page lang"
 msgstr "Idioma de la pagina:"
 
-msgid "Page password:"
+msgid "Page password"
 msgstr "Contraseña de la pagina:"
 
Index: locales/es/plugins.po
===================================================================
--- locales/es/plugins.po	(revision 1636)
+++ locales/es/plugins.po	(revision 1668)
@@ -1074,14 +1074,14 @@
 msgstr ""
 
-msgid "Page status:"
+msgid "Page status"
 msgstr "Estado de la página:"
 
-msgid "Page position:"
+msgid "Page position"
 msgstr "Posición de la página:"
 
-msgid "Page lang:"
+msgid "Page lang"
 msgstr "Idioma de la página:"
 
-msgid "Page password:"
+msgid "Page password"
 msgstr "Contraseña de la página:"
 
Index: locales/eu/plugins.po
===================================================================
--- locales/eu/plugins.po	(revision 1636)
+++ locales/eu/plugins.po	(revision 1668)
@@ -1056,14 +1056,14 @@
 msgstr ""
 
-msgid "Page status:"
-msgstr ""
-
-msgid "Page position:"
-msgstr ""
-
-msgid "Page lang:"
-msgstr ""
-
-msgid "Page password:"
+msgid "Page status"
+msgstr ""
+
+msgid "Page position"
+msgstr ""
+
+msgid "Page lang"
+msgstr ""
+
+msgid "Page password"
 msgstr ""
 
Index: locales/fr/main.po
===================================================================
--- locales/fr/main.po	(revision 1637)
+++ locales/fr/main.po	(revision 1678)
@@ -171,5 +171,5 @@
 #, php-format
 msgid "You are about to delete the blog %s. Every entry, comment and category will be deleted."
-msgstr "Vous êtes sur le point de supprimer le blog %s. Tous ses billets, commentaires et catégories seront supprimés."
+msgstr "Vous êtes sur le point de supprimer le blog %s. Tous ses billets, pages, commentaires et catégories seront supprimés."
 
 msgid "Please give your password to confirm the blog deletion."
@@ -338,5 +338,5 @@
 
 msgid "Display smilies on entries and comments"
-msgstr "Afficher des émoticônes dans les billets et commentaires"
+msgstr "Afficher des émoticônes dans les billets, pages et commentaires"
 
 #, php-format
@@ -578,5 +578,5 @@
 
 msgid "Entries (all types)"
-msgstr "Billets &amp; pages"
+msgstr "Entrées"
 
 msgid "Status"
@@ -781,5 +781,5 @@
 
 msgid "Entry title"
-msgstr "Titre du billet"
+msgstr "Titre de l'entrée"
 
 msgid "Author"
@@ -1396,11 +1396,11 @@
 
 msgid "Show entries containing this media"
-msgstr "Afficher les billets contenant ce média"
+msgstr "Afficher les entrées contenant ce média"
 
 msgid "Entries containing this media"
-msgstr "Billets contenant ce média"
+msgstr "Entrées contenant ce média"
 
 msgid "No entry seems contain this media."
-msgstr "Aucun billet ne semble contenir ce média."
+msgstr "Aucune entrée ne semble contenir ce média."
 
 msgid "Image details"
@@ -2127,5 +2127,5 @@
 
 msgid "Number of entries"
-msgstr "Nombre de billets"
+msgstr "Nombre d'entrées"
 
 msgid "Set permissions"
@@ -2252,5 +2252,5 @@
 
 msgid "Users with posts cannot be deleted."
-msgstr "Les utilisateurs ayant écrit des billets ne peuvent être supprimés."
+msgstr "Les utilisateurs ayant écrit des entrées ne peuvent être supprimés."
 
 #, php-format
@@ -3273,2 +3273,17 @@
 msgid "Save my options"
 msgstr "Enregistrer mes options"
+
+msgid "Blog id"
+msgstr "Identifiant"
+
+msgid "Edit blog settings for %s"
+msgstr "Modifier les paramètres de %s"
+
+msgid "Edit blog settings"
+msgstr "Modifier les paramètres du blog"
+
+msgid "Edit the %1$s from %2$s"
+msgstr "Modifier le %1$s de %2$s"
+
+msgid "Backup"
+msgstr "Sauvegarde"
Index: locales/fr/plugins.po
===================================================================
--- locales/fr/plugins.po	(revision 1636)
+++ locales/fr/plugins.po	(revision 1669)
@@ -1255,15 +1255,15 @@
 msgstr "Voir cette page sur le site"
 
-msgid "Page status:"
-msgstr "État de la page :"
-
-msgid "Page position:"
-msgstr "Position de la page :"
-
-msgid "Page lang:"
-msgstr "Langue de la page :"
-
-msgid "Page password:"
-msgstr "Mot de passe de la page :"
+msgid "Page status"
+msgstr "État de la page"
+
+msgid "Page position"
+msgstr "Position de la page"
+
+msgid "Page lang"
+msgstr "Langue de la page"
+
+msgid "Page password"
+msgstr "Mot de passe de la page"
 
 msgid ""
@@ -1984,2 +1984,5 @@
 msgid "Hide in widget Pages"
 msgstr "Ne pas lister dans le widget Pages"
+
+msgid "Drag widgets here to remove them from this sidebar."
+msgstr "Glisser les widgets ici pour les retirer du volet."
Index: locales/hu/plugins.po
===================================================================
--- locales/hu/plugins.po	(revision 1636)
+++ locales/hu/plugins.po	(revision 1668)
@@ -1077,14 +1077,14 @@
 msgstr ""
 
-msgid "Page status:"
+msgid "Page status"
 msgstr "Oldal állapota:"
 
-msgid "Page position:"
+msgid "Page position"
 msgstr "Oldal pozíciója:"
 
-msgid "Page lang:"
+msgid "Page lang"
 msgstr "Oldal nyelve:"
 
-msgid "Page password:"
+msgid "Page password"
 msgstr "Oldal jelszava:"
 
Index: locales/it/plugins.po
===================================================================
--- locales/it/plugins.po	(revision 1636)
+++ locales/it/plugins.po	(revision 1668)
@@ -1056,14 +1056,14 @@
 msgstr ""
 
-msgid "Page status:"
-msgstr ""
-
-msgid "Page position:"
-msgstr ""
-
-msgid "Page lang:"
-msgstr ""
-
-msgid "Page password:"
+msgid "Page status"
+msgstr ""
+
+msgid "Page position"
+msgstr ""
+
+msgid "Page lang"
+msgstr ""
+
+msgid "Page password"
 msgstr ""
 
Index: locales/ja/plugins.po
===================================================================
--- locales/ja/plugins.po	(revision 1636)
+++ locales/ja/plugins.po	(revision 1668)
@@ -1072,14 +1072,14 @@
 msgstr ""
 
-msgid "Page status:"
+msgid "Page status"
 msgstr "ページの状態："
 
-msgid "Page position:"
+msgid "Page position"
 msgstr "ページの位置："
 
-msgid "Page lang:"
+msgid "Page lang"
 msgstr "ページの言語："
 
-msgid "Page password:"
+msgid "Page password"
 msgstr "ページのパスワード："
 
Index: locales/ko/plugins.po
===================================================================
--- locales/ko/plugins.po	(revision 1636)
+++ locales/ko/plugins.po	(revision 1668)
@@ -1079,14 +1079,14 @@
 msgstr ""
 
-msgid "Page status:"
+msgid "Page status"
 msgstr "페이지 공개상태 :"
 
-msgid "Page position:"
+msgid "Page position"
 msgstr "페이지 위치 :"
 
-msgid "Page lang:"
+msgid "Page lang"
 msgstr "페이지 언어 :"
 
-msgid "Page password:"
+msgid "Page password"
 msgstr "페이지 비밀번호 :"
 
Index: locales/lt/plugins.po
===================================================================
--- locales/lt/plugins.po	(revision 1499)
+++ locales/lt/plugins.po	(revision 1668)
@@ -1024,14 +1024,14 @@
 msgstr "Peržiūrėti puslapį"
 
-msgid "Page status:"
+msgid "Page status"
 msgstr "Puslapio statusas:"
 
-msgid "Page position:"
+msgid "Page position"
 msgstr "Puslapio pozicija:"
 
-msgid "Page lang:"
+msgid "Page lang"
 msgstr "Puslapio kalba:"
 
-msgid "Page password:"
+msgid "Page password"
 msgstr "Puslapio slaptažodis:"
 
Index: locales/nl/plugins.po
===================================================================
--- locales/nl/plugins.po	(revision 1636)
+++ locales/nl/plugins.po	(revision 1668)
@@ -1057,14 +1057,14 @@
 msgstr ""
 
-msgid "Page status:"
-msgstr ""
-
-msgid "Page position:"
-msgstr ""
-
-msgid "Page lang:"
-msgstr ""
-
-msgid "Page password:"
+msgid "Page status"
+msgstr ""
+
+msgid "Page position"
+msgstr ""
+
+msgid "Page lang"
+msgstr ""
+
+msgid "Page password"
 msgstr ""
 
Index: locales/oc/plugins.po
===================================================================
--- locales/oc/plugins.po	(revision 1636)
+++ locales/oc/plugins.po	(revision 1668)
@@ -1056,14 +1056,14 @@
 msgstr ""
 
-msgid "Page status:"
-msgstr ""
-
-msgid "Page position:"
-msgstr ""
-
-msgid "Page lang:"
-msgstr ""
-
-msgid "Page password:"
+msgid "Page status"
+msgstr ""
+
+msgid "Page position"
+msgstr ""
+
+msgid "Page lang"
+msgstr ""
+
+msgid "Page password"
 msgstr ""
 
Index: locales/pl/plugins.po
===================================================================
--- locales/pl/plugins.po	(revision 1636)
+++ locales/pl/plugins.po	(revision 1668)
@@ -1061,14 +1061,14 @@
 msgstr ""
 
-msgid "Page status:"
+msgid "Page status"
 msgstr "Stan strony:"
 
-msgid "Page position:"
+msgid "Page position"
 msgstr "Pozycja strony:"
 
-msgid "Page lang:"
+msgid "Page lang"
 msgstr "Język strony:"
 
-msgid "Page password:"
+msgid "Page password"
 msgstr "Hasło strony"
 
Index: locales/pt-br/plugins.po
===================================================================
--- locales/pt-br/plugins.po	(revision 1636)
+++ locales/pt-br/plugins.po	(revision 1668)
@@ -1056,14 +1056,14 @@
 msgstr ""
 
-msgid "Page status:"
-msgstr ""
-
-msgid "Page position:"
-msgstr ""
-
-msgid "Page lang:"
-msgstr ""
-
-msgid "Page password:"
+msgid "Page status"
+msgstr ""
+
+msgid "Page position"
+msgstr ""
+
+msgid "Page lang"
+msgstr ""
+
+msgid "Page password"
 msgstr ""
 
Index: locales/pt/plugins.po
===================================================================
--- locales/pt/plugins.po	(revision 1636)
+++ locales/pt/plugins.po	(revision 1668)
@@ -1073,14 +1073,14 @@
 msgstr ""
 
-msgid "Page status:"
+msgid "Page status"
 msgstr "Estatutos da página:"
 
-msgid "Page position:"
+msgid "Page position"
 msgstr "Posição da página:"
 
-msgid "Page lang:"
+msgid "Page lang"
 msgstr "Língua da página:"
 
-msgid "Page password:"
+msgid "Page password"
 msgstr "Senha da página:"
 
Index: locales/ro/plugins.po
===================================================================
--- locales/ro/plugins.po	(revision 1636)
+++ locales/ro/plugins.po	(revision 1668)
@@ -1068,14 +1068,14 @@
 msgstr ""
 
-msgid "Page status:"
-msgstr ""
-
-msgid "Page position:"
-msgstr ""
-
-msgid "Page lang:"
-msgstr ""
-
-msgid "Page password:"
+msgid "Page status"
+msgstr ""
+
+msgid "Page position"
+msgstr ""
+
+msgid "Page lang"
+msgstr ""
+
+msgid "Page password"
 msgstr ""
 
Index: locales/ru/plugins.po
===================================================================
--- locales/ru/plugins.po	(revision 1636)
+++ locales/ru/plugins.po	(revision 1668)
@@ -1064,14 +1064,14 @@
 msgstr ""
 
-msgid "Page status:"
+msgid "Page status"
 msgstr "Статус страницы:"
 
-msgid "Page position:"
+msgid "Page position"
 msgstr "Позиция страницы:"
 
-msgid "Page lang:"
+msgid "Page lang"
 msgstr "Язык страницы:"
 
-msgid "Page password:"
+msgid "Page password"
 msgstr "Пароль страницы:"
 
Index: locales/sr/plugins.po
===================================================================
--- locales/sr/plugins.po	(revision 1636)
+++ locales/sr/plugins.po	(revision 1668)
@@ -1056,14 +1056,14 @@
 msgstr ""
 
-msgid "Page status:"
-msgstr ""
-
-msgid "Page position:"
-msgstr ""
-
-msgid "Page lang:"
-msgstr ""
-
-msgid "Page password:"
+msgid "Page status"
+msgstr ""
+
+msgid "Page position"
+msgstr ""
+
+msgid "Page lang"
+msgstr ""
+
+msgid "Page password"
 msgstr ""
 
Index: locales/sv/plugins.po
===================================================================
--- locales/sv/plugins.po	(revision 1636)
+++ locales/sv/plugins.po	(revision 1668)
@@ -1056,14 +1056,14 @@
 msgstr ""
 
-msgid "Page status:"
-msgstr ""
-
-msgid "Page position:"
-msgstr ""
-
-msgid "Page lang:"
-msgstr ""
-
-msgid "Page password:"
+msgid "Page status"
+msgstr ""
+
+msgid "Page position"
+msgstr ""
+
+msgid "Page lang"
+msgstr ""
+
+msgid "Page password"
 msgstr ""
 
Index: locales/te/plugins.po
===================================================================
--- locales/te/plugins.po	(revision 1636)
+++ locales/te/plugins.po	(revision 1668)
@@ -1061,14 +1061,14 @@
 msgstr ""
 
-msgid "Page status:"
+msgid "Page status"
 msgstr "పేజీ స్థితి:"
 
-msgid "Page position:"
+msgid "Page position"
 msgstr "పేజీ స్థానం:"
 
-msgid "Page lang:"
+msgid "Page lang"
 msgstr "పేజీ భాష:"
 
-msgid "Page password:"
+msgid "Page password"
 msgstr "పేజీ సంకేతపదం:"
 
Index: locales/tr/plugins.po
===================================================================
--- locales/tr/plugins.po	(revision 1636)
+++ locales/tr/plugins.po	(revision 1668)
@@ -1061,14 +1061,14 @@
 msgstr ""
 
-msgid "Page status:"
-msgstr ""
-
-msgid "Page position:"
-msgstr ""
-
-msgid "Page lang:"
-msgstr ""
-
-msgid "Page password:"
+msgid "Page status"
+msgstr ""
+
+msgid "Page position"
+msgstr ""
+
+msgid "Page lang"
+msgstr ""
+
+msgid "Page password"
 msgstr ""
 
Index: locales/zh-cn/plugins.po
===================================================================
--- locales/zh-cn/plugins.po	(revision 1636)
+++ locales/zh-cn/plugins.po	(revision 1668)
@@ -1071,14 +1071,14 @@
 msgstr ""
 
-msgid "Page status:"
+msgid "Page status"
 msgstr "页面状态："
 
-msgid "Page position:"
+msgid "Page position"
 msgstr "页面位置："
 
-msgid "Page lang:"
+msgid "Page lang"
 msgstr "页面语言："
 
-msgid "Page password:"
+msgid "Page password"
 msgstr "页面密码："
 
Index: plugins/pages/_public.php
===================================================================
--- plugins/pages/_public.php	(revision 1179)
+++ plugins/pages/_public.php	(revision 1674)
@@ -181,4 +181,7 @@
 				
 				# The entry
+				if ($_ctx->posts->trackbacksActive()) {
+					header('X-Pingback: '.$core->blog->url.$core->url->getURLFor("xmlrpc",$core->blog->id));
+				}
 				$core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates');
 				self::serveDocument('page.html');
Index: plugins/pages/default-templates/page.html
===================================================================
--- plugins/pages/default-templates/page.html	(revision 725)
+++ plugins/pages/default-templates/page.html	(revision 1674)
@@ -25,4 +25,5 @@
   <link rel="top" href="{{tpl:BlogURL}}" title="{{tpl:lang Home}}" />
   <link rel="contents" href="{{tpl:BlogArchiveURL}}" title="{{tpl:lang Archives}}" />
+  <tpl:EntryIf pings_active="1"><link rel="pingback" href="{{tpl:BlogXMLRPCURL}}" /></tpl:EntryIf>
   
   <link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="{{tpl:BlogFeedURL type="atom"}}" />
Index: plugins/pages/page.php
===================================================================
--- plugins/pages/page.php	(revision 1711)
+++ plugins/pages/page.php	(revision 1713)
@@ -403,5 +403,5 @@
 			'items' => array(
 				'post_status' => 
-					'<p><label for="post_status" class="ib">'.__('Page status:').'</label> '.
+					'<p><label for="post_status" class="ib">'.__('Page status').'</label> '.
 					form::combo('post_status',$status_combo,$post_status,'','',!$can_publish).
 					'</p>',
@@ -411,5 +411,5 @@
 					'</p>',
 				'post_lang' =>
-					'<p><label for="post_lang" class="ib">'.__('Page lang:').'</label>'.
+					'<p><label for="post_lang" class="ib">'.__('Page lang').'</label>'.
 					form::combo('post_lang',$lang_combo,$post_lang).
 					'</p>',
@@ -426,5 +426,5 @@
 			'items' => array(
 				'post_position' => 
-					'<p><label for="post_position" class="classic">'.__('Page position:').'</label> '.
+					'<p><label for="post_position" class="classic">'.__('Page position').'</label> '.
 					form::field('post_position',3,3,(string) $post_position).
 					'</p>')),
Index: plugins/widgets/dragdrop.js
===================================================================
--- plugins/widgets/dragdrop.js	(revision 0)
+++ plugins/widgets/dragdrop.js	(revision 1659)
@@ -1,211 +1,98 @@
-ToolMan._coordinatesFactory.inside = function(item,container) {
-	var iTL = this.topLeftOffset(item);
-	var iBR = this.bottomRightOffset(item);
-	var cTL = this.topLeftOffset(container);
-	var cBR = this.bottomRightOffset(container);
+/*
+# -- BEGIN LICENSE BLOCK ---------------------------------------
+#
+# This file is part of Dotclear 2.
+#
+# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
+# Licensed under the GPL version 2.0 license.
+# See LICENSE file or
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+#
+# -- END LICENSE BLOCK -----------------------------------------
+*/
+
+$(function() {
 	
-	return (iTL.x >= cTL.x && iTL.x <= cBR.x && iTL.y >= cTL.y && iTL.y <= cBR.y)
-	|| (iBR.x >= cTL.x && iBR.x <= cBR.x && iBR.y >= cTL.y && iBR.y <= cBR.y);
-}
-
-ToolMan._dragdropFactory = {
-	firstContainer: null,
-	lastContainer: null,
+	// clean
+	$('.remove-if-drag').remove();
+	$('.hidden-if-drag').hide();
+	$('.widgets, .sortable-delete').addClass('if-drag');
 	
-	makeDragable: function(item) {
-		var group = ToolMan.drag().createSimpleGroup(item);
-		group.register('dragstart',this._onDragStart);
-		group.register('dragmove', this._onDragMove);
-		group.register('dragend', this._onDragEnd);
-		
-		item.isOutside = false;
-		item.started = false;
-		
-		return group;
-	},
-	
-	makeListContainer: function(list,name) {
-		// each container becomes a linked list node
-		if (this.firstContainer == null) {
-			this.firstContainer = this.lastContainer = list;
-			list.previousContainer = null;
-			list.nextContainer = null;
-		} else {
-			list.previousContainer = this.lastContainer;
-			list.nextContainer = null;
-			this.lastContainer.nextContainer = list;
-			this.lastContainer = list;
-		}
-		
-		var helpers = ToolMan.helpers();
-		var coordinates = ToolMan.coordinates();
-		
-		//var children = list.childNodes;
-		var items = new Array();
-		for (var i=0; i<list.childNodes.length; i++) {
-			if (list.childNodes[i].nodeType == 1 &&
-			list.childNodes[i].nodeName.toLowerCase() == name.toLowerCase()) {
-				items.push(list.childNodes[i]);
-			}
-		}
-		
-		// these functions are called when an item is draged over
-		// a container or out of a container bounds.  onDragOut
-		// is also called when the drag ends with an item having
-		// been added to the container
-		list.onDragOver = new Function();
-		list.onDragOut = new Function();
-		list.onDragEnd = new Function();
-		
-		if (list.factory == undefined) {
-			list.factory = false;
-		}
-		
-		var This = this;
-		helpers.map(items, function(item) {
-			var dragGroup = This.makeDragable(item);
-			dragGroup.setThreshold(4);
-		});
-		for (var i = 2, n = arguments.length; i < n; i++) {
-			helpers.map(items, arguments[i]);
-		}
-	},
-	
-	_onDragStart: function(dragEvent) {
-		var container = ToolMan._dragdropFactory.firstContainer;
-		var item = dragEvent.group.element;
-		var coordinates = ToolMan.coordinates();
-		
-		// Factory is a sort of assembly pieces, we want to keep them
-		if (item.parentNode.factory) {
-			var origin = item.cloneNode(true);
-			item.parentNode.insertBefore(origin,item.nextSibling);
-			ToolMan._dragdropFactory.makeDragable(origin);
-		}
-		
-		while (container != null) {
-			container.topLeft = coordinates.topLeftOffset(container);
-			container.bottomRight = coordinates.bottomRightOffset(container);
-			container = container.nextContainer;
-		}
-		
-		// item starts out over current parent
-		item.started = true;
-		item.parentNode.onDragOver();
-	},
-	
-	_onDragMove: function(dragEvent) {
-		var helpers = ToolMan.helpers();
-		var coordinates = ToolMan.coordinates();
-		
-		var item = dragEvent.group.element;
-		var xmouse = dragEvent.transformedMouseOffset;
-		var moveTo = null;
-		
-		// Check if we are nowhere
-		if (item.isOutside) {
-			var container = ToolMan._dragdropFactory.firstContainer;
-			while (container != null) {
-				if (coordinates.inside(item,container) && !container.factory) {
-					container.onDragOver();
-					item.isOutside = false;
-					
-					// since isOutside was true, the current parent is a
-					// temporary clone of some previous container node and
-					// it needs to be removed from the document
-					var tempParent = item.parentNode;
-					tempParent.removeChild(item);
-					container.appendChild(item);
-					//tempParent.parentNode.removeChild(tempParent);
-					
-					break;
-				}
-				container = container.nextContainer;
+	// move
+	$( ".connected, .sortable-delete" ).sortable({
+		tolerance: "move",
+		cursor: "move",
+		axis: "y",
+		dropOnEmpty: true,
+		handle: ".widget-name",
+		placeholder: "ui-sortable-placeholder",
+		items: "li:not(.sortable-delete-placeholder)",
+		connectWith: ".connected, .sortable-delete",
+		start: function( event, ui ) {
+			// petit décalage éstétique
+			ui.item.css('left', ui.item.position().left + 20);
+		},
+		update: function(event, ui) {
+			
+			ul = $(this);
+			widget = ui.item;
+			field = ul.parents('.widgets');
+			
+			// met a zéro le décalage
+			ui.item.css('left', 'auto');
+			
+			// signale les zone vide
+			if( ul.find('li').length == 0 )
+				 field.find('.empty-widgets').show();
+			else field.find('.empty-widgets').hide();
+			
+			// remove
+			if( widget.parents('ul').is('.sortable-delete') ) {
+				widget.hide('slow', function() {
+					$(this).remove();
+				});
 			}
 			
-			if (this.isOutside) {
-				return;
+			// réordonne
+			if( ul.attr('id') ) {
+				ul.find('li').each(function(i) {
+					
+					// trouve la zone de récéption
+					var name = ul.attr('id').split('dnd').join('');
+					
+					// modifie le name en conséquence
+					$(this).find('*[name^=w]').each(function(){
+						tab = $(this).attr('name').split('][');
+						tab[0] = "w["+name;
+						tab[1] = i;
+						$(this).attr('name', tab.join(']['));
+					});
+					
+					// ainssi que le champ d'ordre sans js (au cas ou)
+					$(this).find('input[title=ordre]').val(i);
+					
+				});
 			}
+			
+			// expand
+			if(widget.find('img.expand').length == 0) {
+				dotclear.postExpander(widget);
+				dotclear.viewPostContent(widget, 'close');
+			}
+			
 		}
-		// Outside the parent node
-		else if (!coordinates.inside(item,item.parentNode)) {
-			item.parentNode.onDragOut();
-			item.isOutside = true;
-			var container = ToolMan._dragdropFactory.firstContainer;
-			while (container != null) {
-				if (coordinates.inside(item,container) && !container.factory) {
-					container.onDragOver();
-					item.isOutside = false;
-					container.appendChild(item);
-					break;
-				}
-				container = container.nextContainer;
-			}
-			// if we're not in any container now, make a temporary clone of
-			// the previous container node and add it to the document
-			if (this.isOutside) {
-				var tempParent = item.parentNode.cloneNode(false);
-				item.parentNode.removeChild(item);
-				tempParent.appendChild(item);
-				document.body.appendChild(tempParent);
-				return;
-			}
+	});
+	
+	// add
+	$( "#widgets-ref > li" ).draggable({
+		tolerance: "move",
+		cursor: "move",
+		connectToSortable: ".connected",
+		helper: "clone",
+		revert: "invalid",
+		start: function( event, ui ) {
+			ui.helper.css({'width': $('#widgets-ref > li').css('width')});
 		}
-		
-		// if we get here, we're inside some container bounds, so we do
-		// everything the original dragsort script did to swap us into the
-		// correct position
-		
-		if (item.parentNode.factory) {
-			return;
-		}
-		
-		var moveTo = null
-		
-		var previous = helpers.previousItem(item, item.nodeName)
-		while (previous != null) {
-			var bottomRight = coordinates.bottomRightOffset(previous)
-			if (xmouse.y <= bottomRight.y && xmouse.x <= bottomRight.x) {
-				moveTo = previous
-			}
-			previous = helpers.previousItem(previous, item.nodeName)
-		}
-		if (moveTo != null) {
-			helpers.moveBefore(item, moveTo)
-			return
-		}
-		
-		var next = helpers.nextItem(item, item.nodeName)
-		while (next != null) {
-			var topLeft = coordinates.topLeftOffset(next)
-			if (topLeft.y <= xmouse.y && topLeft.x <= xmouse.x) {
-				moveTo = next
-			}
-			next = helpers.nextItem(next, item.nodeName)
-		}
-		if (moveTo != null) {
-			helpers.moveBefore(item, helpers.nextItem(moveTo, item.nodeName))
-			return
-		}
-	},
+	});
 	
-	_onDragEnd: function(dragEvent) {
-		var item = dragEvent.group.element;
-		
-		if (!item.started) {
-			return;
-		}
-		
-		if (item.isOutside || item.parentNode.factory) {
-			item.parentNode.removeChild(item);
-			return;
-		}
-		
-		item.parentNode.onDragEnd.call(item);
-		ToolMan.coordinates().create(0, 0).reposition(dragEvent.group.element);
-	}
-};
-
-ToolMan.dragdrop = function() {
-	return ToolMan._dragdropFactory;
-};
+});
Index: plugins/widgets/index.php
===================================================================
--- plugins/widgets/index.php	(revision 1518)
+++ plugins/widgets/index.php	(revision 1669)
@@ -165,9 +165,9 @@
   <?php echo file_get_contents(dirname(__FILE__).'/style.css'); ?>
   </style>
-  <script type="text/javascript" src="js/tool-man/core.js"></script>
-  <script type="text/javascript" src="js/tool-man/events.js"></script>
-  <script type="text/javascript" src="js/tool-man/css.js"></script>
-  <script type="text/javascript" src="js/tool-man/coordinates.js"></script>
-  <script type="text/javascript" src="js/tool-man/drag.js"></script>
+  <?php
+		echo
+			dcPage::jsLoad('js/jquery/jquery-ui.custom.js').
+			dcPage::jsLoad('index.php?pf=widgets/widgets.js');
+  ?>
   <?php 
 	$core->auth->user_prefs->addWorkspace('accessibility'); 
@@ -177,5 +177,4 @@
   <script type="text/javascript" src="index.php?pf=widgets/dragdrop.js"></script>
   <?php endif; ?>
-  <script type="text/javascript" src="index.php?pf=widgets/widgets.js"></script>
   <script type="text/javascript">
   //<![CDATA[
@@ -199,23 +198,23 @@
 '<h3>'.__('Available widgets').'</h3>'.
 '<p>'.__('Move widgets from this list to one of the sidebars.').'</p>'.
-'<div id="widgets">';
+'<ul id="widgets-ref">';
 
 $j = 0;
 foreach ($__widgets->elements(true) as $w) {
 	echo
-	'<div>'.form::hidden(array('w[void][0][id]'),html::escapeHTML($w->id())).
-	'<p class="widget-name">'.form::field(array('w[void][0][order]'),2,3,0,'hideControl').' '.
-	$w->name().($w->desc() != '' ? ' <span class="form-note">'.__($w->desc()).'</span>' : '').'</p>'.
-	'<p class="js-remove"><label class="classic">'.__('Append to:').'</label> '.
+	'<li>'.form::hidden(array('w[void][0][id]'),html::escapeHTML($w->id())).
+	'<p class="widget-name">'.form::field(array('w[void][0][order]'),2,3,0,'hide','',0,'title="'.__('order').'"').' '.$w->name().
+	($w->desc() != '' ? ' <span class="form-note">'.__($w->desc()).'</span>' : '').'</p>'.
+	'<p class="manual-move remove-if-drag"><label class="classic">'.__('Append to:').'</label> '.
 	form::combo(array('addw['.$w->id().']'),$append_combo).'</p>'.
-	'<div class="widgetSettings">'.$w->formSettings('w[void][0]',$j).'</div>'.
-	'</div>';
+	'<div class="widgetSettings hidden-if-drag">'.$w->formSettings('w[void][0]',$j).'</div>'.
+	'</li>';
 	$j++;
 }
 
 echo
-'</div>'.
-'<p><input type="submit" class="js-remove" name="append" value="'.__('Add widgets to sidebars').'" />'.
-$core->formNonce().'</p>'.
+'</ul>'.
+$core->formNonce().
+'<p class="remove-if-drag"><input type="submit" name="append" value="'.__('Add widgets to sidebars').'" /></p>'.
 '</form>';
 
@@ -224,18 +223,18 @@
 echo
 '<div id="sidebarNav" class="widgets fieldset">'.
-sidebarWidgets('dndnav',__('Navigation sidebar'),$widgets_nav,'nav',$__default_widgets['nav'],$j).
-'</div>';
+sidebarWidgets('dndnav',__('Navigation sidebar'),$widgets_nav,'nav',$__default_widgets['nav'],$j);
+echo '</div>';
 
 # Extra sidebar
 echo
 '<div id="sidebarExtra" class="widgets fieldset">'.
-sidebarWidgets('dndextra',__('Extra sidebar'),$widgets_extra,'extra',$__default_widgets['extra'],$j).
-'</div>';
+sidebarWidgets('dndextra',__('Extra sidebar'),$widgets_extra,'extra',$__default_widgets['extra'],$j);
+echo '</div>';
 
 # Custom sidebar
 echo
 '<div id="sidebarCustom" class="widgets fieldset">'.
-sidebarWidgets('dndcustom',__('Custom sidebar'),$widgets_custom,'custom',$__default_widgets['custom'],$j).
-'</div>';
+sidebarWidgets('dndcustom',__('Custom sidebar'),$widgets_custom,'custom',$__default_widgets['custom'],$j);
+echo '</div>';
 
 echo
@@ -316,5 +315,5 @@
 function sidebarWidgets($id,$title,$widgets,$pr,$default_widgets,&$j)
 {
-	$res = '<h3>'.$title.'</h3><div id="'.$id.'">';
+	$res = '<h3>'.$title.'</h3>';
 	
 	if (!($widgets instanceof dcWidgets))
@@ -323,7 +322,7 @@
 	}
 	
-	if ($widgets->isEmpty()) {
-		$res .= '<p class="empty-widgets">'.__('No widget.').'</p>';
-	}
+	$res .= '<p class="empty-widgets" '.(!$widgets->isEmpty() ? 'style="display: none;"' : '').'>'.__('No widget.').'</p>';
+	
+	$res .= '<ul id="'.$id.'" class="connected">';
 	
 	$i = 0;
@@ -333,12 +332,12 @@
 		
 		$res .=
-		'<div>'.form::hidden(array($iname.'[id]'),html::escapeHTML($w->id())).
-		'<p class="widget-name">'.form::field(array($iname.'[order]'),2,3,(string) $i,'js-hide','',0,'title="'.__('order').'"').' '.
-		$w->name().($w->desc() != '' ? ' <!-- <span class="form-note">'.__($w->desc()).'</span> -->' : '').'</p>'.
-		'<p class="removeWidget js-remove"><label class="classic">'.
+		'<li>'.form::hidden(array($iname.'[id]'),html::escapeHTML($w->id())).
+		'<p class="widget-name">'.form::field(array($iname.'[order]'),2,3,(string) $i,'hidden-if-drag','',0,'title="'.__('order').'"').' '.$w->name().
+		($w->desc() != '' ? ' <span class="form-note">'.__($w->desc()).'</span>' : '').'</p>'.
+		'<p class="removeWidget remove-if-drag"><label class="classic">'.
 		form::checkbox(array($iname.'[_rem]'),'1',0).' '.__('Remove widget').
 		'</label></p>'.
-		'<div class="widgetSettings">'.$w->formSettings($iname,$j).'</div>'.
-		'</div>';
+		'<div class="widgetSettings hidden-if-drag">'.$w->formSettings($iname,$j).'</div>'.
+		'</li>';
 		
 		$i++;
@@ -346,5 +345,10 @@
 	}
 	
-	$res .= '</div>';
+	$res .= '</ul>';
+
+	if ($i > 0) {
+		$res .= '<ul class="sortable-delete"><li class="sortable-delete-placeholder">'.
+			__('Drag widgets here to remove them from this sidebar.').'</li></ul>';
+	}
 	
 	return $res;
Index: plugins/widgets/style.css
===================================================================
--- plugins/widgets/style.css	(revision 1629)
+++ plugins/widgets/style.css	(revision 1669)
@@ -1,2 +1,115 @@
+/*
+# -- BEGIN LICENSE BLOCK ---------------------------------------
+#
+# This file is part of Dotclear 2.
+#
+# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
+# Licensed under the GPL version 2.0 license.
+# See LICENSE file or
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+#
+# -- END LICENSE BLOCK -----------------------------------------
+*/
+
+
+/* ------------------------------------------------------------- side bars */
+#sidebarsWidgets {
+	float: left;
+	width: 47%;
+	margin: 0 0 0 1%;
+	padding: 0 1%;
+}
+.widgets.fieldset {
+	margin-bottom: 2em;
+}
+.widgets.fieldset.if-drag {
+	padding-bottom: 0;
+	border-radius: .5em;
+}
+#dndnav, #dndextra, #dndcustom {
+	padding: 1em 0;
+	margin: 1em 0 0;
+}
+#dndnav > li,
+#dndextra > li,
+#dndcustom > li {
+	padding: 0;
+	border: 1px solid #999;
+	margin-bottom: 1em;
+	list-style: none;
+}
+#dndnav > li.ui-sortable-placeholder,
+#dndextra > li.ui-sortable-placeholder,
+#dndcustom > li.ui-sortable-placeholder,
+.sortable-delete > li.ui-sortable-placeholder {
+	border: 1px dashed #999;
+	height: 2em;
+	padding: .3em;
+}
+.sortable-delete > li.ui-sortable-placeholder {
+	border-width: 2px;
+	border-color: red;
+}
+.sortable-delete {
+	display: none;
+}
+.sortable-delete.if-drag {
+    border: 1px dotted #999;
+    color: #000;
+    font-weight: bold;
+    list-style-type: none;
+    margin: 0 0 1em;
+    padding: .5em 1em;
+    display: block;
+    background: #fafafa;
+}
+.sortable-delete > li {
+	margin-bottom: 3px;
+}
+.sortable-delete > li.sortable-delete-placeholder {
+    border: 0 none;
+    color: #aaa;
+    font-size: 1em;
+    font-weight: bold;
+    text-align: center;
+}
+.widget-name {
+	background: #eef;
+	color: #000;
+	padding: 4px 6px;
+	margin: 0;
+	font-weight: bold;
+}
+.widget-name img {
+	cursor: pointer;
+	margin-bottom: -1px;
+}
+.widget-name a.aexpand,
+.widget-name a.aexpand:link,
+.widget-name a.aexpand:visited {
+    border: 0 none;
+    color: #000;
+    text-decoration: none;
+}
+#dndnav .form-note,
+#dndextra .form-note,
+#dndcustom .form-note {
+	display: none;
+}
+.removeWidget {
+	padding: 8px 6px;
+	margin: 0;
+}
+.widgetSettings {
+	border-top: 1px solid #ddd;
+	padding: 8px 6px;
+	background: #f5f5f5;
+}
+
+#sidebarsControl {
+	clear: left;
+}
+
+/* ------------------------------------------------------------- list Widgets ref */
 #listWidgets {
 	float: left;
@@ -6,5 +119,13 @@
 	margin: 0 1% 0 0;
 }
-#widgets > div {
+#listWidgets h3 {
+	color: #333;
+}
+
+#widgets-ref {
+	padding: 1em 0;
+	margin: 1em 0 0;
+}
+#widgets-ref > li {
 	border: 1px solid #ccc;
 	margin-bottom: .5em;
@@ -12,80 +133,25 @@
 	min-height: 3em;
 	padding: 0 0 4px 0;
+	list-style: none;
 }
-#widgets .widget-name, #widgets .js-remove {
+#widgets-ref .widget-name,
+#widgets-ref .manual-move {
 	background: #fff;
 	margin-bottom: 0;
-	padding: 4px 8px; 
+	padding: 4px 8px 0;
 }
-#widgets .widget-name {
+#widgets-ref .widget-name {
 	min-height: 3em;
-	padding-bottom: 0;
 }
-#listWidgets h3 {
-	color: #333;
-}
-
-#sidebarsWidgets {
-	float: left;
-	width: 47%;
-	margin: 0 0 0 1%;
-	padding: 0 1%;
-}
-#sidebarsControl {
-	clear: left;
-}
-.widgets.fieldset {
-	margin-bottom: 2em;
-}
-#widgets, #dndnav, #dndextra, #dndcustom {
-	padding: 1em 0;
-}
-#dndnav > div, #dndextra > div, #dndcustom > div {
-	padding: O;
-	border: 1px solid #999;
-	margin-bottom: 1em;
-}
-
-.widget-name {
-	background: #eef;
-	color: #000;
-	padding: 4px 6px;
-	margin: 0;
-	font-weight: bold;
-}
-.widget-name span {
+#widgets-ref .widget-name .form-note {
 	display: block;
 	font-style: normal;
 	font-size: 1.1rem;
 }
-.widget-name img {
-	cursor: pointer;
-	margin-bottom: -1px;
-}
-.widget-name a.aexpand, .widget-name a.aexpand:link, .widget-name a.aexpand:visited {
-    border: 0 none;
-    color: #000000;
-    text-decoration: none;
-}
-.removeWidget {
-	padding: 8px 6px;
-	margin: 0;
-}
-
-.widgetSettings {
-	border-top: 1px solid #ddd;
-	padding: 8px 6px;
-	background: #f5f5f5;
-}
-#widgets .widgetSettings {
-	display: none;
-}
-.hideControls .widgetSettings {
-	display: none;
-}
-.hideControl {
+#widgets-ref .widgetSettings {
 	display: none;
 }
 
+/* ------------------------------------------------------------- help */
 #widgets-tpl dt {
 	margin: 1em 0 0 0;
Index: plugins/widgets/widgets.js
===================================================================
--- plugins/widgets/widgets.js	(revision 1629)
+++ plugins/widgets/widgets.js	(revision 1661)
@@ -1,234 +1,71 @@
-var dragdrop = ToolMan.dragdrop();
-$(function() {
+/*
+# -- BEGIN LICENSE BLOCK ---------------------------------------
+#
+# This file is part of Dotclear 2.
+#
+# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
+# Licensed under the GPL version 2.0 license.
+# See LICENSE file or
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+#
+# -- END LICENSE BLOCK -----------------------------------------
+*/
+
+dotclear.postExpander = function(line) {
+	var title = $(line).find('.widget-name');
+	title.find('.form-note').remove();
+	order = title.find('input[name*=order]');
+	link = $('<a href="#" alt="expand" class="aexpand"/>').append(title.text());
+	title.empty().append(order).append(link);
+	
+	var img = document.createElement('img');
+	img.src = dotclear.img_plus_src;
+	img.alt = dotclear.img_plus_alt;
+	img.className = 'expand';
+	$(img).css('cursor','pointer');
+	img.onclick = function() { dotclear.viewPostContent($(this).parents('li')); };
+	link.click(function(e) {
+		e.preventDefault();
+		dotclear.viewPostContent($(this).parents('li'));
+	});
+	
+	title.prepend(img);
+};
+
+dotclear.viewPostContent = function(line,action) {
+	var action = action || 'toogle';
+	var img = line.find('.expand');
+	var isopen = img.attr('alt') == dotclear.img_plus_alt;
+	
+	if( action == 'close' || ( action == 'toogle' && !isopen ) ) {
+		line.find('.widgetSettings').hide();
+		img.attr('src', dotclear.img_plus_src);
+		img.attr('alt', dotclear.img_plus_alt);
+	} else if ( action == 'open' || ( action == 'toogle' && isopen ) ) {
+		line.find('.widgetSettings').show();
+		img.attr('src', dotclear.img_minus_src);
+		img.attr('alt', dotclear.img_minus_alt);
+	}
+	
+};
+
+$(function() {	
+	// reset
 	$('input[name="wreset"]').click(function() {
 		return window.confirm(dotclear.msg.confirm_widgets_reset);
 	});
+	
+	// plier/déplier
+	$('#dndnav > li, #dndextra > li, #dndcustom > li').each(function() {
+		dotclear.postExpander(this);
+		dotclear.viewPostContent($(this), 'close');
+	});
+	
+	// remove
+	$('input[name*=rem]').change(function () {
+	    if ($(this).attr("checked")) {
+	        $(this).parents('li').remove();
+	    }
+	});
+	
 });
-
-$(function() {
-	var widgets = document.getElementById('widgets');
-	var w_nav = document.getElementById('dndnav');
-	var w_ext = document.getElementById('dndextra');
-	var w_custom = document.getElementById('dndcustom');
-	
-	w_nav.className = 'hideControls';
-	w_ext.className = 'hideControls';
-	w_custom.className = 'hideControls';
-	
-	removeElements(document.getElementById('listWidgets'),'input');
-	removeElements(widgets,'p');
-	removeElements(w_nav,'p');
-	removeElements(w_ext,'p');
-	removeElements(w_custom,'p');
-	hideElements(w_nav,'input');
-	hideElements(w_ext,'input');
-	hideElements(w_custom,'input');
-	
-	configControls(w_nav);
-	configControls(w_ext);
-	configControls(w_custom);
-	
-	dragdrop.makeListContainer(widgets,'div',setHandle);
-	if (!document.all) { widgets.factory = true; }
-	dragdrop.makeListContainer(w_nav,'div',setHandle);
-	w_nav.onDragEnd = navDragEnd;
-	dragdrop.makeListContainer(w_ext,'div',setHandle);
-	w_ext.onDragEnd = extraDragEnd;
-	dragdrop.makeListContainer(w_custom,'div',setHandle);
-	w_custom.onDragEnd = customDragEnd;
-	
-	// Helper to remove some elements
-	function removeElements(p,name) {
-		name = name || 'div';
-		$(p).find(name+'.js-remove').each(function() {
-			this.parentNode.removeChild(this);
-		});
-	}
-	
-	// Helper to hide elements (but keep them)
-	function hideElements(p,name) {
-		name = name || 'div';
-		$(p).find(name+'.js-hide').each(function() {
-			$(this).toggle();
-		});
-	}	
-	
-	function removeEmptyMsg(p) {
-		$(p).find('p.empty-widgets').each(function() {
-			this.parentNode.removeChild(this);
-		});
-	}
-	
-	// Events on dragEnd
-	function navDragEnd() {
-		formControls(this.parentNode,'nav');
-		configControls(this.parentNode);
-		removeEmptyMsg(this.parentNode);
-	}
-	function extraDragEnd() {
-		formControls(this.parentNode,'extra');
-		configControls(this.parentNode);
-		removeEmptyMsg(this.parentNode);
-	}
-	function customDragEnd() {
-		formControls(this.parentNode,'custom');
-		configControls(this.parentNode);
-		removeEmptyMsg(this.parentNode);
-	}
-	
-	// dragEnd helper
-	function formControls(e,pr) {
-		var items = new Array();
-		for (var i=0; i<e.childNodes.length; i++) {
-			if (e.childNodes[i].nodeType == 1 && e.childNodes[i].nodeName.toLowerCase() == 'div') {
-				items.push(e.childNodes[i]);
-			}
-		}
-		
-		var fields, itype;
-		var r = new RegExp('^w\[[a-z]+]\[[0-9]+][[](.+?)]$','');
-		for (i=0; i<items.length; i++) {
-			// Change field names
-			fields = getFormControls(items[i]);
-			var j;
-			var f;
-			for (j=0; j<fields.length; j++) {
-				if (r.test(fields[j].name)) {
-					itype = fields[j].name.replace(r,'$1');
-					
-					$(fields[j]).attr('name','w['+pr+']['+i+']['+itype+']');
-					
-					if (itype == 'order') {
-						fields[j].value = i;
-					}
-				}
-			}
-		}
-	}
-	
-	function getFormControls(e) {
-		var input = e.getElementsByTagName('input');
-		var textarea = e.getElementsByTagName('textarea');
-		var select = e.getElementsByTagName('select');
-		var items = new Array();
-		var i;
-		for (i=0; i<input.length; i++) { items.push(input[i]); }
-		for (i=0; i<select.length; i++) { items.push(select[i]); }
-		for (i=0; i<textarea.length; i++) { items.push(textarea[i]); }
-		
-		return items;
-	}
-	
-	function configControls(e) {
-		var items = new Array();
-		for (var i=0; i<e.childNodes.length; i++) {
-			if (e.childNodes[i].nodeType == 1 && e.childNodes[i].nodeName.toLowerCase() == 'div') {
-				items.push(e.childNodes[i]);
-			}
-		}
-		
-		var title, img_ctrl, img, space;
-		for (i in items) {
-			// Append config control
-			title = $('p.widget-name',items[i]).get(0);
-			order = $(title).find('input[name*=order]');
-			link = $('<a href="#" alt="expand" class="aexpand"/>').append($(title).text());
-			$(title).empty().append(order).append(link);
-			img_ctrl = title.firstChild;
-			
-			// There already an image
-			if (img_ctrl.nodeName.toLowerCase() == 'img') {
-				continue;
-			}
-			
-			// Nothing to configure
-			if (title.nextSibling.childNodes.length == 0) {
-				continue;
-			}
-			
-			img = document.createElement('img');
-			img.src = dotclear.img_plus_src;
-			img.alt = dotclear.img_plus_alt;
-			img.control = title.nextSibling;
-			img.onclick = function() { widgetConfig.call(this); };
-			link.click(function(e) {
-				e.preventDefault();
-				widgetConfig.call($(this).prevAll('img').get(0));
-			});
-			space = document.createTextNode(' ');
-			title.insertBefore(img,img_ctrl);
-			title.insertBefore(space,img_ctrl);
-		}
-	}
-	
-	function widgetConfig() {
-		if (this.control.style.display == 'block') {
-			this.control.style.display = 'none';
-			this.src = dotclear.img_plus_src;
-			this.alt = dotclear.img_plus_alt;
-		} else {
-			this.control.style.display = 'block';
-			this.src = dotclear.img_minus_src;
-			this.alt = dotclear.img_minus_alt;
-		}
-	}
-	
-	function setHandle(item) {
-		//var handle = item.getElementsByTagName('h4').item(0);
-		var handle = $('p.widget-name',item).get(0);
-		$(handle).addClass('handler');
-		item.toolManDragGroup.setHandle(handle);
-	}
-});
-
-//
-// For Safari, we need to make a hard copy of the form and submit copy.
-// Yeah, a simple clone of the form is not enough
-// I hate this browser!
-//
-if (document.childNodes && !document.all && !navigator.taintEnabled)
-{
-	$(function() {
-		$('#sidebarsWidgets').submit(function() {
-			// Create a new form and copy each element inside
-			var f = document.createElement('form');
-			f.action = this.action;
-			f.method = this.method;
-			$(f).hide();
-			var fset = document.createElement('fieldset');
-			f.appendChild(fset);
-			
-			document.body.appendChild(f);
-			
-			$(this).find('input').each(function() {
-				var i = document.createElement('input');
-				i.type = this.type;
-				i.name = this.name;
-				i.value = this.value;
-				if (this.type == 'checkbox') {
-					i.checked = this.checked;
-				}
-				fset.appendChild(i);
-			});
-			
-			$(this).find('textarea').each(function() {
-				var i = document.createElement('textarea');
-				i.name = this.name;
-				i.value = this.value;
-				fset.appendChild(i);
-			});
-			
-			$(this).find('select').each(function() {
-				var i = document.createElement('input');
-				i.name = this.name;
-				i.value = this.value;
-				fset.appendChild(i);
-			});
-			
-			$(fset).append('<input type="hidden" name="wup" value="1"/>');
-			f.submit();
-			
-			return false;
-		});
-	});
-}
