﻿Ext.BLANK_IMAGE_URL = './ext/resources/images/default/s.gif';
Ext.QuickTips.init();

var spot = new Ext.ux.Spotlight({
  easing: 'easeOut',
  duration: .3
});

// application main entry point
Ext.onReady(function() {

  // Saves state of controls
  Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
    expires: cookieExpirationDate,
    domain: siteDomain
  }));

  var viewport = new Ext.Viewport({
    layout: 'border',
    id: 'masterViewport',
    items: [
      {
        id: 'mapRegion',
        region: 'center',
        html: '<div id="map" style="height:100%; width:100%;z-index:1000;"></div><div id="marker" style="display:none;position:absolute;z-index:100;"><img src="js/mapping/ext/resources/marker/glow030.png"/></div>'
      },
      Mapping.Ext.Esri.ZoomSlider.slider,
      satelliteLayerToggleButton,
      streetLayerToggleButton
    ],
    listeners: {
      'afterrender': { fn: setLayerButtons },
      'resize': { fn: setLayerButtons }
    }
  });

  //viewport.on('afterrender', setLayerButtons);
 var disclaimerText = '<h1 class="title">Welcome!</h1>' +
          '<br><p class="text">' +
            'Welcome to the Suwannee River Water Management District’s flood information site.' +
            '  Effective September 2010, this site replaces both srwmdfloodreport.com and srwmdfloodmapper.com.'+
            '   The site is designed to provide you with information about flooding sources in your area.</p>' +
            '<br><p class="text">' +
            'Click the Help Icon <img src="images/icons/small/i_help.png" alt="Help" width="10" height="10" />'+
            ' and choose "Getting Started" if you have questions about using the site.</p>' +
            '<br><h2 class="title2">Disclaimer</h2>' +
            '<p class="text">' +
            'The data shown has been compiled from a variety of sources, including the Federal Emergency Management Agency (FEMA), United States Geological Survey (USGS), the District, member counties, and other agencies.  The data shown is provided as a reference only and does not imply accuracy with regard to horizontal or vertical location. This data is not to be employed to determine any base flood elevations for NFIP (National Flood Insurance Program) purposes.'
            ' For NFIP insurance and regulation purposes please refer to the published effective FIRM (Flood Insurance Rate Map) for your area of concern.   Please contact the District or your county floodplain manager for the latest information regarding flooding issues in your area.</p>'

  var disclaimerWindow = new Ext.Window({
    id: 'disclaimerWindow',
    title: 'Welcome/Disclaimer',
    closable: false,
    draggable: false,
    modal: true,
    html: disclaimerText, 
    buttons: [
      {
        text: 'Accept',
        handler: function() {
          spot.hide();
          disclaimerWindow.close();
        }
      },
      {
        text: 'Cancel',
        handler: function() {
          Ext.MessageBox.alert(
            'Error',
            'You must accept to continue'
          );
        }
      }
    ],
    width: 375,
    height: 310
  });

  CreateMap();

});

