/* 
 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.
 */

function CreateGlassButton(elementOrID, spec)
{
    var buttonElement = elementOrID;
    if (elementOrID.nodeType != Node.ELEMENT_NODE) {
        buttonElement = document.getElementById(elementOrID);
    }
    
	if (!buttonElement.loaded) {
		buttonElement.loaded = true;
        while (buttonElement.firstChild) {
            buttonElement.removeChild(buttonElement.firstChild);
        }

		var text = spec.text || '';
		if (window.dashcode && dashcode.getLocalizedString) text = dashcode.getLocalizedString(text);

		var onclick = spec.onclick || null;
		try { onclick = eval(onclick); } catch (e) { onclick = null; }

		buttonElement.object = new AppleGlassButton(buttonElement, text, onclick);
        buttonElement.object.element = buttonElement;
		buttonElement.object.setEnabled(!spec.disabled);
	}

	return buttonElement.object;
}
