<?php
if (!defined("_GNUBOARD_"))
    exit; // 개별 페이지 접근 불가 
    /*
     * 우편번호 검색 스킨
     */
?>
<style type="text/css">
    body{margin: 0; padding: 0}
    
</style>
<div class="container">
    <div class="row register1">
        <div class="col-sm-12">
            <h2>우편번호 검색 <small>지번검색</small></h2>
            <form name="fzip" method="get" autocomplete="off" class="form-inline" role="form">
                <input type='hidden' name='frm_name'  value='<?php echo $frm_name ?>'>
                <input type='hidden' name='frm_zip1'  value='<?php echo $frm_zip1 ?>'>
                <input type='hidden' name='frm_zip2'  value='<?php echo $frm_zip2 ?>'>
                <input type='hidden' name='frm_addr1' value='<?php echo $frm_addr1 ?>'>
                <input type='hidden' name='frm_addr2' value='<?php echo $frm_addr2 ?>'>
                <div class="form-group">
                    <label class="control-label col-sm-3">읍면동 입력</label>
                    <div class='col-sm-9'>
                        <input type='text' name='addr1' class="form-control" value='<?php echo $addr1 ?>' required minlength=2 itemname='동(읍/면/리)' size=35 placeholder="동(읍/면/리)">
                        <button type='submit' class="btn btn-primary btn-100">검색</button>

                    </div>
                </div>
            </form>
        </div>
        <?php if ($search_count > 0) { ?>
            <div class="col-sm-12">
                <div class='panel panel-default'>
                    <div class="panel-heading">
                        총 <?php echo $search_count ?>건 가나다순
                    </div>

                    <ul class="list-group">
                        <?php
                        for ($i = 0; $i < count($list); $i++) {
                            echo "<li class='list-group-item'><a href='javascript:;' onclick=\"find_zip('{$list[$i]['zip1']}', '{$list[$i]['zip2']}', '{$list[$i]['addr']}');\">{$list[$i]['zip1']}-{$list[$i]['zip2']} : {$list[$i]['addr']} {$list[$i]['bunji']}</a></li>";
                        }
                        ?>
                    </ul>
                </div>
                
            </div>

            <script type="text/javascript">
                function find_zip(zip1, zip2, addr1)
                {
                var of = opener.document.<?php echo $frm_name ?>;

                of.<?php echo $frm_zip1 ?>.value  = zip1;
                of.<?php echo $frm_zip2 ?>.value  = zip2;

                of.<?php echo $frm_addr1 ?>.value = addr1;

                of.<?php echo $frm_addr2 ?>.focus();
                window.close();
                return false;
                }
            </script>
        <?php } ?>
    </div>


    <script type='text/javascript'>
        document.fzip.addr1.focus();
    </script>



</div>