/*
	Copyright (c) 2004-2007, The Dojo Foundation
	All Rights Reserved.

	Licensed under the Academic Free License version 2.1 or above OR the
	modified BSD license. For more information on Dojo licensing, see:

		http://dojotoolkit.org/book/dojo-book-0-9/introduction/licensing
*/


dojo._xdResourceLoaded({depends:[["provide","dijit._Widget"],["require","dijit._base"]],defineResource:function(_1){if(!_1._hasResource["dijit._Widget"]){_1._hasResource["dijit._Widget"]=true;_1.provide("dijit._Widget");_1.require("dijit._base");_1.declare("dijit._Widget",null,{id:"",lang:"",dir:"","class":"",style:"",title:"",srcNodeRef:null,domNode:null,attributeMap:{id:"",dir:"",lang:"","class":"",style:"",title:""},postscript:function(_2,_3){this.create(_2,_3);},create:function(_4,_5){this.srcNodeRef=_1.byId(_5);this._connects=[];this._attaches=[];if(this.srcNodeRef&&(typeof this.srcNodeRef.id=="string")){this.id=this.srcNodeRef.id;}if(_4){_1.mixin(this,_4);}this.postMixInProperties();if(!this.id){this.id=dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));}dijit.registry.add(this);this.buildRendering();if(this.domNode){for(var _6 in this.attributeMap){var _7=this[this.attributeMap[_6]||"domNode"];var _8=this[_6];if(typeof _8!="object"&&(_8!==""||(_4&&_4[_6]))){switch(_6){case "class":_1.addClass(_7,_8);break;case "style":if(_7.style.cssText){_7.style.cssText+="; "+_8;}else{_7.style.cssText=_8;}break;default:_7.setAttribute(_6,_8);}}}}if(this.domNode){this.domNode.setAttribute("widgetId",this.id);}this.postCreate();if(this.srcNodeRef&&!this.srcNodeRef.parentNode){delete this.srcNodeRef;}},postMixInProperties:function(){},buildRendering:function(){this.domNode=this.srcNodeRef||_1.doc.createElement("div");},postCreate:function(){},startup:function(){},destroyRecursive:function(_9){this.destroyDescendants();this.destroy();},destroy:function(_a){this.uninitialize();_1.forEach(this._connects,function(_b){_1.forEach(_b,_1.disconnect);});this.destroyRendering(_a);dijit.registry.remove(this.id);},destroyRendering:function(_c){if(this.bgIframe){this.bgIframe.destroy();delete this.bgIframe;}if(this.domNode){_1._destroyElement(this.domNode);delete this.domNode;}if(this.srcNodeRef){_1._destroyElement(this.srcNodeRef);delete this.srcNodeRef;}},destroyDescendants:function(){_1.forEach(this.getDescendants(),function(_d){_d.destroy();});},uninitialize:function(){return false;},toString:function(){return "[Widget "+this.declaredClass+", "+(this.id||"NO ID")+"]";},getDescendants:function(){var _e=_1.query("[widgetId]",this.domNode);return _e.map(dijit.byNode);},nodesWithKeyClick:["input","button"],connect:function(_f,_10,_11){var _12=[];if(_10=="ondijitclick"){var w=this;if(!this.nodesWithKeyClick[_f.nodeName]){_12.push(_1.connect(_f,"onkeydown",this,function(e){if(e.keyCode==_1.keys.ENTER){return (_1.isString(_11))?w[_11](e):_11.call(w,e);}else{if(e.keyCode==_1.keys.SPACE){_1.stopEvent(e);}}}));_12.push(_1.connect(_f,"onkeyup",this,function(e){if(e.keyCode==_1.keys.SPACE){return _1.isString(_11)?w[_11](e):_11.call(w,e);}}));}_10="onclick";}_12.push(_1.connect(_f,_10,this,_11));this._connects.push(_12);return _12;},disconnect:function(_16){for(var i=0;i<this._connects.length;i++){if(this._connects[i]==_16){_1.forEach(_16,_1.disconnect);this._connects.splice(i,1);return;}}},isLeftToRight:function(){if(typeof this._ltr=="undefined"){this._ltr=_1.getComputedStyle(this.domNode).direction!="rtl";}return this._ltr;},isFocusable:function(){return this.focus&&(_1.style(this.domNode,"display")!="none");}});}}});