<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="member_id" id="member_id" value="<?php echo $memberlist->id?>" />
<input type="hidden" name="family_id" id="family_id" 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="maritalstatus" id="maritalstatus" value="<?php echo $_REQUEST["maritalstatus"]?>" />
<input type="hidden" name="nativeplace" id="nativeplace" value="<?php echo $_REQUEST["nativeplace"]?>" />
<input type="hidden" name="blood" id="blood" value="<?=$_REQUEST["blood"]?>" />
<input type="hidden" name="search" id="search" value="<?php echo $_REQUEST["search"]?>" />
<div style="padding-top:40px;">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="left" class="breadcrumb"><a href="index.php">Home</a> &raquo; Member Profile</td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              <tr>
                <td><h3>Member Profile</h3></td>
                </tr>
              <tr>
                <td align="right">
				<?php
					if($_REQUEST["search"]=="yes"){
					?>
					<a href="#" onclick="gotopage('searchmember')" class="btn btn-primary">Back to Search Result</a>
					<?php }else{
					?>
						<a onclick="gotolink('WelcomeMember','<?php echo $member->id;?>')" class="btn btn-primary">Back to 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"></td>
                    <td width="15%" align="right">
					<?php if($memberlist->simage!='' and file_exists('./static/uploadfiles/members/'.$memberlist->simage)){?>
					<img src="./utility/processImage.php?imageName=<?php echo urlencode($memberlist->simage); ?>&w=95&h=115&mod=4&type=2&<?php echo date("HisdmY");?>" />
					<?php }else{
					?><?php if($memberlist->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
					}?>
                    <br><br>
                    <?php if($memberlist->id==$_SESSION["member_id"]){?><a href="#" onclick="gotolink('editprofile')" class="btn btn-primary">Edit Profile</a><?php }?>&nbsp;
					</td>
                  </tr>
                  <tr><td>&nbsp;</td></tr>
                  <tr>
                    <td height="27" colspan="2">
					<?php 
						$arr["Name"]=$memberlist->fullname;
						$arr["Family No"]=$memberlist->familyno;
						$arr["Gender"]=$memberlist->gender;
						$arr["Blood Group"]=$memberlist->bloodgroup;
						if($memberlist->dob!='' and $memberlist->dob!='0000-00-00'){
							$arr["Birth Date"]=date('d/m/Y',strtotime($memberlist->dob));
						}
						if($memberlist->expirydate!='' and $memberlist->expirydate!='0000-00-00'){
							$arr["Anniversary Date"]=date('d/m/Y',strtotime($memberlist->expirydate));
						}
						$arr["Gam"]=$memberlist->nativeplace;
						$arr["Marital Status"]=$memberlist->maritalstatus;
						$arr["No. of Family Members"]=$memberlist->nooffamilymembers;
						$arr["Education"]=$memberlist->education;
						$arr["Occupation"]=$memberlist->occupation;
						$arr["Address"]=$memberlist->address1.' '.$memberlist->address2;
						
						$arr["City"]=$memberlist->cityname;
						$arr["State"]=$memberlist->state;
						$arr["Zipcode"]=$memberlist->zip;
						$arr["Country"]=$memberlist->countryname;
						$memberlist->showcontactinfo;
						if($memberlist->showcontactinfo==1){
							$arr["Contact No."]=$memberlist->phone;
							$arr["Mobile No."]=$memberlist->mobile;
							$arr["Email"]=$memberlist->email;
						}
						
						
						$arr["Company Name"]=$memberlist->bus_nameofcompany;
						$arr["Designation"]=$memberlist->bus_designation;
						$arr["Business Address"]=$memberlist->bus_address1.' '.$memberlist->bus_address2;
						$arr["Business City"]=$memberlist->bus_city;
						$arr["Business State"]=$memberlist->bus_state;
						$arr["Business Country"]=$memberlist->bus_country;
						$arr["Business Zipcode"]=$memberlist->bus_zip;
						$arr["Business Phone"]=$memberlist->bus_phone;
						$arr["Business Website"]=$memberlist->bus_website;
						$arr["Business Email"]=$memberlist->bus_email;
						$arr["Business Email"]=$memberlist->bus_nature;

					
					?>
					<table width="100%" border="0" cellspacing="1" cellpadding="5" class="table table-bordered"> 
					<?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>";
						
						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><td width="32%">&nbsp;</td>';
									}
									elseif($i == 2){
										echo '<td width="18%" height="29">&nbsp;</td><td width="32%">&nbsp;</td>';									
										echo '<td width="18%" height="29">&nbsp;</td><td width="32%">&nbsp;</td>';
									}
									elseif($i == 3){
										echo '<td width="18%" height="29">&nbsp;</td><td width="32%">&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">
                  <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->fullname!=$member->fam_fullname){
				  ?>
                  <tr>
                   <td align="center" valign="top"><?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>
             
              </table>
              </div>
</form>