/*
 * MapObject - The JavaScript Mapping Library.
 * http://MapObject.net
 * 
 * Copyright (c) 2006-2007, Mashup Technologies, LLC
 * All rights reserved.
 * http://www.MashupTechnologies.com
 * 
 * The JavaScript code distributed with Google Maps Samples (the "Software") is licensed under the
 * Lesser GNU (LGPL) open source license version 3.
 * 
 * http://www.gnu.org/licenses/lgpl.html
 * 
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 */

// Create MapObject namespace
Ext.namespace('MapObject.widget');

/**
 * Provides StatusBar widget class.
 * @namespace MapObject.widget
 * @class StatusBar
 * @constructor
 * @param {HTMLElement | String} The html element that represents the StatusBar.
 * @param {Object} A key-value map of initial config names and values.
	* @cfg {String} TODO.
	* @cfg {Boolean} TODO.
 */
(function() {

	//
	// Private namespace. Private properties go here.
	//
	var self = null;  // internal reference to public MapObject.widget.StatusBar instance.

	
	// Map $ to a document.getElementById method
	function $(element) {
		if (arguments.length > 1) {
			for (var i = 0, elements = [], length = arguments.length; i < length; i++)
			{
				elements.push($(arguments[i]));
			}
			return elements;
		}
		if (typeof element == 'string')
		{
			return document.getElementById(element);
		}
	}	

	//
	//	Public methods and constants
	//
	/*
	* Map status bar
	*/
	MapObject.widget.StatusBar = function (el, opt) {
		// make this visible in private scope.
		self = this;
		
		this.init(el, opt); 
	}

	////////////////////////////////////////////////////////////////////////////////////////////
	MapObject.widget.StatusBar.prototype = {
		//
		// Object namespace. Private properties go here.
		//

		el: null,
		// Containers for lat/lon values
		lat: null,
		lng: null,
		zoom: null,

		//
		//	Public methods and constants
		//

		// Constructor
		init: function(el, opt) {
			this.el = $(el);

			/* Use markup layout
			this.lat = document.createElement("span");
			this.el.appendChild(this.lat);
				
			this.lng = document.createElement("span");
			this.el.appendChild(this.lng);
			*/
				
			this.lat = $('mapStatusBarLat__MODULE_ID__');
			this.lng = $('mapStatusBarLng__MODULE_ID__');
			this.zoom = $('mapStatusBarZoom__MODULE_ID__');

			// make this is visible in private scope
			self = this;

		},

		// Make status bar visible
		show: function() {
			this.el.style.display = "block";
		},

		// Display Longitute
		setLat: function(val) {
			this.show();
			this.lat.innerHTML = val;
		},
		// Display Latitude
		setLng: function(val) {
			this.show();
			this.lng.innerHTML = val;
		},

		// Display zoom level
		setZoom: function(val) {
			this.show();
			this.zoom.innerHTML = val;
		
		},

		// saved from extra commas after the last method
		EOF:null
	}
})(); // the parens here cause the anonymous function to execute and return