  {% if error %}
    <div class="alert alert-danger alert-dismissible">{{ text_payment_error}}: {{ error }}</div>
  {% else %}

  {% if text_testing %}
    <div class="alert alert-warning alert-dismissible">{{ text_testing }}</div>
  {% endif %}

  <div class="buttons">
    <div class="pull-right">
      <input type="button" value="{{ button_pay }}" id="button-confirm" data-loading-text="{{ text_loading }}" class="btn btn-primary" />
    </div>
  </div>

<script src="https://secure.ewaypayments.com/scripts/eCrypt.js"></script>
<script type="text/javascript">//<!--

	/**
	 * eWAY Rapid IFrame config object.
	 */
	var eWAYConfig = {
		sharedPaymentUrl: "{{ SharedPaymentUrl }}"
	};

	/**
	 * eWAY Rapid IFrame callback
	 */
	function resultCallback(result, transactionID, errors) {
		if (result == "Complete") {
			window.location.href = "{{ callback }}";
		} else if (result == "Error") {
			$('#button-confirm').button('reset');
			alert("{{ error_payment_text }}: " + result);
		} else {
			$('#button-confirm').button('reset');
		}
	}

	$('#button-confirm').bind('click', function() {
		$('#button-confirm').button('loading');
		eCrypt.showModalPayment(eWAYConfig, resultCallback);
	});

//--></script>

{% endif %}