
OpenLayers.Control.StyledVirtualEarthButton = OpenLayers.Class(OpenLayers.Control.Button, {

    /**
    * Property: type
    * TYPE_BUTTON.
    */
    type: OpenLayers.Control.TYPE_BUTTON,

    /**
    * Property: baseQuerystring
    * String
    */
    baseQuerystring: null,

    /**
    * Property: parent_theme
    * (String)
    */
    parent_theme: null,

    /**
    * 
    */
    initialize: function() {
        OpenLayers.Control.Button.prototype.initialize.apply(this, arguments);
    },

    /**
    * Method: trigger
    */
    trigger: function(event) {
    },

    /**
    * Method: active_print
    * Setup event for print button
    */
    active_virtualEarth: function() {
        OpenLayers.Event.observe(this.div, "mousedown",
        OpenLayers.Function.bindAsEventListener(this.openVirtualEarthPage.bind(this), this.div));
        // Make hover event
        this.div.title = "Åben Bing Maps for visning af skråfotos";
        this.div.style.cursor = "pointer"; // Firefox & IE
    },

    /**
    * Method: openPrintPage
    * Method to open the printpage
    */
    openVirtualEarthPage: function(evt) {
        Event.stop(evt);
        var pConverted = this.map.getCenter().transform(new OpenLayers.Projection("EPSG:102113"), new OpenLayers.Projection("EPSG:4326"));
        var qs = 'v=2&mkt=da-dk&cp=' + pConverted.lat + '~' + pConverted.lon + '&style=o';

        var virtualearthwindow = window.open('VirtualEarth.aspx?' + qs, 'VirtualEarth', 'toolbar=no,titlebar=no,location=no,status=no,directories=no,menubar=no,width=1000px,height=800px,resizable=yes', true);
        if (virtualearthwindow) {
            virtualearthwindow.focus();
        }
    },

    CLASS_NAME: "OpenLayers.Control.StyledVirtualEarthButton"
});

