/*** create custom controls **********************/


function customControls(myClass) {
	this.mapControlsClass = "map-container";
}


customControls.prototype = new GControl();

	//must define zoom functions before they intialize
	customControls.prototype.panUp     = function(map) {map.panDirection(0, 1);}
	customControls.prototype.panDown   = function(map) {map.panDirection(0, -1);}
	customControls.prototype.panLeft   = function(map) {map.panDirection(1, 0);}
	customControls.prototype.panRight  = function(map) {map.panDirection(-1, 0);}
	customControls.prototype.panCentre = function(map) {map.returnToSavedPosition();map.closeExtInfoWindow();}
	customControls.prototype.zoomIn    = function(map) {map.zoomIn();}
	customControls.prototype.zoomOut   = function(map) {map.zoomOut();}

	customControls.prototype.initialize = function(map, mapControlsClass) {
	var container = document.createElement("div");
	container.id = "mapControls";
	container.className = this.mapControlsClass;

	this.initButton(map, container, "panUpDiv", "btnPanUp", "gmapsButton", this.panUp);
	this.initButton(map, container, "panDownDiv", "btnPanDown", "gmapsButton", this.panDown);
	this.initButton(map, container, "panLeftDiv", "btnPanLeft", "gmapsButton", this.panLeft);
	this.initButton(map, container, "panRightDiv", "btnPanRight", "gmapsButton", this.panRight);
	this.initButton(map, container, "panCentreDiv", "btnCentre", "gmapsButton", this.panCentre);
	this.initButton(map, container, "zoomInDiv", "btnZoomIn", "gmapsButton", this.zoomIn);
	this.initButton(map, container, "zoomOutDiv", "btnZoomOut", "gmapsButton", this.zoomOut);

	map.getContainer().appendChild(container);
	return container;
}

customControls.prototype.initButton = function(map, container, btnName, myId, myClass, myEvent) {
	var myControl = document.createElement("div");
	this.setButtonStyle_(myControl, myId, myClass);
	GEvent.addDomListener(myControl, "click", function() {myEvent(map)});
	container.appendChild(myControl);
}

customControls.prototype.setButtonStyle_ = function(button, myId, myClass) {
	if (myId) button.id = myId;
	if (myClass) button.className = myClass;
	return;
}
