/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.mobile.app.SceneController"],["require","dojox.mobile._base"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.mobile.app.SceneController"]){_4._hasResource["dojox.mobile.app.SceneController"]=true;_4.provide("dojox.mobile.app.SceneController");_4.experimental("dojox.mobile.app.SceneController");_4.require("dojox.mobile._base");(function(){var _7=_6.mobile.app;var _8={};_4.declare("dojox.mobile.app.SceneController",_6.mobile.View,{stageController:null,keepScrollPos:false,init:function(_9,_a){this.sceneName=_9;this.params=_a;var _b=_7.resolveTemplate(_9);this._deferredInit=new _4.Deferred();if(_8[_9]){this._setContents(_8[_9]);}else{_4.xhrGet({url:_b,handleAs:"text"}).addCallback(_4.hitch(this,this._setContents));}return this._deferredInit;},_setContents:function(_c){_8[this.sceneName]=_c;this.domNode.innerHTML="<div>"+_c+"</div>";var _d="";var _e=this.sceneName.split("-");for(var i=0;i<_e.length;i++){_d+=_e[i].substring(0,1).toUpperCase()+_e[i].substring(1);}_d+="Assistant";this.sceneAssistantName=_d;var _f=this;_6.mobile.app.loadResourcesForScene(this.sceneName,function(){console.log("All resources for ",_f.sceneName," loaded");var _10;if(typeof (_4.global[_d])!="undefined"){_f._initAssistant();}else{var _11=_7.resolveAssistant(_f.sceneName);_4.xhrGet({url:_11,handleAs:"text"}).addCallback(function(_12){try{_4.eval(_12);}catch(e){console.log("Error initializing code for scene "+_f.sceneName+". Please check for syntax errors");throw e;}_f._initAssistant();});}});},_initAssistant:function(){console.log("Instantiating the scene assistant "+this.sceneAssistantName);var cls=_4.getObject(this.sceneAssistantName);if(!cls){throw Error("Unable to resolve scene assistant "+this.sceneAssistantName);}this.assistant=new cls(this.params);this.assistant.controller=this;this.assistant.domNode=this.domNode.firstChild;this.assistant.setup();this._deferredInit.callback();},query:function(_13,_14){return _4.query(_13,_14||this.domNode);},parse:function(_15){var _16=this._widgets=_6.mobile.parser.parse(_15||this.domNode,{controller:this});for(var i=0;i<_16.length;i++){_16[i].set("controller",this);}},getWindowSize:function(){return {w:_4.global.innerWidth,h:_4.global.innerHeight};},showAlertDialog:function(_17){var _18=_4.marginBox(this.assistant.domNode);var _19=new _6.mobile.app.AlertDialog(_4.mixin(_17,{controller:this}));this.assistant.domNode.appendChild(_19.domNode);console.log("Appended ",_19.domNode," to ",this.assistant.domNode);_19.show();},popupSubMenu:function(_1a){var _1b=new _6.mobile.app.ListSelector({controller:this,destroyOnHide:true,onChoose:_1a.onChoose});this.assistant.domNode.appendChild(_1b.domNode);_1b.set("data",_1a.choices);_1b.show(_1a.fromNode);}});})();}}};});