{extends file=$button.methods->getTemplatePath('general')}

{block name=button append}
	{$parentClass=$button.parent|get_class}

	<button type="button" id="{$button.id}"
		class="{$button.style.CSSClass}{if $button.style.special} special{/if}"
	>{$button.label}</button>
{/block}

<script type="text/javascript">
	{block name=script append}
		{if $button.parent}
			$('{$button.id}').observe('click', function(evt) {
				var element = evt.element();
				var form = $('{$button.parent->getId()}');
				{if $button.settings.events.onClick}
					{$button.settings.events.onClick|join:';'};
				{else}
					form.fire('form:doSubmit');
					element.disable();
				{/if}
			});
		{/if}
	{/block}
</script>
