<?
$pages=intval($arrBoardList["total"]/$arrBoardInfo["list"][0]["scale"]); 
if ($arrBoardList["total"] % $arrBoardInfo["list"][0]["scale"]) { 
	$pages++; 
} 
?>
<style type="text/css">  
   .imgResize { width: expression((this.width > 258)? ((this.height > 198)? ((this.width < this.height)? true : 100) : 258) :true); height: expression((this.height > 198)? ((this.width > 258)? ((this.width > this.height)? true : 258) : 198) :true); max-width: 258px; max-height: 198px;} 
</style>  
<script type="text/javascript">  
function setPos(img) {  
	var diff = 198 - img.offsetHeight; // 198은 스타일에서 지정한 이미지 최대 높이  
	if(diff > 0) {  
		img.style.marginTop = Math.floor(diff/2) + 'px';  
	}  
}  
</script> 

<div class="board-search"> 
	<div class="total-page">페이지정보 : <?=number_format(($_REQUEST[offset]/$arrBoardInfo["list"][0]["scale"])+1)?> / <?=number_format($pages)?> </div> 
    <div class="search">
        <form name="form1" method="get" action="<?=$_SERVER[DOCUMENT_URI]?>"> 
		<input type="hidden" name="boardid" value="<?=$arrBoardInfo["list"][0]["boardid"]?>">
		<input type="hidden" name="category" value="<?=$_GET["category"]?>">
        	<label for="bbsOption" class="hide">검색옵션</label>
            <select name="sw" id="bbsOption" class="select">
              <option value='a'<?=$_GET[sw]=="a"?" selected='selected'":""?>>전체</option>
			  <option value='s'<?=$_GET[sw]=="s"?" selected='selected'":""?>>제목</option>
			  <option value='c'<?=$_GET[sw]=="c"?" selected='selected'":""?>>내용</option>
			  <option value='n'<?=$_GET[sw]=="n"?" selected='selected'":""?>>작성자</option>
            </select>
            <label for="keyword" class="hide">search_word</label>
        	<input type="text" name="sk" id="keyword" value="<?=$_GET[sk]?>" class="input" title="검색어" /> 
			<button type="submit" class="btn btn-pack">검색</button>
        </form>
    </div>
</div>


<div class="gallery-list">
	<ul>
		<?
		if($arrBoardList["list"]["total"] > 0){
			for($i=0; $i < $arrBoardList["list"]["total"]; $i++){
		?>
        <li>	
			<a href="<?=$_SERVER[DOCUMENT_URI]?>?boardid=<?=$arrBoardInfo["list"][0]["boardid"]?>&mode=view&idx=<?=$arrBoardList["list"][$i][idx]?>&sk=<?=$_GET[sk]?>&sw=<?=$_GET[sw]?>&offset=<?=$_GET[offset]?>&category=<?=$_GET[category]?>">
				<div class="thumb">
					<?if($arrBoardList["list"][$i][re_name]!=""){?>
					<img src="/uploaded/board/<?=$arrBoardInfo["list"][0]["boardid"]?>/<?=$arrBoardList["list"][$i][re_name]?>" class='imgResize' onload="setPos(this);" alt="">
					<?
					}else{
						$contents = stripslashes($arrBoardList["list"][$i][contents]);
						preg_match_all("/<img[^>]*src=[\"']?([^>\"']+)[\"']?[^>]*>/i", $contents, $matches);
						if($matches[1][0]!=""){
					?>
					<img src="<?=$matches[1][0]?>" class='imgResize' onload="setPos(this);" alt="">
					<?}else{?>
					<img src="/images/bbs/noimg.gif" class='imgResize' onload="setPos(this);" alt="">
					<?}?>
					<?}?>
				</div>
				<div class="tit"><?=text_cut(stripslashes($arrBoardList["list"][$i][subject]),$arrBoardInfo["list"][0][subjectcut])?></div>
				<!-- <div class="date"><?=substr(str_replace("-",".",$arrBoardList["list"][$i][wdate]),0,10)?></div> -->
			</a>
		</li>
		<?}}else{?>
		<li>등록된 게시물이 없습니다.</li>
		<?}?>
	</ul>
</div>

<?if($arrBoardInfo["list"][0]["useadminonly"] !="Y" || $_SESSION[$_SITE["DOMAIN"]]["ADMIN"]["ID"]):?>
<div class="buttons">
	<div class="fr">
		<a href="<?=$_SERVER[DOCUMENT_URI]?>?boardid=<?=$arrBoardInfo["list"][0]["boardid"]?>&mode=write&category=<?=$_GET[category]?>" class="btn-pack medium">글쓰기</a>
	</div>
</div>
<?endif;?>

<div class="paginate">
    <?=pageNavigation($arrBoardList["total"],$arrBoardInfo["list"][0]["scale"],$arrBoardInfo["list"][0]["pagescale"],$_GET[offset],"boardid=".$arrBoardInfo["list"][0]["boardid"]."&sk=".$_GET[sk]."&sw=".$_GET[sw]."&category=".$_GET[category])?>
</div>
