<?php if ($msg != ''): ?>
    <script type="text/javascript">
        $(function(){
            $('#div_alert_text').text("<?php echo $msg; ?>");
            $('#div_alert').show();
        });
    </script>

<?php endif; ?>
<script type="text/javascript">
    $(function(){
        $('#alert_frm').css('display', 'none');
        $("#myform").validate();
        
        $('#password').bind('keypress', function(e) {
            if(e.keyCode==13){
                login();
            }
        });
    });
    
    function login(){
        $('#myform').submit();
    }
</script>

<div class="textbox">
    <div class="toolbar">
        <div class="pull-left title"><i class="icon-home"></i> <?php echo $page_title; ?></div>
        <div class="clear"></div>
    </div>
    <div class="textbox_content">
        <div id="div_alert" class="alert alert-error hide">
            <div id="div_alert_text"></div>
        </div>
        <?php echo form_open('login/login_check', array('id' => 'myform', 'style' => 'padding-bottom:0px;margin-bottom:0px')); ?>
        <input type="hidden" id="id" name="id" value="<?php echo @$row['id']; ?>"/>
        <table border="0" cellpadding="4" cellspacing="1" class="tblform">
            <tbody>
                <tr>
                    <td class="td1" width="150">ชื่อผู้ใช้งาน :<span class="required">*</span></td>
                    <td><input type="text" class="txt required"  id="username" name="username" style="width:300px;" value="<?php echo @$row['username']; ?>"/></td>
                </tr>
                <tr>
                    <td class="td1">รหัสผ่าน :<span class="required">*</span></td>
                    <td><input type="password" class="txt required"  id="password" name="password" style="width:300px;" value=""/></td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <div style="padding:10px 0 0 200px">
                            <a href="#" class="btn btn-primary" onclick="return login();"><i class="icon-ok-sign icon-white"></i> เข้าสู่ระบบ</a>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <?php echo form_close(); ?>
    </div>
</div>
