docs: function() {
  				var elem = selectedElement;
  				// If element has just been deleted, consider it null
  				if (elem != null && !elem.parentNode) {elem = null;}
  				var currentLayerName = svgCanvas.getCurrentDrawing().getCurrentLayerName();
  				var currentMode = svgCanvas.getMode();
  				var unit = curConfig.baseUnit !== 'px' ? curConfig.baseUnit : null;
  
  				var is_node = currentMode == 'pathedit'; //elem ? (elem.id && elem.id.indexOf('pathpointgrip') == 0) : false;
  				var menu_items = $('#cmenu_canvas li');
  				$('#selected_panel, #multiselected_panel, #g_panel, #rect_panel, #circle_panel,'+
  					'#ellipse_panel, #line_panel, #text_panel, #image_panel, #container_panel,'+
  					' #use_panel, #a_panel').hide();
  				if (elem != null) {
  					var elname = elem.nodeName;
  					// If this is a link with no transform and one child, pretend
  					// its child is selected
  //					if (elname === 'a') { // && !$(elem).attr('transform')) {
  //						elem = elem.firstChild;
  //					}
  
  					var angle = svgCanvas.getRotationAngle(elem);
  					$('#angle').val(angle);
  
  					var blurval = svgCanvas.getBlur(elem);
  					$('#blur').val(blurval);
  					$('#blur_slider').slider('option', 'value', blurval);
  
  					if (svgCanvas.addedNew) {
  						if (elname === 'image') {
  							// Prompt for URL if not a data URL
  							if (svgCanvas.getHref(elem).indexOf('data:') !== 0) {
  								promptImgURL();
  							}
  						} /*else if (elname == 'text') {
  							// TODO: Do something here for new text
  						}*/
  					}
  
  					if (!is_node && currentMode != 'pathedit') {
  						$('#selected_panel').show();
  						// Elements in this array already have coord fields
  						if (['line', 'circle', 'ellipse'].indexOf(elname) >= 0) {
  							$('#xy_panel').hide();
  						} else {
  							var x, y;
  
  							// Get BBox vals for g, polyline and path
  							if (['g', 'polyline', 'path'].indexOf(elname) >= 0) {
  								var bb = svgCanvas.getStrokedBBox([elem]);
  								if (bb) {
  									x = bb.x;
  									y = bb.y;
  								}
  							} else {
  								x = elem.getAttribute('x');
  								y = elem.getAttribute('y');
  							}
  
  							if (unit) {
  								x = svgedit.units.convertUnit(x);
  								y = svgedit.units.convertUnit(y);
  							}
  
  							$('#selected_x').val(x || 0);
  							$('#selected_y').val(y || 0);
  							$('#xy_panel').show();
  						}
  
  						// Elements in this array cannot be converted to a path
  						var no_path = ['image', 'text', 'path', 'g', 'use'].indexOf(elname) == -1;
  						$('#tool_topath').toggle(no_path);
  						$('#tool_reorient').toggle(elname === 'path');
  						$('#tool_reorient').toggleClass('disabled', angle === 0);
  					} else {
  						var point = path.getNodePoint();
  						$('#tool_add_subpath').removeClass('push_button_pressed').addClass('tool_button');
  						$('#tool_node_delete').toggleClass('disabled', !path.canDeleteNodes);
  
  						// Show open/close button based on selected point
  						setIcon('#tool_openclose_path', path.closed_subpath ? 'open_path' : 'close_path');
  
  						if (point) {
  							var seg_type = $('#seg_type');
  							if (unit) {
  								point.x = svgedit.units.convertUnit(point.x);
  								point.y = svgedit.units.convertUnit(point.y);
  							}
  							$('#path_node_x').val(point.x);
  							$('#path_node_y').val(point.y);
  							if (point.type) {
  								seg_type.val(point.type).removeAttr('disabled');
  							} else {
  								seg_type.val(4).attr('disabled', 'disabled');
  							}
  						}
  						return;
  					}
  
  					// update contextual tools here
  					var panels = {
  						g: [],
  						a: [],
  						rect: ['rx', 'width', 'height'],
  						image: ['width', 'height'],
  						circle: ['cx', 'cy', 'r'],
  						ellipse: ['cx', 'cy', 'rx', 'ry'],
  						line: ['x1', 'y1', 'x2', 'y2'],
  						text: [],
  						use: []
  					};
  
  					var el_name = elem.tagName;
  
  //					if ($(elem).data('gsvg')) {
  //						$('#g_panel').show();
  //					}
  
  					var link_href = null;
  					if (el_name === 'a') {
  						link_href = svgCanvas.getHref(elem);
  						$('#g_panel').show();
  					}
  
  					if (elem.parentNode.tagName === 'a') {
  						if (!$(elem).siblings().length) {
  							$('#a_panel').show();
  							link_href = svgCanvas.getHref(elem.parentNode);
  						}
  					}
  
  					// Hide/show the make_link buttons
  					$('#tool_make_link, #tool_make_link').toggle(!link_href);
  
  					if (link_href) {
  						$('#link_url').val(link_href);
  					}
  
  					if (panels[el_name]) {
  						var cur_panel = panels[el_name];
  
  						$('#' + el_name + '_panel').show();
  
  						$.each(cur_panel, function(i, item) {
  							var attrVal = elem.getAttribute(item);
  							if (curConfig.baseUnit !== 'px' && elem[item]) {
  								var bv = elem[item].baseVal.value;
  								attrVal = svgedit.units.convertUnit(bv);
  							}
  							$('#' + el_name + '_' + item).val(attrVal || 0);
  						});
  
  						if (el_name == 'text') {
  							$('#text_panel').css('display', 'inline');
  							if (svgCanvas.getItalic()) {
  								$('#tool_italic').addClass('push_button_pressed').removeClass('tool_button');
  							} else {
  								$('#tool_italic').removeClass('push_button_pressed').addClass('tool_button');
  							}
  							if (svgCanvas.getBold()) {
  								$('#tool_bold').addClass('push_button_pressed').removeClass('tool_button');
  							} else {
  								$('#tool_bold').removeClass('push_button_pressed').addClass('tool_button');
  							}
  							$('#font_family').val(elem.getAttribute('font-family'));
  							$('#font_size').val(elem.getAttribute('font-size'));
  							$('#text').val(elem.textContent);
  							if (svgCanvas.addedNew) {
  								// Timeout needed for IE9
  								setTimeout(function() {
  									$('#text').focus().select();
  								}, 100);
  							}
  						} // text
  						else if (el_name == 'image') {
  							setImageURL(svgCanvas.getHref(elem));
  						} // image
  						else if (el_name === 'g' || el_name === 'use') {
  							$('#container_panel').show();
  							var title = svgCanvas.getTitle();
  							var label = $('#g_title')[0];
  							label.value = title;
  							setInputWidth(label);
  							$('#g_title').prop('disabled', el_name == 'use');
  						}
  					}
  					menu_items[(el_name === 'g' ? 'en' : 'dis') + 'ableContextMenuItems']('#ungroup');
  					menu_items[((el_name === 'g' || !multiselected) ? 'dis' : 'en') + 'ableContextMenuItems']('#group');
  				} // if (elem != null)
  				else if (multiselected) {
  					$('#multiselected_panel').show();
  					menu_items
  						.enableContextMenuItems('#group')
  						.disableContextMenuItems('#ungroup');
  				} else {
  					menu_items.disableContextMenuItems('#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back');
  				}
  
  				// update history buttons
  				$('#tool_undo').toggleClass('disabled', undoMgr.getUndoStackSize() === 0);
  				$('#tool_redo').toggleClass('disabled', undoMgr.getRedoStackSize() === 0);
  
  				svgCanvas.addedNew = false;
  
  				if ( (elem && !is_node)	|| multiselected) {
  					// update the selected elements' layer
  					$('#selLayerNames').removeAttr('disabled').val(currentLayerName);
  
  					// Enable regular menu options
  					canv_menu.enableContextMenuItems('#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back');
  				} else {
  					$('#selLayerNames').attr('disabled', 'disabled');
  				}
  			}