var VIEWBOX_INSTANCE = 0;	/* Instance Counter */

function ViewBox(EventManager, ViewMap) {
	var ViewListId = 'ViewBox'+VIEWBOX_INSTANCE+'-';
	VIEWBOX_INSTANCE++;

	function changeView() {
		var viewsList = this;
		var viewOptions = viewsList.getElementsByTagName('option');
		var circView = convertViewString(viewOptions[viewsList.selectedIndex].value, ViewMap.getMapSize());
		EventManager.changePointScale(circView.Center, circView.Radius);
		for(var i = 0; i < viewOptions.length; i++) {
			viewOptions.selected = false;
		}
		viewOptions[0].selected = true;
	}

	this.setParent = function(parentId) {
		var p = document.getElementById(parentId);
		for(var group in VIEWS) {
			var label = document.createElement('span');
			p.appendChild(label);
			label.className = 'ViewboxJumpLabel';
			label.appendChild(document.createTextNode(group));

			var select = document.createElement('select');
			p.appendChild(select);
			/* Blank Option */
			select.appendChild(document.createElement('option'));
			select.className = 'ViewboxJumpSelect';

			for(var view in VIEWS[group]) {
				var opt = document.createElement('option');
				select.appendChild(opt);
				opt.value = VIEWS[group][view];
				opt.appendChild(document.createTextNode(view));
			}
			select.onchange = changeView;
			p.appendChild(document.createElement('br'));
		}
	}

	this.initializeEvents = function () {
	}
}
