﻿//Geodesys Controls

function GeodesysZoomControl(){
}

//Prototypal inheritance
GeodesysZoomControl.prototype = new GControl();

GeodesysZoomControl.prototype.initialize = function(map) {
    //Controls container div
    var container = document.createElement("div");
    container.className = "frmRow buttons";
    //Zoom in div
    var zoomInEl = document.createElement("button");
    this.setStyle_(zoomInEl);
    container.appendChild(zoomInEl);
    var zoomInSpan = document.createElement("span");
    //zoomInSpan.style.background-position-y = "100%";
    zoomInSpan.appendChild(document.createTextNode("zoom +"));    
    zoomInEl.appendChild(zoomInSpan);
    GEvent.addDomListener(zoomInEl, "click", function() {
        map.zoomIn();
    });

    //Zoom out div
    var zoomOutEl = document.createElement("button");
    this.setStyle_(zoomOutEl);
    //zoomOutEl.style.top = "2px";
    //zoomOutEl.style.cssFloat = "left";
    //zoomOutEl.style.styleFloat = "left";
    container.appendChild(zoomOutEl);
    var zoomOutSpan = document.createElement("span");
    //zoomOutSpan.className = "lnkBtn";
    zoomOutSpan.appendChild(document.createTextNode("zoom -"));
    zoomOutEl.appendChild(zoomOutSpan);
    GEvent.addDomListener(zoomOutEl, "click", function() {
        map.zoomOut();
    });
    map.getContainer().appendChild(container);
    return container;
}

// By default, the control will appear in the top left corner of the// map with 7 pixels of padding.
GeodesysZoomControl.prototype.getDefaultPosition = function() {  
    return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 7));
}

// Sets the proper CSS for the given button element.
GeodesysZoomControl.prototype.setStyle_ = function(element) {  
//    element.style.textDecoration = "underline";  
//    element.style.color = "#0000cc";  
//    element.style.backgroundColor = "white";  
//    element.style.font = "small Arial";  
//    element.style.border = "1px solid black";  
//    element.style.padding = "2px";  
//    element.style.marginBottom = "3px";  
//    element.style.textAlign = "center";  
    element.style.width = "60px";  
//    element.style.cursor = "pointer";
    element.className = "frmBtn";
//   element.style.background = "transparent url(_assets/css/images/imgFrmBtnBgR.jpg) no-repeat scroll 100% 0";
}

function GeodesysMapTypeControl() {
}

//Prototypal inheritance
GeodesysMapTypeControl.prototype = new GControl();

GeodesysMapTypeControl.prototype.initialize = function(map) {
    //Controls container div
    var container = document.createElement("div");
    container.className = "frmRow buttons";
    //Normal Map button div    
    var bnMapEl = document.createElement("button");
    this.setStyle_(bnMapEl);
    container.appendChild(bnMapEl);
    var bnMapSpan = document.createElement("span");
    //zoomInSpan.style.background-position-y = "100%";
    bnMapSpan.appendChild(document.createTextNode("map"));
    bnMapEl.appendChild(bnMapSpan);
    GEvent.addDomListener(bnMapEl, "click", function() {
        map.setMapType(G_NORMAL_MAP);
    });

    //Satellite Map button div
    var bnSatelliteEl = document.createElement("button");
    this.setStyle_(bnSatelliteEl);
    //zoomOutEl.style.top = "2px";
    //bnSatelliteEl.style.cssFloat = "left";
    //bnSatelliteEl.style.styleFloat = "left";
    container.appendChild(bnSatelliteEl);
    var bnSatelliteSpan = document.createElement("span");
    //zoomOutSpan.className = "lnkBtn";
    bnSatelliteSpan.appendChild(document.createTextNode("satellite"));
    bnSatelliteEl.appendChild(bnSatelliteSpan);
    GEvent.addDomListener(bnSatelliteEl, "click", function() {
        map.setMapType(G_SATELLITE_MAP);
    });

    //Hybrid Map button div    
    var bnHybridE1 = document.createElement("button");
    this.setStyle_(bnHybridE1);
    container.appendChild(bnHybridE1);
    var bnHybridSpan = document.createElement("span");
    //zoomInSpan.style.background-position-y = "100%";
    bnHybridSpan.appendChild(document.createTextNode("hybrid"));
    bnHybridE1.appendChild(bnHybridSpan);
    GEvent.addDomListener(bnHybridE1, "click", function() {
        map.setMapType(G_HYBRID_MAP);
    });
    map.getContainer().appendChild(container);
    return container;
}

// By default, the control will appear in the top left corner of the// map with 7 pixels of padding.
GeodesysMapTypeControl.prototype.getDefaultPosition = function() {
    return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
}

// Sets the proper CSS for the given button element.
GeodesysMapTypeControl.prototype.setStyle_ = function(element) {
    //    element.style.textDecoration = "underline";  
    //    element.style.color = "#0000cc";  
    //    element.style.backgroundColor = "white";  
    //    element.style.font = "small Arial";  
    //    element.style.border = "1px solid black";  
    //    element.style.padding = "2px";  
    //    element.style.marginBottom = "3px";  
    //    element.style.textAlign = "center";  
    element.style.width = "80px";
    //    element.style.cursor = "pointer";
    element.className = "frmBtn";
    //   element.style.background = "transparent url(_assets/css/images/imgFrmBtnBgR.jpg) no-repeat scroll 100% 0";
}