<style>
    input[type="submit"] {
        background: #0757a4;
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        border-radius: 3px;
        padding: 7px 15px;
        color: #fff;
        font-weight: 700;
        font-size: 14px;
        border: none;
        margin-top: 10px;
        cursor: pointer;
    }

    input[type="submit"]:hover {
        background: #104374;
    }

    .isa_success {
        color: #4F8A10;
        background-color: #DFF2BF;
    }

    .isa_error {
        color: #D8000C;
        background-color: #FFBABA;
    }

    .comments label {
        display: block;
        padding-bottom: 5px;
    }

    .comments input[type="text"],
    .comments textarea,
    .loginBox input[type="text"],
    .loginBox textarea,
    .loginBox input[type="password"] {
        width: 320px;
        padding: 5px;
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        border-radius: 3px;
        border: 1px solid #b6b6b6;
        margin-bottom: 8px;
    }

    input#btnFeedbackSubmit {
        display: inline-block;
    }

    img#loadingGif {
        display: inline-block;
    }

    pre.cake-error {
        display: none;
    }
</style>

<div class="bodyContent shadow">
    <h1><?php echo __("LBL_FEEDBACK"); ?></h1>
    <p><?php echo __("LBL_POSITIVE_EXPERIENCE_REGARDING_EXPENSE_MANAGEMENT"); ?></p>

    <div class="pageDivider"></div>

    <h4><?php echo __("LBL_ANY_CRITICISM_SUGGESTION_IDEA_GENERAL_FEEDBACK"); ?></h4>
    <p><?php echo __("LBL_WANT_TO-WRITE_SOMETHING_USE_THE_FROM_BELOW"); ?></p>



    <?php if (isset($captcha_error)) { ?>
        <p class="isa_error"><?php echo $captcha_error; ?></p>
    <?php } ?>

    <div class="pageDivider"></div>


    <?php echo $this->Form->create(null, array('class' => 'comments', 'url' => array('controller' => 'pages', 'action' => 'feedback'))); ?>

    <?php if (isset($error)) { ?>
        <p class="isa_error"><?php echo $error; ?></p>
    <?php } ?>

    <?php if (isset($success)) { ?>
        <p class="isa_success"><?php echo $success; ?></p>
    <?php } ?>

    <?php echo $this->Session->read('system.message'); ?>

    <label for="feedbackemail"><?php echo __("LBL_YOUR_EMAIL"); ?></label>
    <?php echo $this->Form->input('feedbackemail', array('label' => false)); ?>


    <?php if (isset($email_error)) { ?>
        <p class="isa_error"><?php echo $email_error; ?></p>
    <?php } ?>



    <label><?php echo __("LBL_COMMENT"); ?></label>
    <?php echo $this->Form->textarea('comment', array('rows' => '5', 'cols' => '45')); ?><button type="button" class="btn btn-primary tooltipBtn" data-toggle="tooltip" data-placement="right" title="<?php echo __('LBL_WRITE_YOUR_FEEDBACK'); ?>">?</button>
    <?php echo $this->Form->input('captcha', array('label' => false, 'div' => false, 'type' => 'hidden', 'value' => $captcha)); ?>


    <?php if (isset($comment_error)) { ?>
        <p class="isa_error"><?php echo $comment_error; ?></p>
    <?php } ?>

    <label><strong>Enter Captcha*:</strong></label>
    <input type="text" name="captcha" autocomplete="off" required />
    <p><img src="<?php echo HTTP_SITE_URL . '/captcha.php?rand=' . rand(); ?>" id='captcha_image'>
        <!--      <p><img src="--><?php //echo HTTP_SITE_URL.'/users/captcha/'.rand(); 
                                    ?>
        <!--" id='captcha_image'>-->
        Can't read the image? <a href='javascript: refreshCaptcha();'>click here</a> to refresh
    </p>



    <p>
        <?php if (isset($success)) { ?>


        <?php } else { ?>
            <?php echo $this->Form->end(array('label' => 'Submit', 'id' => 'btnFeedbackSubmit')); ?>
        <?php } ?>

    </p>


</div>


<!--<script src="<?php echo CDN_URL; ?>js/jquery-1.10.2.js"></script>-->
<script type="text/javascript">
    $(document).ready(function() {
        $(".submit").append('<img id="loadingGif" style="display: none;" src="<?php echo CDN_URL; ?>images/loading.gif" alt="">');
        $("form").submit(function() {
            $("#loadingGif").css("display", "inline-block");

        });

        $('#reload').click(function() {
            var captcha = $("#captcha_image");
            captcha.attr('src', captcha.attr('src') + '?' + Math.random());
            return false;
        });

    });
</script>
<!--<script src='https://www.google.com/recaptcha/api.js?onload=onloadCallback'></script>-->
<script>
    function refreshCaptcha() {
        var img = document.images['captcha_image'];

        img.src = img.src.substring(
            0, img.src.lastIndexOf("?")
        ) + "?rand=" + Math.random() * 1000;

        // img.src = img.src.substring(
        //     0,img.src.lastIndexOf("/")
        // )+"/"+Math.random()*1000;
    }
    /*var onloadCallback = function() {
            grecaptcha.execute();
        };
        function setResponse(response) {
            document.getElementById('captcha-response').value = response;
        }*/
</script>