<script>
function submitform(start,limit)
{
	document.getElementById("start").value=start;
	document.getElementById("limit").value=limit;
		
	//document.searchfrm.action = u;
	
	document.searchfrm.submit();
}
function gotolink(u,exp_id)
{
	document.searchfrm.act.value=document.location.href;
	document.getElementById("exp_id").value=exp_id;
	document.searchfrm.action = u;
	
	document.searchfrm.submit();
}
</script>
<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="search" />
<input type="hidden" name="exp_id" id="exp_id" value="" />
<input type="hidden" name="topic" id="topic" value="<?=$_REQUEST["topic"]?>" />
<input type="hidden" name="name" id="name" value="<?=$_REQUEST["name"]?>" />
<input type="hidden" name="description" id="description" value="<?=$_REQUEST["description"]?>" />
<div style="padding-top:40px;">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td colspan="2" align="left" class="breadcrumb"><a href="index.php">Home</a> &raquo; Sharing Experiences</td>
                </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
                </tr>
              <tr>
                <td width="76%"><h3>Sharing Experiences</h3></td>
                <td width="24%" align="right"><table width="100%" border="0" cellspacing="3" cellpadding="0">
                  <tr>
                    <td width="45%" align="center">&nbsp;</td>
                    <td width="55%" align="center"><a href="searchexp" class="button-grey">Search</a></td>
                  </tr>
                </table></td>
                </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
                </tr>
				<?php if(count($explist)>0){?>
              <tr>
                <td colspan="2"><table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table table-bordered table-striped">
                  <tr>
                    <td width="12%" height="28" align="center">&nbsp;</td>
                    <td width="58%"><strong>Experience</strong></td>
                    <td width="14%"><strong> Date</strong></td>
                    <td width="16%" align="center">&nbsp;</td>
                  </tr>
				  <?php 
				  foreach($explist as $exp){
				  ?>
                  <tr>
                    <td align="center" valign="top"><?php if($exp->simage!='' and file_exists('./static/uploadfiles/members/'.$exp->simage)){?>
					<img src="./static/uploadfiles/members/<?php echo $exp->simage?>" width="80px" height="80px" />
					<?php }else{
					?><img src="images/noimg.jpg" width="80px" height="80px" /><?php
					}?></td>
                    <td valign="top"><a href="#" onclick="gotolink('expdetails','<?php echo $exp->id;?>')" class="bnav"><?php echo $exp->topic?></a>- by <?php echo $exp->member?></td>
                    <td valign="top"><?php echo date('d.m.Y',strtotime($exp->tdate))?></td>
                    <td align="right" valign="middle"><a href="postexp" class="button1">Share Experience</a></td>
                  </tr>
                  <?php }?>
                </table></td>
              </tr>
			  <tr><td colspan="5">
						  <table width="98%" align="center">
								 <tr>
										<td height="37" align="center" valign="middle">
											<a class="onav" href="#" onclick="submitform('0','<?php echo $_REQUEST['limit']?>')" >First</a>
										</td>
										<td  align="center" valign="middle">
											<?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="middle"><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="middle" 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="middle" bgcolor="#F5F5F5" class="td2"><a class="onav" href="#" onclick="submitform('<?php echo $lastPageLink; ?>')">Last</a></td>
									</tr>
								 </table>
			 </td></tr>
			  <?php }
			 else{
			 ?>
			 	<tr>
                <td colspan="2"><font color=red>No Record Found</font></td>
                </tr>
			 <?php
			 }
			 ?>
              </table>
           </div>
</form>