<script>
function gotopage(u)
{
	document.searchfrm.action = u;
	document.searchfrm.act.value='search';
	document.searchfrm.submit();
}
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)
{
	document.searchfrm.act.value='editprofile';
	document.searchfrm.action = u;
	
	document.searchfrm.submit();
}
function PrintFun(ID)
{
	window.open('','formpopup',"height=350,width=600,scrollbars=yes,left=50");
	document.searchfrm.act.value='printevent';
	document.getElementById("event_id").value=ID;
	document.searchfrm.action = 'printevent';
	document.searchfrm.target = 'formpopup';
	document.searchfrm.submit();
	
}
function EmailToFrined(ID)
{
	window.open('','formpopup',"height=350,width=600,scrollbars=yes,left=50");
	document.searchfrm.act.value='emailevent';
	document.getElementById("event_id").value=ID;
	document.searchfrm.action = 'emailevent';
	document.searchfrm.target = 'formpopup';
	document.searchfrm.submit();
}
function viewfamily(u,family_id)
{
	document.searchfrm.act.value=document.location.href;
	document.getElementById("family_id").value=family_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="family_id" id="family_id" value="<?php echo $memberlist->id?>" />
<input type="hidden" name="member_id" id="member_id" value="<?php echo $memberlist->memberid?>" />
<input type="hidden" name="search" id="search" value="<?php echo $_REQUEST["search"]?>" />
<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="maritalstatus" id="maritalstatus" value="<?php echo $_REQUEST["maritalstatus"]?>" />
<input type="hidden" name="blood" id="blood" value="<?=$_REQUEST["blood"]?>" />
<div style="padding-top:100px;">

<table width="99%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="left" class="breadcrumb"><a href="index.php" class="bnav">Home</a> &raquo; Family Detail</td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              
              <tr>
                <td><h3>Family Detail</h3></td>
                </tr>
              
              <tr>
                <td align="right">
				<?php
					if($_REQUEST["search"]=="yes"){
					?>
					<a onclick="gotopage('searchmember')" class="btn btn-primary">Back to Search Result</a>
					<?php }else{
					?>
						<a onclick="gotolink('listfamily','<?php echo $member->id;?>')" class="btn btn-primary">Back to Family&nbsp;Members</a>
					<?php
					}?>		
				</td>
                </tr>
             
              <tr>
                <td align="right">
                
                <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="85%" height="128" align="right">
					<?php if($memberlist->id==$_SESSION["family_id"]){?><a onclick="gotolink('editprofile')" class="button-grey">Edit Profile</a><?php }?>&nbsp;</td>
                    <td width="15%" align="right">
					<?php if($memberlist->fam_simage!='' and file_exists('./static/uploadfiles/members/'.$memberlist->fam_simage)){?>
					<img src="./utility/processImage.php?imageName=<?php echo urlencode($memberlist->fam_simage); ?>&w=95&h=115&mod=4&type=2&<?php echo date("HisdmY");?>" />
					<?php }
					
					else{
					?><?php if($memberlist->fam_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>
                  </tr>
                  
                  <tr>
                    <td height="27" >
					</td>
                  </tr>
                 
                  <tr>
                    <td height="26">
					<?php 
						$arr["Name"]=$memberlist->fam_fullname;
						$arr["Gender"]=$memberlist->fam_gender;
						$arr["Blood Group"]=$memberlist->fam_bloodgroup;
						if($memberlist->fam_dob!='' and $memberlist->fam_dob!='0000-00-00'){
							$arr["Birth Date"]=date('d/m/Y',strtotime($memberlist->fam_dob));
						}
						$arr["Relation with Member"]=$memberlist->fam_relationwithmember;
						$arr["Marital Status"]=$memberlist->fam_maritalstatus;
						$arr["Education"]=$memberlist->fam_education;
						$arr["Occupation"]=$memberlist->fam_occupation;
						$arr["Name of Company"]=$memberlist->fam_nameofcompany;
						$arr["Designation"]=$memberlist->fam_designation;
						$arr["Address"]=$memberlist->fam_address1.' '.$memberlist->fam_address2;
						
						$arr["City"]=$memberlist->fam_city;
						$arr["State"]=$memberlist->fam_state;
						$arr["Zipcode"]=$memberlist->fam_zip;
						$arr["Country"]=$memberlist->fam_country;
						$arr["Contact No."]=$memberlist->fam_phone;
						$arr["Email"]=$memberlist->fam_email;
						$arr["Business Website"]=$memberlist->fam_website;
					
					?>
                    
					<table width="100%" border="0" cellspacing="1" cellpadding="5" class="table table-bordered table-table-striped">
					<?php 
					$i =0;
					$j = 0;
					$countarr = count($arr);
					foreach($arr as $key => $value){
					if($value!='' and $value!=' '){
						if($j % 2 == 0 && $j !=0)
						{
						$i=0;
												
						echo "<tr>";
						}
						if($j == 0)
						{
						echo "<tr>";
						
						}
					?>
						<td width="18%" height="29"><strong> <?php echo $key?></strong></td>
                        <td width="32%"><?php echo $value?></td>
					<?php
								if($j == ($countarr -1 )){
									if($i == 1){
										echo '<td width="18%" height="29">&nbsp;</td>';
									}
									elseif($i == 2){
										echo '<td width="18%" height="29">&nbsp;</td>';									
										echo '<td width="18%" height="29">&nbsp;</td>';
									}
									elseif($i == 3){
										echo '<td width="18%" height="29">&nbsp;</td>';																			
									}
								}
			                $j++;
			                $i++;
              				?>
                 <?php }}?>
				
				 
					</table>
                    </td>
                  </tr>
                  
                  <tr>
                    <td height="26" colspan="2"><br />
					<h3>Other Members</h3><br />
					<table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table table-bordered table-striped">
                  <tr>
				  	<td width="12%" height="28" align="center">&nbsp;</td>
                    <td><strong>Name</strong></td>
                   <td><strong>Gender</strong></td>
				   <td><strong>Relation</strong></td>
				   <td><strong>Marital Status</strong></td>
                    <td align="center" >&nbsp;</td>
                  </tr>
				  <?php
				  foreach($othermembers as $member){
				  if($memberlist->fam_fullname!=$member->fam_fullname){
				  ?>
                  <tr>
                   <td align="center" valign="top" bgcolor="#F5F5F5" class="td2"><?php if($member->fam_simage!='' and file_exists('./static/uploadfiles/members/'.$member->fam_simage)){?>
					<img src="./utility/processImage.php?imageName=<?php echo urlencode($member->fam_simage); ?>&w=80&h=80&mod=4&type=2&<?php echo date("HisdmY");?>" />
					<?php }else{
					?>
					<?php if($member->fam_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->fam_fullname?></td>
					<td valign="middle"><?php echo $member->fam_gender?></td>
                    <td valign="middle"><?php echo $member->fam_relationwithmember?></td>
					<td valign="middle"><?php echo $member->fam_maritalstatus?></td>
                    <td align="center" valign="middle">
					<a style="cursor:pointer" onclick="viewfamily('viewfamily','<?php echo $member->id;?>')" class="btn btn-primary">More</a>
					</td>
					
                  </tr>
                 <?php }}?>
                </table></td>
                  </tr>
                </table></td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              </table>
              </div>
</form>