﻿Microsoft.Maps.Pushpin.prototype.getElement = function() {
    if (this.cm1001_er_etr == undefined || this.cm1001_er_etr == null)
        return;
    
    return this.cm1001_er_etr.dom;
}
/*
Microsoft.Maps.Pushpin.prototype.__defineGetter__('element', function() {
    if (this.cm1001_er_etr == undefined || this.cm1001_er_etr == null)
        return;
    
    return this.cm1001_er_etr.dom;
});
*/
Microsoft.Maps.Pushpin.prototype.setInfobox = function(infobox) {
    this.SCIInfobox = infobox;
};
Microsoft.Maps.Pushpin.prototype.getInfobox = function() {
    return this.SCIInfobox;
};
/*
Microsoft.Maps.Pushpin.prototype.setCustomInfobox = function(infobox) {
    this.SCICustomInfobox = infobox;
};
Microsoft.Maps.Pushpin.prototype.getCustomInfobox = function() {
    return this.SCICustomInfobox;
};
*/
Microsoft.Maps.Pushpin.prototype.showInfobox = function() {
    if (this.SCIInfobox != null && this.SCIInfobox != undefined) {       
        this.SCIInfobox.show();
    }
    /*
    if (this.SCICustomInfobox != null && this.SCICustomInfobox != undefined)
        SCICustomInfobox.show();*/
};
Microsoft.Maps.Pushpin.prototype.hideInfobox = function() {
    if (this.SCIInfobox != null && this.SCIInfobox != undefined)
        this.SCIInfobox.hide();
    /*
    if (this.SCICustomInfobox != null && this.SCICustomInfobox != undefined)
        SCICustomInfobox.hide();*/
};
Microsoft.Maps.Pushpin.prototype.addShowInfoboxHandler = function(handler, event) {
    this.removeShowInfoboxHandler();
    
    if (event == undefined)
        event = 'mouseover';
    
    this.SCIShowHandler = Microsoft.Maps.Events.addHandler(this, event, handler);
};
Microsoft.Maps.Pushpin.prototype.removeShowInfoboxHandler = function(handler) {
    if (this.SCIShowHandler != null && this.SCIShowHandler != undefined)
        Microsoft.Maps.Events.removeHandler(this.SCIShowHandler);
    
    this.SCIShowHandler = null;
};
Microsoft.Maps.Pushpin.prototype.addHideInfoboxHandler = function(handler, event) {
    this.removeHideInfoboxHandler();

    if (event == undefined)
        event = 'mouseover';
    
    this.SCIShowHandler = Microsoft.Maps.Events.addHandler(this, event, handler);
};
Microsoft.Maps.Pushpin.prototype.removeHideInfoboxHandler = function(handler) {
    if (this.SCIHideHandler != null && this.SCIHideHandler != undefined)
        Microsoft.Maps.Events.removeHandler(this.SCIHideHandler);  
    
    this.SCIHideHandler = null;
};
Microsoft.Maps.Pushpin.prototype.data = function(object, value) {
    if (this.SCIDataContainer == undefined)
        this.SCIDataContainer = {};
    
    if (value != undefined) {
        this.SCIDataContainer[object] = value;
        return;
    }
    
    if (this.SCIDataContainer.object != undefined)
        return this.SCIDataContainer.object;
    if (this.SCIDataContainer[object] != undefined)
        return this.SCIDataContainer[object];

    if (typeof object == "object")
        $.extend(this.SCIDataContainer, object);
    
    return undefined
};


Microsoft.Maps.Infobox.prototype.show = function() {
    var options = this.getOptions();
    options.visible = true;
    this.setOptions(options);
};
Microsoft.Maps.Infobox.prototype.hide = function() {
    var options = this.getOptions();
    options.visible = false;
    this.setOptions(options);
};

