

function MQNoAerialViewControl() {
    browser = MQA.getBrowserInfo();
    this.map = null;
    //this.position = new MQA.MapCornerPlacement(MQA.MapCorner.TOP_RIGHT, new MQA.Size(150, 0));
    
    this.elem = document.createElement("div");
    this.elem.style.position = "absolute";
    this.elem.style.overflow = "visible";
    
    temp = document.createElement("ul");
    temp.className = "map-view screen";
    this.elem.appendChild(temp);
    
    /* create street view section */
    temp1 = document.createElement("li");
    temp1.className = "map-view-street";
    temp.appendChild(temp1);
    
    this.streetview = document.createElement("img");
    this.streetview.className = "";
    this.streetview.border = 0;
    if (browser.name == "msie" && browser.version < 7) {
        this.streetview.src = "http://img.mqcdn.com/a/a";
        this.streetview.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://img.mqcdn.com/mqtoolkit/icon-btn-street-view.png', sizingMethod='image')";
    } else {
        this.streetview.src = "http://img.mqcdn.com/mqtoolkit/icon-btn-street-view.png";
    }
    this.streetview.alt = "View Street Map";
    this.streetview.title = "View Street Map";
    temp1.appendChild(this.streetview);

    /* create hybrid */
    temp1 = document.createElement("li");
    temp1.className = "map-view-hybrid-ws";
    temp.appendChild(temp1);
    
    this.hybridview = document.createElement("img");
    this.hybridview.className = "";
    this.hybridview.border = 0;
    if (browser.name == "msie" && browser.version < 7) {
        this.hybridview.src = "http://img.mqcdn.com/a/a";
        this.hybridview.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://img.mqcdn.com/mqtoolkit/icon-btn-hybrid-view.png', sizingMethod='image')";
    } else {
        this.hybridview.src = "http://img.mqcdn.com/mqtoolkit/icon-btn-hybrid-view.png";
    }
    this.hybridview.alt = "View Hybrid Map";
    this.hybridview.title = "View Hybrid Map";
    temp1.appendChild(this.hybridview);
}

MQNoAerialViewControl.prototype = new MQA.Control;
MQNoAerialViewControl.prototype.constructor = MQNoAerialViewControl;

MQNoAerialViewControl.prototype.destructor = function () {
   MQA.EventManager.removeListener(this.streetview, "click", this.MQEventCallbackObserver);
   MQA.EventManager.removeListener(this.streetview, "mouseover", this.MQEventCallbackObserver);
   MQA.EventManager.removeListener(this.streetview, "mouseout", this.MQEventCallbackObserver);
   MQA.EventManager.removeListener(this.hybridview, "click", this.MQEventCallbackObserver);
   MQA.EventManager.removeListener(this.hybridview, "mouseover", this.MQEventCallbackObserver);
   MQA.EventManager.removeListener(this.hybridview, "mouseout", this.MQEventCallbackObserver);
};

MQNoAerialViewControl.prototype.initialize = function (map) {
   this.map = map;
   this.type = MQA.CONTROL_TYPE;
   
   this.MQEventCallbackObserver = MQEventCallback(this, "eventmonitor");
   // MQA.EventManager.addListener(this.streetview, "click", this.MQEventCallbackObserver);
   dojo.connect(this.streetview, "click", this, "eventmonitor");
   // MQA.EventManager.addListener(this.streetview, "mouseover", this.MQEventCallbackObserver);
   dojo.connect(this.streetview, "mouseover", this, "eventmonitor");
   // MQA.EventManager.addListener(this.streetview, "mouseout", this.MQEventCallbackObserver);
   dojo.connect(this.streetview, "mouseout", this, "eventmonitor");
   // MQA.EventManager.addListener(this.hybridview, "click", this.MQEventCallbackObserver);
   dojo.connect(this.hybridview, "click", this, "eventmonitor");
   // MQA.EventManager.addListener(this.hybridview, "mouseover", this.MQEventCallbackObserver);
   dojo.connect(this.hybridview, "mouseover", this, "eventmonitor");
   // MQA.EventManager.addListener(this.hybridview, "mouseout", this.MQEventCallbackObserver);
   dojo.connect(this.hybridview, "mouseout", this, "eventmonitor");
   
   if (this.map.getMapType() == "map") {
      dojo.addClass(this.streetview,"a");
    }
   if (this.map.getMapType() == "hyb") {
      dojo.addClass(this.hybridview, "a");
    }
};

MQNoAerialViewControl.prototype.eventmonitor = function (evt) {
    switch (evt.type) {
      case "click":
        if (evt.currentTarget == this.streetview) {
            this.selectMode("street");
        }
        if (evt.currentTarget == this.hybridview) {
            this.selectMode("hybrid");
        }
        break;
      case "mouseover":
        dojo.addClass(evt.currentTarget, "o");
        break;
      case "mouseout":
        dojo.removeClass(evt.currentTarget, "o");
        break;
      default:;
    }
};

MQNoAerialViewControl.prototype.updateControl = function (mtype) {
    switch (mtype) {
      case "map":
        dojo.removeClass(this.hybridview, "a");
        dojo.addClass(this.streetview, "a");
        break;
      case "sat":
        dojo.removeClass(this.hybridview, "a");
        dojo.removeClass(this.streetview, "a");
        break;
      case "hyb":
        dojo.removeClass(this.streetview, "a");
        dojo.addClass(this.hybridview, "a");
        break;
      default:;
    }
   };
MQNoAerialViewControl.prototype.selectMode = function (mode) {
    var mtype = this.map.getMapType();
    var newMT = "noChange";
    if (mode == "street" && mtype != "map") {
        newMT = "map";
    }
    if (mode == "hybrid" && mtype != "hyb") {
        newMT = "hyb";
    }
    if (newMT != "noChange") {
        this.map.setMapType(newMT);
    }
};

MQNoAerialViewControl.prototype.getHeight = function () {
   return 22;
};

MQNoAerialViewControl.prototype.getWidth = function () {
   return 140;
};

function MQEventCallback(f_0, f_1) {
        var c45 = f_0;
        return function (event) {
        		if (c45.turnEventsOff || c45.f22 && c45.f22.turnEventsOff) {
        			return;
        		}
        		if (!event) {
        			event = window.event;
        		}
        		c45[f_1](event);
        	};
}

