<style>

    .blank-150{width: 100%; height: 150px;}

</style>

<div class="row">

    <div class="col-xs-12 col-md-12">

        <?php if (isset($_SESSION['msg'])) { ?>

            <div class="alert alert-warning" role="alert"><?= $_SESSION['msg']; ?></div>

            <?php unset($_SESSION['msg']);

        }

        ?>

        <h2 align="center">Login</h2>

        <hr>

        <div id="alerta"></div>

        <h4 align="center"></h4>

        <div class="col-md-3"></div>

        <div class="col-md-6" id="area-cadastro" style="background: #BFBFBF; padding:26px;">



            <br />

            <div>

                <?php

                    if($this->uri->segment(3)){

                        if(stripos($this->uri->segment(3), "@")){

                            $email = $this->uri->segment(3);   

                        }else{

                            $email = '';

                        }

                    }else{

                        $email = '';

                    }

                ?>

                <form action="<?= base_url("site/logar") ?>" method="post" id="frmLogar">

                    <div class="form-group">

                        <input name="email" ctype="email" required class="form-control" value="<?=$email?>" id="Email" placeholder="Digite o seu email">

                    </div>

                    <div class="form-group">

                        <input name="senha" required type="password" class="form-control" value="" id="Email" placeholder="Digite a sua senha de acesso"  data-container="body" data-toggle="popover" data-placement="right" data-content="Digite a mesma senha de acesso do site Imazon">

                    </div>

                    <input type="submit" id="btn-cadastrar" class="btn btn-success btn-lg btn-block" value="Entrar">

                    <?php

                    if (isset($redir)) {//verfica redirecionamento

                        echo '<input type="hidden" name="redir" value="' . $redir . '"/>';

                    }

                    ?>

                </form>



            </div>



        </div>



        <div class="col-md-3"></div>

    </div>

    <div class="col-xs-4 col-md-3"></div>

    <div class="col-xs-4 col-md-6">

        <hr>

        <div class="well well-sm">Esqueceu a sua senha? <a id="rec-senha">Clique aqui</a> para recuperar.</div> 

    </div>    

    <div class="col-xs-4 col-md-3"></div>

</div>  



<script>



    function validaEmail(email) {

        var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

        if (re.test(email)) {

            return true;

        } else {

            return false;

        }

    }



    $("#rec-senha").click(function () {

        var email = $("#Email").val();

        if (!validaEmail(email)) {

            $("#alerta").html('<div class="alert alert-warning" role="alert">Digite um email v&aacute;lido!</div>');

            return false;

        } else {

            window.location.href = "<?= base_url("site/recuperar_senha/") ?>/" + encodeURI(email);

        }

    });

   

$(document).ready(function(){

    $('[data-toggle="popover"]').popover();   

});

</script>