//>>built
define("demos/mobileGallery/src/map",["dojo/on","dojo/_base/declare","dojo/_base/lang","dojo/_base/window","dojo/dom","dojo/dom-geometry","dojo/io/script","dijit/registry","dojox/mobile/ProgressIndicator","./structure"],function(on,_1,_2,_3,_4,_5,_6,_7,_8,_9){var _a=_1(null,{constructor:function(_b){this.id=_b.id;this.location=_b.location;this.options={center:_b.location,zoom:(_9.layout.leftPane.hidden?11:12),mapTypeId:google.maps.MapTypeId.ROADMAP,panControl:false,zoomControl:true,mapTypeControl:true,scaleControl:true,streetViewControl:true,overviewMapControl:false,zoomControlOptions:{style:google.maps.ZoomControlStyle.SMALL}};},load:function(){this.map=new google.maps.Map(document.getElementById(this.id),this.options);var _c=new google.maps.Marker({map:this.map,position:this.location});var _d=new google.maps.Geocoder();var _e=new google.maps.InfoWindow();var _f=this.map;_d.geocode({"latLng":this.location},function(_10,_11){if(_11===google.maps.GeocoderStatus.OK){google.maps.event.addListener(_c,"click",function(){_e.setContent("<b>Location</b><br>"+_10[0].formatted_address.replace(", ","<br"));_e.open(_f,this);});}});},resize:function(){google.maps.event.trigger(this.map,"resize");}});var _12=false;var _13;function _14(_15){var _16=new _a({id:"googleMap",location:(_15?_15:new google.maps.LatLng(-34.397,150.644))});_16.load();_13.stop();on(_7.byId("map"),"resize",function(){var _17=_5.getMarginBox("map");var _18=_5.getMarginBox("header");_17.w=_18.w;_17.h=_3.global.innerHeight-_5.getMarginBox("header").h;_5.setMarginBox("map",_17);_16.resize();});_12=true;};var _19=_2.getObject("demos.mobileGallery.src.map",true);_19.initMap=function(){if(navigator.geolocation){navigator.geolocation.getCurrentPosition(function(_1a){var _1b=new google.maps.LatLng(_1a.coords.latitude,_1a.coords.longitude);_14(_1b);},function(){_14();});}else{_14();}};function _1c(){_6.get({url:"http://maps.google.com/maps/api/js",content:{sensor:false,callback:"demos.mobileGallery.src.map.initMap"},timeout:30000,error:function(err){_13.stop();_4.byId("googleMap").innerHTML=err;}});};return {init:function(){on(_7.byId("map"),"afterTransitionIn",function(){if(_12){return;}var _1d=_5.getMarginBox("map");_1d.h=window.innerHeight-_5.getMarginBox("header").h;_5.setMarginBox("map",_1d);_13=_8.getInstance();_13.stop();_4.byId("rightPane").appendChild(_13.domNode);_13.start();_1c();});}};});