//>>built
define("dojox/mobile/app/AlertDialog",["dijit","dojo","dojox","dojo/require!dijit/_WidgetBase"],function(f,a,h){a.provide("dojox.mobile.app.AlertDialog");a.experimental("dojox.mobile.app.AlertDialog");a.require("dijit._WidgetBase");a.declare("dojox.mobile.app.AlertDialog",f._WidgetBase,{title:"",text:"",controller:null,buttons:null,defaultButtonLabel:"OK",onChoose:null,constructor:function(){this.onClick=a.hitch(this,this.onClick);this._handleSelect=a.hitch(this,this._handleSelect)},buildRendering:function(){this.domNode=
a.create("div",{"class":"alertDialog"});var b=a.create("div",{"class":"alertDialogBody"},this.domNode);a.create("div",{"class":"alertTitle",innerHTML:this.title||""},b);a.create("div",{"class":"alertText",innerHTML:this.text||""},b);var c=a.create("div",{"class":"alertBtns"},b);this.buttons&&0!=this.buttons.length||(this.buttons=[{label:this.defaultButtonLabel,value:"ok","class":"affirmative"}]);var d=this;a.forEach(this.buttons,function(e){var g=new h.mobile.Button({btnClass:e["class"]||"",label:e.label});
g._dialogValue=e.value;a.place(g.domNode,c);d.connect(g,"onClick",d._handleSelect)});b=this.controller.getWindowSize();this.mask=a.create("div",{"class":"dialogUnderlayWrapper",innerHTML:'\x3cdiv class\x3d"dialogUnderlay"\x3e\x3c/div\x3e',style:{width:b.w+"px",height:b.h+"px"}},this.controller.assistant.domNode);this.connect(this.mask,"onclick",function(){d.onChoose&&d.onChoose();d.hide()})},postCreate:function(){this.subscribe("/dojox/mobile/app/goback",this._handleSelect)},_handleSelect:function(b){var c;
if(b&&b.target)for(c=b.target;!f.byNode(c);)c=c.parentNode;if(this.onChoose)this.onChoose(c?f.byNode(c)._dialogValue:void 0);this.hide()},show:function(){this._doTransition(1)},hide:function(){this._doTransition(-1)},_doTransition:function(b){var c=a.marginBox(this.domNode.firstChild).h;var d=this.controller.getWindowSize().h;c=d-c;d=a.fx.slideTo({node:this.domNode,duration:400,top:{start:0>b?c:d,end:0>b?d:c}});c=a[0>b?"fadeOut":"fadeIn"]({node:this.mask,duration:400});d=a.fx.combine([d,c]);var e=
this;a.connect(d,"onEnd",this,function(){0>b&&(e.domNode.style.display="none",a.destroy(e.domNode),a.destroy(e.mask))});d.play()},destroy:function(){this.inherited(arguments);a.destroy(this.mask)},onClick:function(){}})});