function init() {
loading = dojo.byId("loadingImg"); //loading image. id --> Not present, no problem
var extent = getExtent();
initExtent = new esri.geometry.Extent({
"xmin":-100,
"ymin":13,
"xmax":-85,
"ymax":24,
"spatialReference":{"wkid":4326}
}); //spatial reference for lat/long
esriConfig.defaults.map.slider = { left:"10px", top:"10px", width:null, height:"150px" };
map = new esri.Map("map", {extent:initExtent, slider: true});
var imageParameters = new esri.layers.ImageParameters();
imageParameters.format = "JPEG"; //set the image type to JPEG, note default is PNG8.
map.addLayer(new esri.layers.ArcGISDynamicMapServiceLayer("http://192.168.250.75:8399/arcgis/rest/services/surroundings/MapServer"));
ground = new esri.layers.ArcGISTiledMapServiceLayer( "http://192.168.250.75:8399/arcgis/rest/services/mexLoadBal/MapServer");
dynamicMapServiceLayer09 = ground;
var imageParameters = new esri.layers.ImageParameters();
imageParameters.format = "JPEG"; //set the image type to JPEG, note default is PNG8.
var layer = map.addLayer(dynamicMapServiceLayer09);
if (layer == null)
{
alert("map layer is null, could not add map layer to map");
}
map.reorderLayer(ground,0);
dojo.connect(map, "onClick", function(evt) {
map.graphics.clear();
locator.locationToAddress(evt.mapPoint, 500);
});
dojo.connect(map,"onUpdateStart",function(){
esri.show(dojo.byId("status"));
showLoading();
});
dojo.connect(map,"onUpdateEnd",function(){
esri.hide(dojo.byId("status"));
hideLoading();
});
dojo.connect(map, "onExtentChange", showExtent);
dojo.connect(map, "onExtentChange", saveExtgent); // save Extent of the current loaded map
dojo.connect(map, "onMouseMove", showCoordinates);
dojo.connect(map, "onMouseDrag", showCoordinates);
dojo.connect(map, "onLoad", createMenus);
}
/*****************************************/
Avoid "On Demand" caching! After having tiles take upwards of 3 minutes to generate with my services, ESRI eventual got back to me and said "do not use" this feature as it does not work as advertised.