{extends file=$smarty.const.SMARTY_LAYOUT_MAIN_POPUP_FORM}


{block name="buttons"}
	<div class="buttons layout-S-L">
		{if $form}
			<button class="button-back"
				type="button"
				onclick="MVC.redirectToEmailsList(this);"
			>{$lang['index']['buttons']['back']}</button>
		{/if}

		{block name="button_submit"}
			{if $form}
				{$form->renderButton($lang['index']['buttons']['send'])}
			{/if}
		{/block}
	</div>
{/block}

{block name="js" append}
	<script type='text/javascript'>
		MVC.scheduleOnLoad(function(){

			// back button
			MVC.redirectToEmailsList = function(element){
				window.location = MVC.appUrl('Documents/Generate/Email/EmailList/', 'index', { 'idDocument': '{$idDocument}' } );
			}

			{block name="onClosePopup"}
				{if $closePopup}
					window.location = MVC.appUrl('Documents/Generate/Email/EmailList/', 'index', { 'idDocument': '{$idDocument}' } );
				{/if}
			{/block}

		});
	</script>
{/block}