/* 
 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 CreateCallButton(elementOrID, spec)
{
    var buttonElement = elementOrID;
    if (elementOrID.nodeType != Node.ELEMENT_NODE) {
        buttonElement = document.getElementById(elementOrID);
    }
    
	if (!buttonElement.loaded) {
		buttonElement.loaded = true;
		buttonElement.object = new CallButton(buttonElement, spec);
    }
	
    return buttonElement.object;
}


CallButton.prototype = new PushButton();

function CallButton(buttonElement, spec)
{	
    var _self = this;
    PushButton.call(this, buttonElement, spec);
    this.element = buttonElement;
	this._phoneNumber = spec.phoneNumber;
    this.onclick = function() { _self.dialNumber() };    
}


CallButton.prototype.dialNumber = function()
{
    var encodedPhoneNumber = encodeURI(this._phoneNumber);
    window.location = "tel:" + encodedPhoneNumber;
}


CallButton.prototype.setPhoneNumber = function(phoneNumber)
{
	this._phoneNumber = phoneNumber;
}


CallButton.prototype.getPhoneNumber = function()
{
    return this._phoneNumber;
}

