<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,fid,mid,opt)
{
	if(opt=='family'){
		document.getElementById("family_id").value=fid;
	}
		document.getElementById("member_id").value=mid;
	document.searchfrm.action = u;
	
	document.searchfrm.submit();
}
function gotomsg(u,id,email,opt)
{
	if(opt=="family"){
		document.getElementById("family_id").value=id;
	}else{
		document.getElementById("member_id").value=id;
	}
	document.getElementById("email").value=email;
	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="member_id" id="member_id" value="" />
<input type="hidden" name="family_id" id="family_id" value="" />
<input type="hidden" name="email" id="email" value="" />
<input type="hidden" name="fname" id="fname" value="<?php echo $_REQUEST["fname"]?>" />
<input type="hidden" name="gender" id="gender" value="<?php echo $_REQUEST["gender"]?>" />
<input type="hidden" name="nativeplace" id="nativeplace" value="<?php echo $_REQUEST["nativeplace"]?>" />
<input type="hidden" name="search" id="search" value="yes" />
<input type="hidden" name="maritalstatus" id="maritalstatus" value="<?php echo $_REQUEST["maritalstatus"]?>" />
<input type="hidden" name="blood" id="blood" value="<?=$_REQUEST["blood"]?>" />
<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; Member Search Result</td>
      </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
      </tr>
              <tr>
                <td width="78%"><h3>Member Search Result</h3></td>
                <td width="22%"><table width="68%" border="0" align="right" cellpadding="0" cellspacing="0">
                  <tr>
                    <td align="center"><a href="searchmember" class="btn btn-blue">Search Member</a></td>
                  </tr>
                </table></td>
      </tr>
                <tr>
                <td colspan="2" align="center">
				<?php
					$CriteriaArr =array();
                	if(isset($_REQUEST['fname']) && $_REQUEST['fname']!=''){ $CriteriaArr[]=$_REQUEST['fname'];}
					if(isset($_REQUEST['area']) && $_REQUEST['area']!='' ){ $CriteriaArr[]=$_REQUEST['area'];}
					if(isset($_REQUEST['blood']) && $_REQUEST['blood']!=''){ $CriteriaArr[]=$_REQUEST['blood'];}
					if(isset($_REQUEST['about_business']) && $_REQUEST['about_business']!=''){ $CriteriaArr[]=$_REQUEST['about_business'];}
					$ctCnt = count($CriteriaArr);
					if($ctCnt > 0){
						echo "Search result for ";
						for($i=0;$i<$ctCnt;$i++){
							echo '"<span style="color:red">'.$CriteriaArr[$i].'</span>"';
							if($ctCnt != 1 && $i == ($ctCnt -2)) {
								echo " and ";
							}else if($ctCnt != 1 && $i != ($ctCnt -1)){
								echo ",";
							}
						}
					}
				?>
                </td>
                </tr>
              <tr>
                <td colspan="2">
				Total Members: <?php echo $_REQUEST["nume"];?></td>
      </tr>
              <tr>
				<?php if(count($memberlist)>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="19%" height="28" align="center">&nbsp;</td>
                    <td width="35%"><strong>Name</strong></td>
                    <td width="18%" align="center"><strong>Location</strong></td>
                    <td width="28%" align="center">&nbsp;</td>
                  </tr>
				  <?php
				  foreach($memberlist as $member){
				  /*if($_REQUEST["nativeplace"]==''){
				  	$member->simage = $member->fam_simage;
					$member->fullname = $member->fam_fullname;
					$member->gender = $member->fam_gender;
					$member->city = $member->fam_city;
				  }*/
				  ?>
                  <tr>
                    <td align="center" valign="top"><?php if($member->simage!='' and file_exists('./static/uploadfiles/members/'.$member->simage)){?>
					<img src="./static/uploadfiles/members/<?php echo $member->simage?>" width="80px" height="80px" />
					<?php }else{
					?><?php if($member->gender=="Male"){?>
						<img src="images/boy-icon.jpg" width="80px" height="80px" />
						<?php }else{
						?><img src="images/girl-icon.jpg" width="80px" height="80px" /><?php
						}?><?php
					}?></td>
                    <td valign="middle"><?php echo $member->fullname?><br /><strong>Family No: </strong><?php echo $member->familyno?></td>
                    <td align="center" valign="middle"><?php echo $member->city?></td>
                    <td align="center" valign="middle"><?php /*?><a href="#" onclick="gotolink('listfamily','<?php echo $member->id;?>')" class="bnav">Family&nbsp;Members(<?php echo $member->familymembers;?>)</a><br /><br /><?php */?>
					<?php
					if($_REQUEST["nativeplace"]==''){
					?>
					<a style="cursor:pointer" onclick="gotolink('viewfamily','<?php echo $member->id;?>','<?php echo $member->memberid;?>','family')" class="btn btn-blue">More</a>&nbsp;&nbsp;<a class="btn btn-blue" style="cursor:pointer" onclick="gotomsg('sendmessage','<?php echo $member->id;?>','<?php echo $member->email;?>','family')" class="btn btn-blue">Send Message</a>
					<?php }else{?>
					<a style="cursor:pointer" onclick="gotolink('memberdetails','<?php echo $member->id;?>','<?php echo $member->memberid;?>','member')" class="btn btn-blue">more</a>
					<br /><a style="cursor:pointer" onclick="gotomsg('sendmessage','<?php echo $member->id;?>','<?php echo $member->email;?>','member')" class="btn btn-blue">Send Message</a>
					<?php }?>
					
					</td>
                  </tr>
                 <?php }?>
                </table></td>
              </tr>
			  <tr><td colspan="5">
							  <table width="98%" align="center" cellspacing="1">
									 <tr>
											<td height="34" align="center" valign="middle">
												<a 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 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 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">
												<?php  
												if($_REQUEST["th"] < $_REQUEST["nume"]) { 	
												?>
													<a href="#" onclick="submitform('<?php echo $_REQUEST["next"]?>','<?php echo $_REQUEST['limit']?>')">Next</a>
												<?php
												}
												?>
											</td>
											<td align="center" valign="middle"><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
			 }
			 ?>
              <tr>
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="2" align="center">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="2" align="center">&nbsp;</td>
              </tr>
    </table>
  </div>
</form>