
function GMapButtons(size){
	this.text = '';
	this.div = null;
	this.map = null;
	this.mapContainer = null;
	this.Scale = new GScaleControl();
	
	this.btn1 = null;
	this.btn2 = null;
	this.btn3 = null;
	this.previousHeigh = size;
	this.isSmall = true;
}

GMapButtons.prototype = new GControl();

GMapButtons.prototype.initialize = function(objMap){
	this.map = objMap;
	this.mapContainer = this.map.getPane(G_MAP_MAP_PANE).parentNode.parentNode.parentNode;
	
	this.div = document.createElement("div");
	//this.div.appendChild(btn1);
	this.div.className = 'gmnoprint';
	//this.div.style.position = 'absolute';
	this.div.style.width = '230pt';
	
	this.btn1 = document.createElement("div");
	this.btn2 = document.createElement("div");
	this.btn3 = document.createElement("div");
	
	this.btn1.innerHTML ='<div style="border: 1px solid black; position: absolute; background-color: white; text-align: center; width: 50px; cursor: pointer; right: 160px;" title="Show street map"><div style="border-style: solid;  border-color: white rgb(176, 176, 176) rgb(176, 176, 176) white; border-width: 1px; font-size: 11px; font-weight: bold;font-family:Verdana;">Map</div></div>';
	this.btn2.innerHTML ='<div style="border: 1px solid black; position: absolute; background-color: white; text-align: center; width: 60px; cursor: pointer; right: 100px;" title="Show satellite map"><div style="border-style: solid; border-color: white rgb(176, 176, 176) rgb(176, 176, 176) white; border-width: 1px; font-size: 11px;font-family:Verdana;">Satellite</div></div>';
	this.btn3.innerHTML ='<div style="border: 1px solid black; position: absolute; background-color: white; text-align: center; width: 100px; cursor: pointer; right: 0px;" title="Increase size of the map"><div style="border-style: solid; border-color: white rgb(176, 176, 176) rgb(176, 176, 176) white; border-width: 1px; font-size: 11px;font-family:Verdana;">Enlarge Map</div></div>';
	
	var t = this; 
	
	this.btn1.onclick = function(){btn1Click(t);};
	this.btn2.onclick = function(){btn2Click(t);};
	this.btn3.onclick = function(){btn3Click(t);};
	
	this.div.appendChild(this.btn1);
	this.div.appendChild(this.btn2);
	this.div.appendChild(this.btn3);
	
	this.mapContainer.appendChild(this.div); //add on same level as map
	
	return this.div;
}
//<div class="gmnoprint" style="-moz-user-select: none; position: absolute; right: 7px; top: 7px; color: black; font-family: Arial,sans-serif; font-size: small; width: 200px; height: 19px;"><div style="border: 1px solid black; position: absolute; background-color: white; text-align: center; width: 5em; cursor: pointer; right: 10.2em;" title="Show street map" id="amtc_option_0"><div style="border-style: solid; border-color: rgb(52, 86, 132) rgb(108, 157, 223) rgb(108, 157, 223) rgb(52, 86, 132); border-width: 1px; font-size: 12px; font-weight: bold;">Map</div></div><div style="border: 1px solid black; position: absolute; background-color: white; text-align: center; width: 5em; cursor: pointer; right: 5.1em;" title="Show satellite imagery" id="amtc_option_1"><div style="border-style: solid; border-color: white rgb(176, 176, 176) rgb(176, 176, 176) white; border-width: 1px; font-size: 12px;">Satellite</div></div><div style="border: 1px solid black; position: absolute; background-color: white; text-align: center; width: 5em; cursor: pointer; right: 0em;" title="Show imagery with street names" id="amtc_option_2"><div style="border-style: solid; border-color: white rgb(176, 176, 176) rgb(176, 176, 176) white; border-width: 1px; font-size: 12px;">Hybrid</div></div></div>

GMapButtons.prototype.printable = function(){
    return false;
}

GMapButtons.prototype.selectable = function(){
    return false;
}

GMapButtons.prototype.getDefaultPosition = function(){
    return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
}

btn1Click = function(t){
    t.map.setMapType(t.map.getMapTypes()[0]);
    t.btn1.firstChild.firstChild.style.fontWeight = 'bold';
    t.btn2.firstChild.firstChild.style.fontWeight = 'normal';
}
btn2Click = function(t){
    t.map.setMapType(t.map.getMapTypes()[2]);
    t.btn2.firstChild.firstChild.style.fontWeight = 'bold';
    t.btn1.firstChild.firstChild.style.fontWeight = 'normal';

}
btn3Click = function(t){ 
    var tmp = t.mapContainer.offsetHeight;
    t.mapContainer.style.height = t.previousHeigh;
    t.mapContainer.parentNode.style.height = t.mapContainer.style.height;
    t.previousHeigh = tmp + 'px';
    t.isSmall = !t.isSmall;
    
    if(t.isSmall){
        t.btn3.firstChild.firstChild.firstChild.nodeValue = 'Enlarge Map';
        t.map.removeControl(t.Scale);
    }
    else{
        t.btn3.firstChild.firstChild.firstChild.nodeValue = 'Reduce Map';
        t.map.addControl(t.Scale);
    }
    
    //needed to reposition all elements
    t.map.setCenter(t.map.getCenter());
}
