<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,msg_id,exp_id)
{
	document.searchfrm.act.value=document.location.href;
	document.getElementById("exp_id").value=exp_id;
	document.getElementById("msg_id").value=msg_id;
	document.getElementById("expquote_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="" />
<input type="hidden" name="exp_id" id="exp_id" value="" />
<input type="hidden" name="msg_id" id="msg_id" value="" />
<input type="hidden" name="expquote_id" id="expquote_id" value="" />
<table width="99%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td colspan="2" align="left"><span class="td"><a href="index.php" class="bnav">Home</a> &raquo; Sharing Experiences Messages</span></td>
                </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
                </tr>
              <tr>
                <td width="76%"><h2>Sharing Experiences Messages</h2></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">
				<?php if($_REQUEST["nume"]!=0){?><br /><strong>Topic: </strong> <?php echo $explist[0]->topic;?><br /><hr /><?php }?>
				Total Messages: <?php echo $_REQUEST["nume"];?></td>
                </tr>
				<tr>
                <td cclass="font"><?php if($explist[0]->simage_e!='' and file_exists('./static/uploadfiles/expquotes/'.$explist[0]->simage_e)){?>
						<img src="./utility/processImage.php?imageName=<?php echo urlencode($explist[0]->simage_e); ?>&w=300&h=300&mod=7&type=1&<?php echo date("HisdmY");?>" />
					<?php }?></td>
              
                <td  class="font"><?php if($explist[0]->simage2_e!='' and file_exists('./static/uploadfiles/expquotes/'.$explist[0]->simage2_e)){?>
						<img src="./utility/processImage.php?imageName=<?php echo urlencode($explist[0]->simage2_e); ?>&w=300&h=300&mod=7&type=1&<?php echo date("HisdmY");?>" />
					<?php }?></td>
              </tr>
              <tr>
                <td colspan="2"><table width="98%" border="0" align="center" cellpadding="3" cellspacing="1">
                  <tr>
                    <td width="12%" height="28" align="center" bgcolor="#EFEFEF" class="td2">&nbsp;</td>
                    <td width="58%" bgcolor="#EFEFEF" class="td"><strong>Message</strong></td>
                    <td width="14%" bgcolor="#EFEFEF" class="td2"><strong> Date</strong></td>
                    <td width="16%" align="center" bgcolor="#EFEFEF" class="td2">&nbsp;</td>
                  </tr>
				  <?php 
				  foreach($explist as $exp){
				  ?>
                  <tr>
                    <td align="center" valign="top" bgcolor="#F5F5F5" class="td"><?php if($exp->photo!='' and file_exists('./static/uploadfiles/members/'.$exp->photo)){?>
						<img src="./utility/processImage.php?imageName=<?php echo urlencode($exp->photo); ?>&w=80&h=80&mod=4&type=2&<?php echo date("HisdmY");?>" width="80px" height="80px" />
					<?php }else{?>
						<img src="images/noimg.jpg" width="80px" height="80px" /></td>
					<?php }?></td>
                    <td valign="top" bgcolor="#F5F5F5" class="td"><?php echo substr($exp->title,0,200);?>- by <?php echo $exp->member?></td>
                    <td valign="top" bgcolor="#F5F5F5" class="td2"><?php echo date('d.m.Y',strtotime($exp->tdate))?></td>
                    <td align="right" valign="middle" bgcolor="#F5F5F5" class="td2"><a href="#" onclick="gotolink('msgdetail',<?php echo $exp->id?>,<?php echo $exp->expid?>)" class="button1">Read More</a></td>
                  </tr>
                  <?php }?>
                </table></td>
              </tr>
			  <tr><td colspan="5">
	  <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>
			 </td></tr>
              </table>
</form>