<?php  if (isset($error)) { ?>
    <div class="warning">
    <?php
        if($debug == 1){
            echo '<strong>MercadoPago fails to connecet, and debug mode is on !!.<br /> Check the erros below and for security reasons turn it off after solve the problem:</strong><br />' ;
            echo '<pre>'; print_r($error); echo '</pre><br />';
        } else {
            echo '<strong>Sorry...MercadoPago fail to connect.<br /> If you are the store owner, turn on debug mode to get more details about the reason</strong><br />' ;
        }
    ?>

    </div>
<?php  } else { ?>
      <div class="flex middle-xs end-xs top-margin-large">
        <button type="button" id="button-confirm" class="btn-default btn-large">
          <span>Continuar</span>
        </button>
      </div>
      <script type="text/javascript"><!--
      window.waitEvent('scripts_document', function(){
        $('#button-confirm').bind('click', function() {
            $.ajax({
                type: 'GET',
                url: 'index.php?route=payment/mercadopago2/confirm',
                datatype: 'json',
                success: function(json) {
                    if(json['link']){
                        window.location = json['link'];
                    }
                }
            });
        });
    });
       </script>
<?php  } ?>
