<?php
include("includes/site_info.php");
include('session_handler.inc');

$WUserID = $_SESSION['Sess_UserId'];
$WUsername = $_SESSION['Sess_UserName'];
$gid = $_REQUEST['gid'];
$pid = $_REQUEST['pid'];
$galleryitem_query=mysql_query("SELECT * FROM galleryitem WHERE Gallery_ID = '$gid'") or die(mysql_error());
$galleryitem_TOTAL = mysql_num_rows($galleryitem_query);

$galleryname=mysql_result(mysql_query("SELECT Name FROM gallery WHERE mem_id = '$WUserID' and Gallery_ID = '$gid'"),0) or die(mysql_error());
?>
 <link rel="stylesheet" type="text/css" href="paginate.css" media="screen"/>
<script src="js/jquery.paginate.js" type="text/javascript"></script>
		<script type="text/javascript">
		jQuery(function($) {
			$("#demo5").paginate({
				count 		: <?=$galleryitem_TOTAL?>,
				start 		: 1,
				display     : 7,
				border					: true,
				border_color			: '#fff',
				text_color  			: '#fff',
				background_color    	: 'black',	
				border_hover_color		: '#ccc',
				text_hover_color  		: '#000',
				background_hover_color	: '#fff', 
				images					: false,
				mouse					: 'press',
				onChange     			: function(page){
											$('._current','#paginationdemo').removeClass('_current').hide();
											$('#p'+page).addClass('_current').show();
										  }
			});
		});
		</script>
<div id="top_panel" class="grey_row_back"><?php include ("panel_top.php"); ?></div>
			<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5" class="white_back_t_xb">
            <tr>
              <td><div class="light_orang_h">
                  <div style="background-color:#FF0000; width:10px; height:10px; float:left; margin-top:3px; margin-right:5px;"><img src="images/spacer.gif" width="10" height="10" /></div>
                <?=$galleryname?> </div>
                  <div class="dot_line"><img src="images/spacer.gif" width="1" height="1" /></div>
                <div class="solid_line"><img src="images/spacer.gif" width="1" height="1" /></div></td>
            </tr>
            <tr class="lightgrey_10">
              <td align="center"><?=$galleryitem_TOTAL?> <?php if ($galleryitem_TOTAL > 1) echo "photos"; else echo "photo"; ?> | <a href="#cgallery?gid=<?=$gid?>&uid=<?=$WUserID?>" onclick="javascript:callpage(this.href);" rel="subpage_link">Back to Album</a> | <a href="javascript:void(null)">Edit</a> | <a href="javascript:void(null)" onclick="">Delete</a></td>
            </tr>
<?php if ($galleryitem_TOTAL > 0){ ?>
            <tr>
              <td>
          <div id="paginationdemo" class="demo">
				<div id="demo5">                   
                </div>
<?php 	$i=0;
		while ($gallery = mysql_fetch_object($galleryitem_query) ) {
		$i++;
?>
                <div id="p<?=$i?>" <?php if ($gallery->GalleryItem_ID==$pid) echo "class=\"pagedemo _current\" style=\"\""; else echo "class=\"pagedemo\" style=\"display:none;\""; ?>><img src="<?=$SITE_MAIN_WWW_ROOT?>/members/<?=$WUsername?>/gallery/<?=$gallery->GalleryItem_ID?>.<?=$gallery->ext?>" class="img_b_p3" border="0"></div>
            </div>
          <?php } ?>              </td>
                </div>
            </tr>
		  <?php } ?>
			<!--<div align="center" class="padding_10 grey_10 style_left">
		  <div><img src="<?=$SITE_MAIN_WWW_ROOT?>/members/<?=$WUsername?>/gallery/<?=$gallery->GalleryItem_ID?>.<?=$gallery->ext?>" class="img_b_p3" border="0"><br />
		  			  <?php 
			  if ($gallery->Description) { 
			  echo "<span class=\"line_height20 left\">";
			  echo $gallery->Description;
			  echo "<br />";
			  echo "</span>";
              } 
			  ?>
			  </div>
			</div> -->
            <tr class="solid_line_separator">
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>

            <tr>
              <td>&nbsp;</td>
            </tr>
          </table></td>
  </tr>
</table>
