<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 
?>

<link rel="stylesheet" href="<?php echo $member_skin_url; ?>/zip.css">

<section id="at-zip">
	<form name="fzip" method="get" autocomplete="off">
    <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="msg-box box-black">
		<i class="fa fa-search"></i> 찾으시는 동/읍/면/리를 입력해 주세요.
	</div>
	<div class="zip-box">
		<input type="text" name="addr1" value="<?php echo $addr1 ?>" id="addr1" placeholder="동/읍/면/리(필수)" required minlength=2>
		<button class="btn btn-danger" type="submit"><b><i class="fa fa-search"></i> 검색</b></button>
	</div>

	<!-- 검색결과 여기서부터 -->

    <script>
	    document.fzip.addr1.focus();
	</script>
	<? if ($search_count > 0) { ?>

		<br/><br/>

		<div class="msg-box box-black">
			<i class="fa fa-chevron-circle-down"></i> 총 <b><?php echo $search_count ?></b>건 가나다순 정렬
		</div>
		<?php for ($i=0; $i<count($list); $i++) { ?>
			<p><a href='javascript:;' onclick="find_zip('<?php echo $list[$i]['zip1']; ?>', '<?php echo $list[$i]['zip2']; ?>', '<?php echo $list[$i]['addr']; ?>');">
				<?php echo $list[$i]['zip1']; ?>-<?php echo $list[$i]['zip2']; ?> <?php echo $list[$i]['addr']; ?> <?php echo $list[$i]['bunji']; ?>
			</a></p>
		<?php } ?>
		<div class="msg-box box-black">
			<i class="fa fa-minus-circle"></i> 검색결과가 끝났습니다.
		</div>
	    <script>
			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();
				return false;
		    }
		</script>
    <?php } ?>
</section>
