/* 
 This file was generated by Dashcode and is covered by the 
 license.txt included in the project.  You may edit this file, 
 however it is recommended to first turn off the Dashcode 
 code generator otherwise the changes will be lost.
 */

// Note: Properties and methods beginning with underbar ("_") are considered private and subject to change in future Dashcode releases.


function CreateMapButton(elementOrID, spec)
{
    var buttonElement = elementOrID;
    if (elementOrID.nodeType != Node.ELEMENT_NODE) {
        buttonElement = document.getElementById(elementOrID);
    }
    
	if (!buttonElement.loaded) {
		buttonElement.loaded = true;
		buttonElement.object = new MapButton(buttonElement, spec);
    }
	
    return buttonElement.object;
}


MapButton.prototype = new PushButton();

function MapButton(buttonElement, spec)
{	
	var _self = this;

    PushButton.call(this, buttonElement, spec);
	this._address = spec.address;
    this.onclick = function() { _self.goToMap() };    
}


MapButton.prototype.goToMap = function() 
{
    var encodedAddress = encodeURI(this._address);
    window.location = "http://maps.google.com/maps?q=" + encodedAddress;
}


MapButton.prototype.setAddress = function(address)
{
	this._address = address;
}


MapButton.prototype.getAddress = function()
{
    return this._address;
}

