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

$mod = $board[bo_gallery_cols]; 

if (!$board[bo_gallery_cols])
	$mod = 2;	// 가로 이미지 개수

$td_width = (int)(100 / $mod);

//섬네일 관련 설정
$thumb_width=200;//섬네일 최대폭 300
$thumb_height=200;//섬네일 최대높이
$view_width=566;//뷰이미지 폭 300

 //DQ엔진 인클루드 2005-03-22 석훈 
include_once "$g4[path]/thumbEngine/dq_thumb_engine2.php";
$dqEngine['thumb_resize']	= 2;

// 선택옵션으로 인해 셀합치기가 가변적으로 변함
$colspan = 10;
if ($is_category) $colspan++;
if ($is_checkbox) $colspan++;
if ($is_good) $colspan++;
if ($is_nogood) $colspan++;

// 제목이 두줄로 표시되는 경우 이 코드를 사용해 보세요.
// <nobr style='display:block; overflow:hidden; width:000px;'></nobr>
?>
<link rel="stylesheet" href="<?=$latest_skin_path?>/style.css" type="text/css" media="screen" />
  <script language="javascript">
   <!--
    function loadView(view) {
    	if(document.all) {
    		document.getElementById('viewImage').style.filter="blendTrans(duration=1)";
    		document.getElementById('viewImage').filters.blendTrans.Apply();
    	}
    	document.getElementById('viewImage').src = view;
    	if(document.all) {
    		document.getElementById('viewImage').filters.blendTrans.Play();
    	}
    }
    var viewSelected;
    var preloadviews=new Array();
	<? for ($i=0; $i<count($list); $i++) { ?>
<? 
        $image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면 
            if (preg_match("/\.(gif|jpg|png)$/i", $image)) { 
        echo "preloadviews[preloadviews.length]='$g4[path]/data/file/$bo_table/$image';"; // 이미지크기 
            } else {
        echo "preloadviews[preloadviews.length]=$latest_skin_path/img/no_image.gif';";
}
?>
	<? } ?>
    plv=new Array();
    for(i=0;i<preloadviews.length;++i)
    {	plv[i]=new Image();
    	plv[i].src=preloadviews[i];
    }
    	viewSelected = '1';
   -->
  </script>
		<script src="<?=$latest_skin_path?>/moo.js" type="text/javascript"></script>
			<table width='100%' cellspacing="3" cellpadding="0" id="topContentTable">
				<tr>
					<td valign="top" class="topContentCell"><div class="floatRight topContentThumbnails">
							<div id="arrowLeft" class="floatLeft topContentThumbnailArrowLeft"><a href="javascript:thumbnails.toggle(-1);"><img src="<?=$latest_skin_path?>/img/arrow_left.gif" width="24" height="23" border="0" alt="" onmousedown="src='<?=$latest_skin_path?>/img/arrow_left_disabled.gif';" onmouseup="src='<?=$latest_skin_path?>/img/arrow_left.gif';" /></a></div>
<div id="topContentThumbnailSlider" class="floatLeft">
								<div id="topContentThumbnailSliderContents">
						<? for ($i=0; $i<count($list); $i++) { ?>
				<?
				$image = $list[$i][file][0][file]; //공백으로인한썸네일깨짐방지
				$image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면
					if (preg_match("/\.(gif|jpg|png)$/i", $image)) {

					$thumbdir = $g4[path]."/data/file/".$bo_table ;

					$thumbsource="$g4[path]/data/file/$bo_table/" . $image;
					$thumbimg = $thumbdir."/".$list[$i][wr_id].".thumb";
					make_thumb($thumb_width,$thumb_height,$thumbsource,$thumbimg);
					@chmod($thumbimg, 0707);

					echo "<div class='floatLeft topContentThumbnail'><div class='topContentThumbnailContents'><a href=\"javascript:loadView('$g4[path]/data/file/$bo_table/$image');\"><img class='thumbnailImage' src='$thumbimg' width='100' height='100' border='0'></a></div></div>";

					} else {
					echo "<div class='floatLeft topContentThumbnail'><div class='topContentThumbnailContents'><a href=\"javascript:loadView('$latest_skin_path/img/no_image.jpg');\"><img class='thumbnailImage' src='$latest_skin_path/img/no_image.jpg' width='100' height='100' border='0'></a></div></div>"; 
					}
				?>
<? } ?>
</div></div><div id="arrowRight" class="floatLeft topContentThumbnailArrowRight"><a href="javascript:thumbnails.toggle(1);"><img src="<?=$latest_skin_path?>/img/arrow_right.gif" width="24" height="23" border="0" alt="" onmousedown="src='<?=$latest_skin_path?>/img/arrow_right_disabled.gif';" onmouseup="src='<?=$latest_skin_path?>/img/arrow_right.gif';" /></a></div></div></div></td></tr></table>
<?            
        //$image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면 
            if (preg_match("/\.(gif|jpg|png)$/i", $image)) { 
        echo "<div id=content class=img><img id='viewImage' src='$g4[path]/data/file/$bo_table/$image' width='{$view_width}' border='0'></div>"; // 이미지크기 
            } else 
        echo "<div id=content class=img><img id='viewImage' src='$latest_skin_path/img/no_image.gif' width='{$view_width}' border='0'></div>"; 
?> 
<input type="hidden" id="sliderCount" value="0">
<script language="javascript">
 <!--
  function updateArrows() {
  	var curCount = parseInt(document.getElementById('sliderCount').value);
  	var allCount = parseInt(document.getElementById('topContentThumbnailSliderContents').getElementsByTagName('div').length / 2);
  	if(curCount == 0) {
  		document.getElementById('arrowLeft').innerHTML = '<img src="<?=$latest_skin_path?>/img/arrow_left_disabled.gif" width="24" height="23" border="0" alt="" />';
  	}
  	else {
  		document.getElementById('arrowLeft').innerHTML = '<a href="javascript:thumbnails.toggle(-1);"><img src="<?=$latest_skin_path?>/img/arrow_left.gif" width="24" height="23" border="0" alt="" onmousedown="src=\'<?=$latest_skin_path?>/img/arrow_left_disabled.gif\';" onmouseup="src=\'<?=$latest_skin_path?>/img/arrow_left.gif\';" /></a>';
  	}
  	if(allCount > ((curCount + 1) * 4)) {
  		document.getElementById('arrowRight').innerHTML = '<a href="javascript:thumbnails.toggle(1);"><img src="<?=$latest_skin_path?>/img/arrow_right.gif" width="24" height="23" border="0" alt="" onmousedown="src=\'<?=$latest_skin_path?>/img/arrow_right_disabled.gif\';" onmouseup="src=\'<?=$latest_skin_path?>/img/arrow_right.gif\';" /></a>';
  	}
  	else {
  		document.getElementById('arrowRight').innerHTML = '<img src="<?=$latest_skin_path?>/img/arrow_right_disabled.gif" width="24" height="23" border="0" alt="" />';
  	}
  }
  updateArrows();
 -->
</script>
