Index: plugins/attachments/js/post.js
===================================================================
--- plugins/attachments/js/post.js	(revision 1393)
+++ plugins/attachments/js/post.js	(revision 1606)
@@ -1,5 +1,6 @@
 $(function() {
 	$('h5.s-attachments').toggleWithLegend($('.s-attachments').not('h5'),{
-		cookie: 'dcx_attachments'
+		cookie: 'dcx_attachments',
+		legend_click: true
 	});
 });
Index: plugins/blowupConfig/index.php
===================================================================
--- plugins/blowupConfig/index.php	(revision 1553)
+++ plugins/blowupConfig/index.php	(revision 1588)
@@ -378,5 +378,4 @@
 '<p class="field"><label for="sidebar_link_f_c">'.__('Sidebar focus links color:').'</label> '.
 form::field('sidebar_link_f_c',7,7,$blowup_user['sidebar_link_f_c'],'colorpicker').'</p>'.
-'</fieldset>'.
 
 '<h4 class="border-top">'.__('Entries').'</h4>'.
Index: plugins/maintenance/locales/fr/help/maintenance.html
===================================================================
--- plugins/maintenance/locales/fr/help/maintenance.html	(revision 1573)
+++ plugins/maintenance/locales/fr/help/maintenance.html	(revision 1605)
@@ -8,8 +8,8 @@
 <dl>
   <dt>Optimiser l'espace de la base de données</dt>
-  <dd>Au fur at à mesure des suppressions ou modifications dans vos billets, les tables de la 
+  <dd>Au fur et à mesure des suppressions ou modifications dans vos billets, les tables de la 
   base de données se fragmentent. L'opération d'optimisation permet de compacter celles-ci.<br />
   Cette opération n'a aucun impact sur l'intégrité de vos données.<br />
-  Il est fortement conseillé d'optimiser la base de données avant tout export de blog</dd>
+  Il est fortement conseillé d'optimiser la base de données avant tout export de blog.</dd>
   
   <dt>Compteurs</dt>
Index: plugins/pings/post.js
===================================================================
--- plugins/pings/post.js	(revision 1365)
+++ plugins/pings/post.js	(revision 1606)
@@ -13,5 +13,6 @@
 		}
 		$('h5.ping-services').toggleWithLegend($('p.ping-services'),{
-			cookie: 'dcx_ping_services'
+			cookie: 'dcx_ping_services',
+			legend_click: true
 		});
 	});
Index: plugins/tags/js/post.js
===================================================================
--- plugins/tags/js/post.js	(revision 1392)
+++ plugins/tags/js/post.js	(revision 1606)
@@ -53,12 +53,13 @@
 				')</em>';
 			},
-			formatResult: function(tag) { 
-				return tag.result; 
+			formatResult: function(tag) {
+				return tag.result;
 			}
 		});
 	});
-			
+
 	$('h5 .s-tags').toggleWithLegend($('.s-tags').not('label'),{
-			cookie: 'post_tags'
+		cookie: 'post_tags',
+		legend_clik: true
 	});
 
Index: plugins/widgets/dragdrop.js
===================================================================
--- plugins/widgets/dragdrop.js	(revision 1651)
+++ plugins/widgets/dragdrop.js	(revision 0)
@@ -1,85 +1,211 @@
-$(function() {
-	
-	// clean
-	$('.js-remove').remove();
-	$('.js-hide').hide();
-	$('.widgetSettings').hide();
-	$('.widgets, .sortable-delete').addClass('drag');
-	
-	// move
-	$( ".connected, .sortable-delete" ).sortable({
-		tolerance: "move",
-		cursor: "move",
-		axis: "y",
-		dropOnEmpty: true,
-		handle: ".widget-name",
-		placeholder: "ui-sortable-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) {
+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);
+	
+	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,
+	
+	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;
+			}
 			
-			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();
-				});
-			}
-			
-			// 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');
-			}
-			
-		}
-	});
-	
-	// add
-	$( "#widgets > li" ).draggable({
-		tolerance: "move",
-		cursor: "move",
-		connectToSortable: ".connected",
-		helper: "clone",
-		revert: "invalid",
-		start: function( event, ui ) {
-			ui.helper.css({'width': $('#widgets > li').css('width')});
-		}
-	});
-	
-});
+			if (this.isOutside) {
+				return;
+			}
+		}
+		// 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;
+			}
+		}
+		
+		// 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 1650)
+++ plugins/widgets/index.php	(revision 1655)
@@ -165,6 +165,4 @@
   <?php echo file_get_contents(dirname(__FILE__).'/style.css'); ?>
   </style>
-	<script type="text/javascript" src="js/jquery/jquery-ui.custom.js"></script>
-  <script type="text/javascript" src="index.php?pf=widgets/widgets.js"></script>
   <?php 
 	$core->auth->user_prefs->addWorkspace('accessibility'); 
@@ -174,4 +172,5 @@
   <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[
@@ -195,23 +194,23 @@
 '<h3>'.__('Available widgets').'</h3>'.
 '<p>'.__('Move widgets from this list to one of the sidebars.').'</p>'.
-'<ul id="widgets">';
+'<div id="widgets">';
 
 $j = 0;
 foreach ($__widgets->elements(true) as $w) {
 	echo
-	'<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,'js-hide','',0,'title="'.__('order').'"').' '.$w->name().
-	($w->desc() != '' ? ' <span class="form-note">'.__($w->desc()).'</span>' : '').'</p>'.
+	'<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> '.
 	form::combo(array('addw['.$w->id().']'),$append_combo).'</p>'.
 	'<div class="widgetSettings">'.$w->formSettings('w[void][0]',$j).'</div>'.
-	'</li>';
+	'</div>';
 	$j++;
 }
 
 echo
-'</ul>'.
-$core->formNonce().
-'<p class="js-remove"><input type="submit" name="append" value="'.__('Add widgets to sidebars').'" /></p>'.
+'</div>'.
+'<p><input type="submit" class="js-remove" name="append" value="'.__('Add widgets to sidebars').'" />'.
+$core->formNonce().'</p>'.
 '</form>';
 
@@ -221,6 +220,5 @@
 '<div id="sidebarNav" class="widgets fieldset">'.
 sidebarWidgets('dndnav',__('Navigation sidebar'),$widgets_nav,'nav',$__default_widgets['nav'],$j).
-'</div>'.
-'<ul class="sortable-delete"></ul>';
+'</div>';
 
 # Extra sidebar
@@ -228,6 +226,5 @@
 '<div id="sidebarExtra" class="widgets fieldset">'.
 sidebarWidgets('dndextra',__('Extra sidebar'),$widgets_extra,'extra',$__default_widgets['extra'],$j).
-'</div>'.
-'<ul class="sortable-delete"></ul>';
+'</div>';
 
 # Custom sidebar
@@ -235,6 +232,5 @@
 '<div id="sidebarCustom" class="widgets fieldset">'.
 sidebarWidgets('dndcustom',__('Custom sidebar'),$widgets_custom,'custom',$__default_widgets['custom'],$j).
-'</div>'.
-'<ul class="sortable-delete"></ul>';
+'</div>';
 
 echo
@@ -315,5 +311,5 @@
 function sidebarWidgets($id,$title,$widgets,$pr,$default_widgets,&$j)
 {
-	$res = '<h3>'.$title.'</h3>';
+	$res = '<h3>'.$title.'</h3><div id="'.$id.'">';
 	
 	if (!($widgets instanceof dcWidgets))
@@ -324,9 +320,5 @@
 	if ($widgets->isEmpty()) {
 		$res .= '<p class="empty-widgets">'.__('No widget.').'</p>';
-	} else {
-		$res .= '<p class="empty-widgets" style="display: none;">'.__('No widget.').'</p>';
-	}
-	
-	$res .= '<ul id="'.$id.'" class="connected">';
+	}
 	
 	$i = 0;
@@ -336,12 +328,12 @@
 		
 		$res .=
-		'<li>'.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>'.
+		'<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">'.
 		form::checkbox(array($iname.'[_rem]'),'1',0).' '.__('Remove widget').
 		'</label></p>'.
 		'<div class="widgetSettings">'.$w->formSettings($iname,$j).'</div>'.
-		'</li>';
+		'</div>';
 		
 		$i++;
@@ -349,5 +341,5 @@
 	}
 	
-	$res .= '</ul>';
+	$res .= '</div>';
 	
 	return $res;
Index: plugins/widgets/style.css
===================================================================
--- plugins/widgets/style.css	(revision 1651)
+++ plugins/widgets/style.css	(revision 1526)
@@ -6,5 +6,5 @@
 	margin: 0 1% 0 0;
 }
-#widgets > li {
+#widgets > div {
 	border: 1px solid #ccc;
 	margin-bottom: .5em;
@@ -12,5 +12,4 @@
 	min-height: 3em;
 	padding: 0 0 4px 0;
-	list-style: none;
 }
 #widgets .widget-name, #widgets .js-remove {
@@ -18,7 +17,4 @@
 	margin-bottom: 0;
 	padding: 4px 8px; 
-}
-#widgets .js-hide {
-	display: none;
 }
 #widgets .widget-name {
@@ -42,39 +38,12 @@
 	margin-bottom: 2em;
 }
-.widgets.fieldset.drag {
-	margin-bottom: 0;
-	border-radius: 6px 6px 0 0;
-}
 #widgets, #dndnav, #dndextra, #dndcustom {
 	padding: 1em 0;
-	margin: 1em 0 0;
 }
-#dndnav > li,
-#dndextra > li,
-#dndcustom > li,
-.sortable-delete > li {
+#dndnav > div, #dndextra > div, #dndcustom > div {
 	padding: O;
 	border: 1px solid #999;
 	margin-bottom: 1em;
-	list-style: none;
 }
-
-.sortable-delete > li {
-	margin-bottom: 3px;
-}
-
-#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: 2rem;
-	padding: 3px;
-}
-
-#dndnav .form-note, #dndextra .form-note, #dndcustom .form-note {
-	display: none;
-}
-
 
 .widget-name {
@@ -104,25 +73,4 @@
 	background: #f5f5f5;
 }
-
-.sortable-delete {
-    display: none;
-}
-
-.sortable-delete.drag {
-    background: url("style/JsToolbar/bt_clean.png") no-repeat scroll 2px 5px #FFBABA;
-    border-color: #999999;
-    border-radius: 0 0 6px 6px;
-    border-right: 1px solid #999999;
-    border-style: solid;
-    border-width: 0 1px 1px;
-    color: #000000;
-    font-weight: bold;
-    list-style: none outside none;
-    margin: 0 0 2em;
-    min-height: 25px;
-    padding: 4px 4px 0 24px;
-    display: block;
-}
-
 #widgets .widgetSettings {
 	display: none;
Index: plugins/widgets/widgets.js
===================================================================
--- plugins/widgets/widgets.js	(revision 1651)
+++ plugins/widgets/widgets.js	(revision 665)
@@ -1,51 +1,227 @@
-dotclear.postExpander = function(line) {
-	var title = $(line).find('.widget-name');
-	
-	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.line = line;
-	img.onclick = function() { dotclear.viewPostContent(this.line); };
-	
-	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
+var dragdrop = ToolMan.dragdrop();
+$(function() {
 	$('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');
+});
+
+$(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);
+			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); };
+			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;
+		});
 	});
-	
-	// remove
-	$('input[name*=rem]').change(function () {
-	    if ($(this).attr("checked")) {
-	        $(this).parents('li').remove();
-	    }
-	});
-	
-});
+}
