/*jslint nomen: true, debug: true, evil: true, onevar: true, passfail: true */
/*global $, document, initializeMap, createStationStatusTable, backgroundUpdate, log4javascript, window */

//
// Depends on:
//   jquery.js
//   data_dashboard.js
//   map.js
//


//
// constants/configuration 
//
var MIRRORS = {
	mode: null,
	logging: {
        test: true,
        production: false
	}
};


//
//based on the given mode, re-initialize constants
//accordingly so that the correct values are in place
//when ready. this is a function rather than hash/2D array
//because we may want to do other things config wise
//for specific modes (don't yet, but I have a few things
//I'd like to add that would help with). this is mostly
//a placeholder for now
//
function initSiteState(mode) {
	
	MIRRORS.mode = mode;

	if (mode === 'test') {
		MIRRORS.logging = MIRRORS.logging.test;
	} else if (mode === 'production') {
		MIRRORS.logging = MIRRORS.logging.production;
	}	
}


//
// When the DOM is ready to be modified
//
$(document).ready(function () {

	// changing the argument given to initSiteState will
	// trickle down and affect the other code which
	// is able to automatically choose constants based
	// on mode
//	initSiteState('test');
	initSiteState('production');
	
	// requires log4javascript.js and affects the whole application
//	log4javascript.setEnabled(MIRRORS.logging);

});


//
// The map cannot be created with doc.ready, IE has issues unless
// it's done via window.onload
//
window.onload = function () {
	
	// requires that map.js has been loaded in the page header
	initializeMap(MIRRORS.mode, '/spidr/servlet/MirrorKml');

};
