<script>
function submitform(start,limit)
{
	document.searchfrm.act.value=document.location.href;
	document.getElementById("start").value=start;
	document.getElementById("limit").value=limit;
		
	//document.searchfrm.action = u;
	
	document.searchfrm.submit();
}
function gotolink(u,gallery_id)
{
	document.searchfrm.act.value=document.location.href;
	document.getElementById("gallery_id").value=gallery_id;
	document.searchfrm.action = u;
	
	document.searchfrm.submit();
}
</script>
<style>
.gal-box{
	width: 280px;
	height: 190px;
	border: 1px solid #CCC;
}
.gal-box img{
	width:230px;
	height: 150px;
}
</style>
<form name="searchfrm" id="searchfrm" action="<?php echo $page_name?>" method="post" target="_parent">
<input type="hidden" name="start" id="start" value="<?=$_REQUEST["start"]?>" />
<input type="hidden" name="limit" id="limit" value="<?=$_REQUEST["limit"]?>" />
<input type="hidden" name="act" id="act" value="" />
<input type="hidden" name="gallery_id" id="gallery_id" value="<?php echo $_REQUEST["gallery_id"]?>" />

<div style="padding-top:130px;">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="left" class="breadcrumb"><a href="index.php">Home</a> &raquo; <a href="gallery">Gallery</a> &raquo; <?php echo $photolist[0]->gallerytitle?></td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              <tr>
                <td><h2>Photos</h2></td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              <tr>
                <td><?php echo $photolist[0]->description?>
				 <div id="fancy">    
				<table width="100%" border="0" cellspacing="8" cellpadding="5" class="table table-responsive">
				<?php 
				$i =0;
              						  $j = 0;
				foreach($photolist as $gallery){
                  if($j % 3 == 0 && $j !=0)
              					{
              						$i=0;
              						echo "</tr>";
              						
              						echo "<tr>";
              					}
              					if($j == 0)
              					{
              						echo "<tr>";
              					}
								?>
				<td align="center">
					<table>
                    <div class="image-row">
									<div class="image-set">
						<tr>
							<td align="center">
							  <a target="_blank" class="example-image-link" data-lightbox="example-set" href="./static/uploadfiles/galleries/<?php echo $gallery->filename; ?>" title="<?php echo $gallery->title?>"><?php if($gallery->filename!='' and file_exists('./static/uploadfiles/galleries/'.$gallery->filename)){?>
                                   
                                    <img class="example-image img-thumbnail" src="./utility/processImage.php?imageName=<?php echo urlencode($gallery->filename); ?>&w=280&h=190&mod=3&type=2&<?php echo date("HisdmY");?>" border="0" /></a>
                                <?php }else{?>
                                    <a href="#"><img src="images/noimg.jpg" width="280" height="190" border="0" /></a></td>
                                <?php }?>
						</tr>
					
                  		<tr>
                    		<td align="center" class="box-brd"><?php echo $gallery->title?>&nbsp;</td>
                   
                  		</tr>
					</table>
				</td>
						<?php
								if($j == ($nume_prd -1 )){
									if($i == 1){
										echo '<td width="20%">&nbsp;</td>';
										echo '<td width="20%">&nbsp;</td>';
										echo '<td width="20%">&nbsp;</td>';
									}
									elseif($i == 2){
										echo '<td width="20%">&nbsp;</td>';									
										echo '<td width="20%">&nbsp;</td>';
									}
									elseif($i == 3){
										echo '<td width="20%">&nbsp;</td>';																			
									}
								}
			                $j++;
			                $i++;
              				?>
                 <?php }?>
                </table>
				</div>
				</td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              <tr><td colspan="5">
	  <?php /*?><table width="100%">
			 <tr>
			  		<td align="center" valign="top" bgcolor="#F5F5F5" class="td2">
                    	<a class="onav" href="#" onclick="submitform('0','<?php echo $_REQUEST['limit']?>')" >First</a>
                    </td>
                    <td  align="center" valign="top" bgcolor="#F5F5F5" class="td2">
						<?php //print_r($_POST);
                        if($_REQUEST["back"] >=0){
                        ?>
                        <a class="onav" href="#" onclick="submitform('<?php echo $_REQUEST["back"]?>','<?php echo $_REQUEST['limit'] ?>')">Prev</a>
                        <?php
                        }
                        ?>
                    </td>
                    <td align="center" valign="top" bgcolor="#F5F5F5" class="td2"><strong>Pages </strong>
                    <?php								  
						$l=1;
						$lastPage = ceil($_REQUEST["nume"]/($_REQUEST["limit"]));
						for($i=0;$i < $_REQUEST["nume"];$i=$i+$_REQUEST["limit"]){
						if($i <> $_REQUEST["eu"]){
							if($l == $lastPage){
								$lastPageLink = "'".$i."','".$_REQUEST['limit']."'";
							}
						?>
						<a class="onav" href="#" onclick="submitform('<?php echo $i?>','<?php echo $_REQUEST['limit']?>')"><?php echo $l; ?></a>
					<?php
						}
						else { 
								if($l == $lastPage){
									$lastPageLink = "#";
								}
						?>
							<span class="paging_pages_cur"><a href="#" class="selected" alt="<?php echo SEO_ENCHOR_ALT; ?>" title="<?php echo SEO_ENCHOR_TITLE; ?>"><?php echo $l; ?></a></span>
							<?php
								}       
							$l=$l+1;
							} 
					  ?>                  </td>
                    <td align="center" valign="top" bgcolor="#F5F5F5" class="td2">
						<?php  
						if($_REQUEST["th"] < $_REQUEST["nume"]) { 	
                        ?>
                      		<a class="onav" href="#" onclick="submitform('<?php echo $_REQUEST["next"]?>','<?php echo $_REQUEST['limit']?>')">Next</a>
                        <?php
						}
						?>
                    </td>
                    <td align="center" valign="top" bgcolor="#F5F5F5" class="td2"><a class="onav" href="#" onclick="submitform('<?php echo $lastPageLink; ?>')">Last</a></td>
                </tr>
			 </table><?php */?>
			 </td></tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              </table>
           </div>
</form>
