dojo.provide("dijit.TooltipDialog");

dojo.require("dijit.layout.ContentPane");
dojo.require("dijit._Templated");
dojo.require("dijit.form._FormMixin");
dojo.require("dijit._DialogMixin");

dojo.declare(
		"dijit.TooltipDialog",
		[dijit.layout.ContentPane, dijit._Templated, dijit.form._FormMixin, dijit._DialogMixin],
		{
			// summary:
			//		Pops up a dialog that appears like a Tooltip
			//
			// title: String
			// 		Description of tooltip dialog (required for a11Y)
			title: "",

			// doLayout: Boolean
			//		Don't change this parameter from the default value.
			//		This ContentPane parameter doesn't make sense for TooltipDialog, since TooltipDialog
			//		is never a child of a layout container, nor can you specify the size of
			//		TooltipDialog in order to control the size of an inner widget. 
			doLayout: false,

			// autofocus: Boolean
			// 		A Toggle to modify the default focus behavior of a Dialog, which
			// 		is to focus on the first dialog element after opening the dialog.
			//		False will disable autofocusing. Default: true
			autofocus: true,

			"class": "dijitTooltipDialog",

			// _firstFocusItem: DomNode
			//		The pointer to the first focusable node in the dialog
			_firstFocusItem:null,
			
			// _lastFocusItem: DomNode
			//		The domNode that had focus before we took it.
			_lastFocusItem: null,

			templateString: null,
			templatePath: dojo.moduleUrl("dijit", "templates/TooltipDialog.html"),

			postCreate: function(){
				this.inherited(arguments);
				this.connect(this.containerNode, "onkeypress", "_onKey");
				this.containerNode.title = this.title;
			},

			orient: function(/*DomNode*/ node, /*String*/ aroundCorner, /*String*/ corner){
				// summary: configure widget to be displayed in given position relative to the button
				this.domNode.className = this["class"] +" dijitTooltipAB"+(corner.charAt(1)=='L'?"Left":"Right")+" dijitTooltip"+(corner.charAt(0)=='T' ? "Below" : "Above");
			},

			onOpen: function(/*Object*/ pos){
				// summary: called when dialog is displayed
			
				this.orient(this.domNode,pos.aroundCorner, pos.corner);
				this._onShow(); // lazy load trigger
				
				if(this.autofocus){
					this._getFocusItems(this.containerNode);
					dijit.focus(this._firstFocusItem);
				}
			},
			
			_onKey: function(/*Event*/ evt){
				// summary: keep keyboard focus in dialog; close dialog on escape key
				var node = evt.target;
				var dk = dojo.keys;
				if (evt.charOrCode === dk.TAB){
					this._getFocusItems(this.containerNode);
				}
				var singleFocusItem = (this._firstFocusItem == this._lastFocusItem);
				if(evt.charOrCode == dk.ESCAPE){
					this.onCancel();
					dojo.stopEvent(evt);
				}else if(node == this._firstFocusItem && evt.shiftKey && evt.charOrCode === dk.TAB){
					if(!singleFocusItem){
						dijit.focus(this._lastFocusItem); // send focus to last item in dialog
					}
					dojo.stopEvent(evt);
				}else if(node == this._lastFocusItem && evt.charOrCode === dk.TAB && !evt.shiftKey){
					if(!singleFocusItem){
						dijit.focus(this._firstFocusItem); // send focus to first item in dialog
					}
					dojo.stopEvent(evt);
				}else if(evt.charOrCode === dk.TAB){
					// we want the browser's default tab handling to move focus
					// but we don't want the tab to propagate upwards
					evt.stopPropagation();
				}
			}
		}	
	);


@@ -1079,23 +1079,25 @@
 ue,%0A%0A%09%09%09
-%22c
+baseC
 lass
-%22
 : %22dijit
@@ -1794,50 +1794,108 @@
 %09%09%09%09
-this.domNode.className = this%5B%22class%22%5D +%22 
+var c = this._currentOrientClass;%0A%09%09%09%09if(c)%7B%0A%09%09%09%09%09dojo.removeClass(this.domNode, c);%0A%09%09%09%09%7D%0A%09%09%09%09c = %22
 diji
@@ -2006,16 +2006,86 @@
 bove%22);%0A
+%09%09%09%09dojo.addClass(this.domNode, c);%0A%09%09%09%09this._currentOrientClass = c;%0A
 %09%09%09%7D,%0A%0A%09

Make TooltipDialog class parameter work correctly (being added to the node rather than replacing the baseClass, dijitTooltipDialog.