
<div class="col-md-3">
   <!--PROFILE-->
   <?php
 
               echo $this->partial('/others/userprofile.phtml',array("UserID"=>$this->Profile["UserID"]));
                ?>
   <!--END PROFILE-->
   <!-- QUICK INFO-->
   <div class="panel panel-default form-horizontal margin-bottom-style">
      <div class="panel-body">
         <h3><span class="fa fa-info-circle"></span> Quick Info</h3>
         <p>Some quick info about <?=$this->Profile["FirstName"] ?></p>
      </div>
      <div class="panel-body form-group-separated">
         <div class="form-group">
            <label class="col-md-4 col-xs-5 control-label">Last visit</label>
            <div class="col-md-8 col-xs-7 line-height-30"><?= $this->Profile["LastLogin"] ?></div>
         </div>
         <div class="form-group">
            <label class="col-md-4 col-xs-5 control-label">Registration</label>
            <div class="col-md-8 col-xs-7 line-height-30"><?= $this->Profile["DateCreated"] ?></div>
         </div>
         <div class="form-group">
            <label class="col-md-4 col-xs-5 control-label">Groups</label>
            <div class="col-md-8 col-xs-7">administrators, managers, team-leaders, developers</div>
         </div>
         <div class="form-group">
            <label class="col-md-4 col-xs-5 control-label">Birthday</label>
            <div class="col-md-8 col-xs-7 line-height-30"><?=$this->Profile["DateOfBirth"]?></div>
         </div>
      </div>
   </div>
   <!--END QUICK INFO-->
</div>

<div class="col-md-9"  style="padding-left: 0">
   <!--  NEW NAVABAR -->
   <div class="col-md-12" style="padding: 0px; margin: 0px">
      <div class="panel panel-default">
         <div class="panel-body fix-navabar-height">
            <!--Add class <code>.page-navigation-top</code> to <code>.page-container</code> to use top navigation-->
            <h2 class="pull-left teamerit no-margin"><b>Edit</b> Profile</h2>
         
            <!--<a data-target="#Create-New-Squad" data-toggle="modal" class="btn  btn-primary btn-m pull-right " style="cursor: pointer"><span style="margin-right: 10px" class="hidden-Mobile">Create new team </span><i class="fa fa-plus-circle"></i></a>-->
            <!--<div class="pull-right"><a data-target="#Create-New-Squad" data-toggle="modal" class="btn  btn-primary btn-m" style="cursor: pointer"><span class="hidden-Mobile">Create new team </span><i class="fa fa-plus-circle"></i></a></div>-->
            <div class="pull-right"><a href="<?=$this->Back?>" class="btn btn-default btn-m pull-right " >Go Back   <i class="fa fa-arrow-left"></i></a></div>
            
            
         </div>
      </div>
   </div>
  
            
            
    <div class="panel panel-default">
      <div class="panel-heading">
         <h3 class="panel-title" id="TableTitle">Profile of (<?=$this->Profile['LastName'] ?>, <?=$this->Profile['FirstName'] ?>) </h3>
        
      </div>
       
         <div class="">
             <form class="form-group" id="EditDetailsTable" action="" method="post" width="100%">
            <!-- TABS WIDGET -->
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            <div class="panel panel-default nav-tabs-vertical margin-bottom-style" style="min-height:645px;">
            
                <ul class="nav nav-tabs " style=" border-right: 1px dashed #d5d5d5;min-height:645px;">
                  <li class="active"><a href="#tab01" data-toggle="tab">Profile</a></li>
                  <li><a href="#tab02" data-toggle="tab">Personal</a></li>
                   <li><a href="#tab04" data-toggle="tab">Contact Info</a></li>
                  <li><a href="#tab03" data-toggle="tab">Organization</a></li>
                 <?php if(getage($this->Profile["DateOfBirth"] )<19){?>
                  <li><a href="#tab05" data-toggle="tab">Parent/Guardian </a></li>
                 <?php } ?>
                  <li><a href="#tab06" data-toggle="tab">Medical Aid</a></li>
               </ul>
               <div class=" tab-content">
                   
                  <div class="tab-pane active" id="tab01">
                    
                        <div class="form-group">
                           <div class="col-md-12 site-padding ">
                              <div class="col-md-3">
                                 <label>Name(s)</label>
                              </div>
                              <div class="col-md-3">
                                  <input name="data[FirstName]" value="<?=$this->Profile['FirstName'] ?>" placeholder="First Names" type="text" class="form-control" id="fname"/>
                                 <span class="help-block">If more than one given name, please use a space to separate names. Example: John William</span>
                              </div>
                           
                              <div class="col-md-3">
                                  <input name="data[LastName]" placeholder="Surname" value="<?=$this->Profile['LastName'] ?>" type="text" class="form-control"/>
                                 <span class="help-block">Please enter the surname / last name, .</span>
                              </div>
                               <div class="col-md-3">
                                  <input name="data[NickName]" placeholder="NickName" value="<?=$this->Profile['NickName'] ?>" type="text" class="form-control"/>
                                 <span class="help-block">Please enter the name you are recognized, well known or generally known by</span>
                              </div>
                           </div>
                        </div>
                        
                        
                         <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>ID Document Type</label>
                              </div>
                              <div class="col-md-9">
                                  <select id="IDType" onchange="OnchangeIdType(this)" style="width:100%"  name="data[IDType]" class="form-control select IDType  col-md-12 requiredData" >
                                        <option value="1">South African ID No</option>
                                        <option value="2">Passport No</option>
                                        <option value="3">Birth Certificate No</option>
                                   </select>                            
                                       
                              </div>
                           </div>
                        </div>
                        <div class="form-group" id="IDColom">
                           <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>ID Number</label>
                              </div>
                              <div class="col-md-9">
                                 <input name="data[IDNUmber]" value="<?=$this->Profile['IDNumber'] ?>" type="text" class="form-control IDNumber" id="idNum"/>
                              </div>
                           </div>
                        </div>
                        <div class="form-group" id="PasspartColom"  >
                            <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>Passport Number</label>
                              </div>
                              <div class="col-md-2">
                                 <input type="text" name="data[PassportNumber]" value="<?=$this->Profile['PassportNumber'] ?>" class="form-control" id="passNum"/>
                              </div>
                              <!-- PASSPORT EXPIRTY DATE -->
                              <div class="col-md-2 padding-zero" style="margin-top:6px;">
                                 <label>Passport Expiry Date:</label>
                              </div>
                              <div class="col-md-5">
                                 
                                  
                                  
                                  <div class="col-md-4 padding-zero" style="padding-left:5px;">
                                    <select id="" name="birth[xday]" class="form-control select">
                                    <?php
                                       $aDays = range(1 , 31);
                                       $yearMonth = date("Y",strtotime($this->Profile["PassportExpireDate"]))."-".date("m",strtotime($this->Profile["PassportExpireDate"]));
                                       foreach ($aDays as $d) {
                                       
                                       if (date("d",strtotime($yearMonth."-".$d)) == date("d",strtotime($this->Profile["PassportExpireDate"]))) {
                                       echo "<option selected value='".date("d",strtotime($yearMonth."-".$d))."'>".date("d",strtotime($yearMonth."-".$d))."</option>";
                                       } else {
                                       echo "<option  value='".date("d",strtotime($yearMonth."-".$d))."'>".date("d",strtotime($yearMonth."-".$d))."</option>";
                                       }
                                       }
                                       ?>
                                    </select>
                                 </div>
                                 <div class = "col-md-4 padding-zero" style="padding-left:5px;">
                                    <select name="birth[xmonth]" class="form-control select">
                                    <?php
                                       $aMonth = array('01'=>'January','02'=>'February','03'=>'March','04'=>'April','05'=>'May','06'=>'June','07'=>'July','08'=>'August','09'=>'September','10'=>'October','11'=>'November','12'=>'December');
                                       
                                       foreach ($aMonth as $v=>$m) {
                                       if ($v == date("m",strtotime($this->Profile["PassportExpireDate"]))) {
                                       echo "<option selected value='$v' >$m</option>";
                                       } else {
                                       echo "<option value='$v' >$m</option>";
                                       }
                                       }
                                       ?>
                                    </select>
                                 </div>
                                 
                                   <div class="col-md-4 padding-zero">
																
                                    <select name="birth[xyear]" class="form-control select"  style="padding-left:5px;">													
                                    <?php
                                       $currYear = date(Y);
                                       $aYear = range(date("Y",strtotime($currYear))-100 , date("Y",strtotime($currYear)));
                                       foreach ($aYear as $y) {
                                       if ($y ==date("Y",strtotime($this->Profile["PassportExpireDate"])) ) {
                                       echo "<option selected value='$y' >$y</option>";
                                       } else {
                                       echo "<option value='$y' >$y</option>";
                                       }
                                       }
                                       ?>
                                    </select>
                                  
                                   </div>
                              </div>
                           </div>
                        </div>
                       <!-- <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>SA Rugby Player no</label>
                              </div>
                              <div class="col-md-9">
                                 <input name="data[SARugbyPlayerNo]" value="<?= $this->Profile['SARugbyPlayerNo'] ?>" type="text" class="form-control" id="SARugbyPlayerNo"/>
                                 <span class="help-block">Only enter if an official SARU player number has been assigned or known.</span>
                              </div>
                           </div>
                        </div>-->
                       
                        <div class="form-group">
                           <div class="col-md-12 site-padding borders-top-bottom">
                              <div class="col-md-3">
                                 <label>Birth Of Date</label>
                              </div>
                              <div class="col-md-9" style="margin-left:-1px;">
                               
                                  <div class="col-md-4 padding-zero" style="padding-left:5px;">
                                    <select id="" name="birth[day]" class="form-control select">
                                    <?php
                                       $aDays = range(1 , 31);
                                       $yearMonth = date("Y",strtotime($this->Profile["DateOfBirth"]))."-".date("m",strtotime($this->Profile["DateOfBirth"]));
                                       foreach ($aDays as $d) {
                                       
                                       if (date("d",strtotime($yearMonth."-".$d)) == date("d",strtotime($this->Profile["DateOfBirth"]))) {
                                       echo "<option selected value='".date("d",strtotime($yearMonth."-".$d))."'>".date("d",strtotime($yearMonth."-".$d))."</option>";
                                       } else {
                                       echo "<option  value='".date("d",strtotime($yearMonth."-".$d))."'>".date("d",strtotime($yearMonth."-".$d))."</option>";
                                       }
                                       }
                                       ?>
                                    </select>
                                 </div>
                                 <div class = "col-md-4 padding-zero" style="padding-left:5px;">
                                    <select name="birth[month]" class="form-control select">
                                    <?php
                                       $aMonth = array('01'=>'January','02'=>'February','03'=>'March','04'=>'April','05'=>'May','06'=>'June','07'=>'July','08'=>'August','09'=>'September','10'=>'October','11'=>'November','12'=>'December');
                                       
                                       foreach ($aMonth as $v=>$m) {
                                       if ($v == date("m",strtotime($this->Profile["DateOfBirth"]))) {
                                       echo "<option selected value='$v' >$m</option>";
                                       } else {
                                       echo "<option value='$v' >$m</option>";
                                       }
                                       }
                                       ?>
                                    </select>
                                 </div>
                                 
                                   <div class="col-md-4 padding-zero">
																
                                    <select name="birth[year]" class="form-control select"  style="padding-left:5px;">													
                                    <?php
                                       $currYear = date(Y);
                                       $aYear = range(date("Y",strtotime($currYear))-100 , date("Y",strtotime($currYear)));
                                       foreach ($aYear as $y) {
                                       if ($y ==date("Y",strtotime($this->Profile["DateOfBirth"])) ) {
                                       echo "<option selected value='$y' >$y</option>";
                                       } else {
                                       echo "<option value='$y' >$y</option>";
                                       }
                                       }
                                       ?>
                                    </select>
                                 </div>
                              </div>
                           </div>
                        </div>
                   
                  </div>
                  <div class="tab-pane" id="tab02">
                     
                        
                        
                        <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Playing Position </label>
                           </div>
                           <div class="col-md-9">
                              <select name="data[Player_Prim_Pos]" class="form-control select">
                              <?php
                                 if($this->Profile["Player_Prim_Pos"] == "" || $this->Profile["Player_Prim_Pos"] == 0 ) 
                                 {
                                 echo "<option value=''>--- Select Primary Position ---</option>";
                                 }
                                 
                                    foreach ($this->Positions as $p)
                                    { 
                                        echo '<option value="'.$p['PID'].'" ';
                                        if($this->Profile["Player_Prim_Pos"] == $p['PID']){ echo " selected ";}
                                        echo '>'.$p['Position'].' ('.$p['PID'].')</option>';                              
                                    }                                   
                                 ?>
                              </select>
                           </div>
                        </div>
                        <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Country of Birth</label>
                           </div>
                           <div class="col-md-9">
                               <select name="data[BirthCountry]" class="form-control select" onchange="ChangeCountry(this)">
                              <?php 
                                
                                 echo "<option value=''>--- Select Country of Birth ---</option>";
                                
                                 foreach ($this->Country as $v) {
                                     if ($v['country_name'] == $this->Profile["BirthCountry"]) {
                                     
                                         echo "<option selected code='". $v['phonecode'] ."' value='". $v['country_name'] ."' >" . $v['country_name'] . "</option>";
                                     
                                     } else {
                                         if(empty( $this->Profile["BirthCountry"]) && $v['country_name'] == "SOUTH AFRICAA"){
                                              echo "<option selected code='". $v['phonecode'] ."' value='". $v['country_name'] ."' >" . $v['country_name'] . "</option>";
                                     
                                         }else{
                                             echo "<option  code='". $v['phonecode'] ."' value='". $v['country_name'] ."' >" . $v['country_name'] . " </option>";
                                      
                                         }
                                     
                                        }   
                                 }
                                 ?>
                              </select>
                           </div>
                        </div>
                        <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>Place Of Birth</label>
                              </div>
                              <div class="col-md-9">
                                 <input name="data[BirthPlace]" value="<?= $this->Profile['BirthPlace'] ?>" type="text" class="form-control"/>
                              </div>
                           </div>
                        </div>
                        
                        <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Gender</label>
                           </div>
                           <div class="col-md-3">
                              <select id="" name="data[Sex]" class="form-control select">
                              <option value=''>--- Select Gender ---</option>
                              <option selected value='Male' <?php if($this->Profile['Sex'] =="Male"){ echo "selected"; }?> >Male</option>
                              <option selected value='Female' <?php if($this->Profile['Sex'] =="Female"){ echo "selected"; }?> >Female</option>
                              </select>
                           </div>
                        
                           <div class="col-md-3" style="text-align: right">
                              <label>Ethnicity</label>
                           </div>
                           <div class="col-md-3">
                              <select name="data[Ethnicity]" class="form-control select">
                              <?php
                                 if($this->Profile["Ethnicity"] == "") {
                                 echo "<option value=''>--- Select Ethnicity ---</option>";
                                 }
                                     $aEthnicity = array('African', 'White', 'Indian', 'Coloured'); 
                                 
                                     if (in_array($aEthnicity, $this -> Profile["Ethnicity"]))  {
                                         echo "<option selected value='". $this -> Profile["Ethnicity"] ."' >" . $this -> Profile["Ethnicity"] . "</option>";
                                     } else {
                                         foreach ($aEthnicity as $e) {
                                             echo "<option value='". $e ."' >" . $e . "</option>";
                                         }
                                     }
                                 ?>
                              </select>
                           </div>
                        </div>
                        <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                               <div class="col-md-3" >
                                 <label>Height (cm)</label>
                              </div>
                              <div  class="col-md-3">
                                 <input name="data[height]" value='<?= $this -> Profile["height"] ?>' type="text" class="form-control"/>
                                 <span class="help-block">Please enter Height in centimeters. (cm)</span>
                              </div>
                           
                              <div class="col-md-3" style="text-align: right">
                                 <label>Weight (kg)</label>
                              </div>
                              <div  class="col-md-3">
                                 <input name="data[weight]" value='<?= $this -> Profile["weight"] ?>' type="text" class="form-control"/>
                                 <span class="help-block">Please enter Weight in kilograms. (kg)</span>
                              </div>
                           </div>
                        </div>
                        <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>Disabled?</label>
                              </div>
                              <div class="col-md-9">
                                 <label class="check"><input type="checkbox" name="data[Disabled]"  value="1" /> Only tick if the player is part of Deaf or Wheelchair Rugby.</label>
                              </div>
                           </div>
                        </div>
                        <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Dietary Requirement(s)</label>
                           </div>
                           <div  class="col-md-2">
                               <label><input type="radio" value="0" onclick="DiettryType(this)" id="DiettryNone"  name="data[DiettryType]" <?php if($this->Profile["DiettryType"]==0){ echo 'checked'; } ?> /> None</label> 
                           </div>
                            <div  class="col-md-2">
                                <label><input type="radio" value="1" onclick="DiettryType(this)" id="DiettryHalaal" name="data[DiettryType]" <?php if($this->Profile["DiettryType"]==1){ echo 'checked'; } ?>/> Halaal</label> 
                           </div>
                            <div  class="col-md-2">
                                <label><input type="radio"  value="2" onclick="DiettryType(this)" id="DiettryVegetarian" name="data[DiettryType]" <?php if($this->Profile["DiettryType"]==2){ echo 'checked'; } ?>/> Vegetarian</label> 
                           </div>
                            <div  class="col-md-2">
                                <label><input type="radio" value="3" onclick="DiettryType(this)" id="DiettryOther" name="data[DiettryType]" <?php if($this->Profile["DiettryType"]==3){ echo 'checked'; } ?> /> Other</label> 
                           </div>
                        </div>
                      <div class="col-md-12 site-padding site-border-top"   style=" <?php if($this->Profile["DiettryType"]!=3){ echo 'display: none'; } ?>" id="otherSpecify">
                           <div class="col-md-3">
                              <label>Dietary Other (Specify)</label>
                           </div>
                           <div class="col-md-9">
                               <textarea name="data[DiettryOther]"  class="form-control " id="otherSpecifyText"><?=$this -> Profile["DiettryOther"]?></textarea>
                                 
                              </div>
                            
                        </div>
                        
                   
                  </div>
                  <div class="tab-pane" id="tab03">
                        <div class="col-md-12 site-padding site-border-top" style="margin-top:15px;">
                           <div class="col-md-3">
                              <label>Organization Type</label>
                           </div>
                           <div class="col-md-9">
                               <select  id="OrganizationType"  name="data[UnionType]" onchange="OrganizationTypeee()" class="form-control select requiredField">
                                
                                 <?php 
                                    
                                    foreach ($this->listTypesUnions as $type)
                                    {
                                    	
                                    			echo '<option value="'.$type['type_id'].'"   parant="'.$data['parentid'].'"    type="'.$type['type_id'].'"';
																						
                                                        if($type['type_id']== $this->Profile["UnionType"] ){ echo " selected ";}
                                            echo '>'.$type['Text'].'</option>';
                                    		
                                   }
                                        ?>
																			
				
                              </select>
                              
                              <span class="help-block">Select the type or kind of organization that you are registered or part of.</span>
                           </div>
                        </div>
                        <div class="col-md-12 site-padding site-border-top"  id="OrganizationWrapa">
                           <div class="col-md-3">
                              <label>Institution / Organization</label>
                           </div>
                           <div class="col-md-9">
                              <select  data-live-search="true" id="Organization" name="data[UnionID]" class="form-control select">
                                
                                
                              </select>
                              <span class="help-block">Select the name of the organization you are currently registered with or part of.</span>
                           </div>
                        </div>
                        <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Primary School</label>
                           </div>
                           <div class="col-md-9">
                              <input name="data[PrimarySchool]" value='<?= $this->Profile["PrimarySchool"] ?>' type="text" class="form-control" id=""/>
                           </div>
                        </div>
                        <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Secondary School</label>
                           </div>
                           <div class="col-md-9">
                              <input name="data[SecondarySchool]" value='<?= $this->Profile["SecondarySchool"] ?>' type="text" class="form-control" id=""/>
                           </div>
                        </div>
                        <div class="col-md-12 site-padding borders-top-bottom">
                           <div class="col-md-3">
                              <label>Tertiary Institution</label>
                           </div>
                           <div class="col-md-9">
                              <input name="data[TertiaryInstitution]" value='<?= $this->Profile["TertiaryInstitution"] ?>' type="text" value="" class="form-control"/>
                           </div>
                        </div>
                  </div>
                  <div class="tab-pane" id="tab04">
                        <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>Street Name</label>
                              </div>
                              <div class="col-md-9">
                                 <input name="data[address]" value='<?= $this->Profile["address"] ?>' class="form-control"/>
                              </div>
                           </div>
                        </div>
                        <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>Suburb</label>
                              </div>
                              <div class="col-md-3">
                                 <input name="data[suburb]" value='<?= $this->Profile["suburb"] ?>'type="text" class="form-control"/>
                              </div>
                          
                              <div class="col-md-3">
                                 <label>City</label>
                              </div>
                              <div class="col-md-3" style="text-align: right">
                                 <input name="data[city]" value='<?= $this->Profile["city"] ?>' type="text" class="form-control" id=""/>
                              </div>
                           </div>
                        </div>
                        <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              
                           
                              <div class="col-md-3">
                                 <label>Province</label>
                              </div>
                              <div class="col-md-3">
                                 <input name="data[Province]" value='<?= $this->Profile["Province"] ?>' type="text" class="form-control" id=""/>
                              </div>
                               <div class="col-md-3" style="text-align: right">
                                 <label>Postal Code</label>
                              </div>
                              <div class="col-md-3">
                                 <input name="data[postal]" value='<?= $this->Profile["postal"] ?>' type="text" value="" class="form-control postal-code"/>
                              </div>
                           </div>
                        </div>
                        <div class="col-md-12 site-padding borders-top-bottom">
                           <div class="col-md-3">
                              <label>Country</label>
                           </div>
                           <div class="col-md-9">
                               <select name="data[country]" value='<?= $this->Profile["country"] ?>' class="form-control select" onchange="ChangeCountryTwo(this)">
                             <?php 
                                
                                 echo "<option value=''>--- Select Country of Birth ---</option>";
                                
                                 foreach ($this->Country as $v) {
                                     if ($v['country_name'] == $this->Profile["BirthCountry"]) {
                                     
                                         echo "<option selected code='". $v['phonecode'] ."' value='". $v['country_name'] ."' >" . $v['country_name'] . "</option>";
                                     
                                     } else {
                                         if(empty( $this->Profile["BirthCountry"]) && $v['country_name'] == "SOUTH AFRICAA"){
                                              echo "<option selected code='". $v['phonecode'] ."' value='". $v['country_name'] ."' >" . $v['country_name'] . "</option>";
                                     
                                         }else{
                                             echo "<option  code='". $v['phonecode'] ."' value='". $v['country_name'] ."' >" . $v['country_name'] . " </option>";
                                      
                                         }
                                     
                                        }   
                                 }
                                 ?>
                              </select>
                           </div>
                        </div>
                      <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>Email Address</label>
                              </div>
                              <div class="col-md-9">
                                 <input name="data[Email]" value="<?= $this->Profile['Email'] ?>" type="text" class="form-control" id="AddEmail"/>
                              </div>
                           </div>
                        </div>
                      <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>Mobile</label>
                              </div>
                              <div  class="col-md-3">
                                 <input name="data[Mobile]" value='<?= $this->Profile["Mobile"] ?>' type="text"  class="form-control mobile-number"/>
                              </div>
                          
                              <div class="col-md-3" style="text-align: right">
                                 <label>Telephone</label>
                              </div>
                              <div  class="col-md-3">
                                 <input name="data[alt_mobile]" value='<?= $this->Profile["alt_mobile"] ?>' type="text" class="form-control mobile-number"/>
                              </div>
                           </div>
                        </div>
                        
                  </div>
                   <?php if(getage($this->Profile["DateOfBirth"] )<19){?>
                  <div class="tab-pane" id="tab05">
                        <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <span style="margin-left:13px;"><b>Parent/Guardian</b> (If the player is under the age of 18 please complete the contact details of Parent and/or legal Guardian)</span>
                           </div>
                        </div>
                        <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>Full Name</label>
                              </div>
                              <div class="col-md-3">
                                 <input name="data[parent_FirstName]" value='<?= $this->Profile["parent_FirstName"] ?>' type="text" class="form-control"/>
                              </div>
                               <div class="col-md-3" style="text-align: right">
                                 <label>Surname</label>
                              </div>
                              <div class="col-md-3">
                                 <input name="data[parent_LastName]" value='<?= $this->Profile["parent_LastName"] ?>' type="text" class="form-control"/>
                              </div>
                           </div>
                        </div>
                      
                      <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>Contact details</label>
                              </div>
                              <div  class="col-md-3">
                                  <input name="data[parent_Home]" placeholder="Home" value='<?= $this->Profile["parent_Home"] ?>' type="text"  class="form-control mobile-number"/>
                              </div>
                          <div  class="col-md-3">
                                  <input name="data[parent_Work]" placeholder="Work" value='<?= $this->Profile["parent_Work"] ?>' type="text"  class="form-control mobile-number"/>
                              </div>
                           
                          <div  class="col-md-3">
                                  <input name="data[parent_Cell]" placeholder="Cell" value='<?= $this->Profile["parent_Cell"] ?>' type="text"  class="form-control mobile-number"/>
                              </div>
                          </div>
                      </div>
                        <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>Email</label>
                              </div>
                              <div class="col-md-3">
                                 <input name="data[parent_Email]" value='<?= $this->Profile["parent_Email"] ?>'  type="text" class="form-control" >
                              </div>
                           
                           <div class="col-md-3" style="text-align: right">
                              <label>Relationship</label>
                           </div>
                           <div class="col-md-3">
                              <input name="data[relation]" value='<?= $this->Profile["relation"] ?>' type="text" class="form-control"/>
                           </div>
                        
                           </div>
                        </div>
                      
                      <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <span style="margin-left:13px;"><b>Next of Kin</b> (Contact details for any family members/ friend)</span>
                           </div>
                        </div>
                        <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>Full Name</label>
                              </div>
                              <div class="col-md-3">
                                 <input name="data[nextkin_Firstname]" value='<?= $this->Profile["nextkin_Firstname"] ?>' type="text" class="form-control"/>
                              </div>
                               <div class="col-md-3" style="text-align: right">
                                 <label>Surname</label>
                              </div>
                              <div class="col-md-3">
                                 <input name="data[nextkin_Lastname]" value='<?= $this->Profile["nextkin_Lastname"] ?>' type="text" class="form-control"/>
                              </div>
                           </div>
                        </div>
                      
                      <div class="form-group">
                           <div class="col-md-12 site-padding site-border-top">
                              <div class="col-md-3">
                                 <label>Cell #</label>
                              </div>
                              <div  class="col-md-3">
                                  <input name="data[nextkin_Cell]" placeholder="Cell" value='<?= $this->Profile["nextkin_Cell"] ?>' type="text"  class="form-control mobile-number"/>
                              </div>
                          
                            <div class="col-md-3"  style="text-align: right">
                                 <label>Relationship</label>
                              </div>
                          <div  class="col-md-3">
                                  <input name="data[nextkin_Relationship]" placeholder="Relationship" value='<?= $this->Profile["nextkin_Relationship"] ?>' type="text"  class="form-control"/>
                              </div>
                          </div>
                      </div>
                        
                  </div>
                   <?php }?>
                   <div class="tab-pane" id="tab06">
                    
                        
                        <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Medical Aid Name</label>
                           </div>
                           <div class="col-md-9">
                              <input name="data[MedicalAidName]" value='<?= $this->Profile["MedicalAidName"] ?>' type="text" class="form-control"/>
                           </div>
                        </div>
                        <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Number</label>
                           </div>
                           <div class="col-md-9">
                              <input name="data[MedicalAidNumber]" value='<?= $this->Profile["MedicalAidNumber"] ?>' type="text" class="form-control"/>
                           </div>
                        </div>
                         <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Main Member </label>
                           </div>
                           <div class="col-md-9">
                              <input name="data[MedicalAidMainMember]" value='<?= $this->Profile["MedicalAidMainMember"] ?>' type="text" class="form-control"/>
                           </div>
                        </div>
                    
                  </div>
                    
               </div>
            </div>
            <!-- END TABS WIDGET -->
         </form>
              <div class="modal-footer">       
            <button type="button" class="btn btn-primary" onclick="SaveData(this)">Save ...</button>                  
         </div>
             <div style="clear: both"></div>
         </div>
          
  
   </div>        
            
   <div>
   	
  <script>
    $(function(){
        $(".mobile-number").mask('(999) 999-9999');
        $(".postal-code").mask('9999');
        $(".IDNumber").mask('9999999999999');
        
        OrganizationTypeee();
        OrganizationTypeInit();
    });
    
function OnchangeIdType(e){
    var id = $(e).val();
    if(id ==2){
       
         $("#IDColom").hide();
         $("#idNum").val('<?=$this->Profile["IDNumber"]?>');
         $("#idNum").css({"border":"1px solid #ccc"})
    }else{
        
         $("#IDColom").show(); 
    }
}

function SaveData(e){


   var data = $("#EditDetailsTable").serialize();
   //validate the data first
   var error = 0;
   var SAID = $("#idNum").val();
   var IDType = $("#IDType").val();
    if(IDType !=2){
   
        var validate = validateSAID(SAID) ;
        if(validate==false){
            error =1;
           
            noty({
   text: 'ID Number is invalid!',
   layout: 'topRight',
   closeWith: ['click', 'hover'],
   timeout: 5000,
   type: 'error'
});
            $("#idNum").css({"border":"1px solid #f00"});
        }
   
    }
   
   if(error ==0){
       $(e).attr('disabled','disabled');
       $.post("/union/members/member/id/<?=$this->Profile["UserID"]?>",data,function(r){
           noty({
                text: 'Profile updated sucessfully!',
                layout: 'topRight',
                closeWith: ['click', 'hover'],
                timeout: 3000,
                type: 'success',
                callback: {
                    onShow: function() {},
                    afterShow: function() {},
                    onClose: function() {},
                    afterClose: function() {window.location.href = '<?=$this->Back?>';},
                    onCloseClick: function() {},
                }
             });
             $(e).removeAttr('disabled');
             
             
        });
         
   }else{
       
   }
   
}
function DiettryType(e)
{
    var type = $(e).val();
    if(type==3){
        $("#otherSpecify").show();
        $("#otherSpecifyText").val('<?=$this -> Profile["DiettryOther"]?>');
    }else{
        $("#otherSpecify").hide();
        $("#otherSpecifyText").val();
    }
 }
function OrganizationTypeee(){
  var type = $("#OrganizationType").val();
  $("#OrganizationWrapa li").hide();
  
  $("#OrganizationWrapa .line"+type).parent("li").show();
  $("#Organization").val(0);
}
function OrganizationTypeInit(){
                    //Organization

  $("#OrganizationWrapa li").hide();
  
  $("#OrganizationWrapa .line3").parent("li").show();
  $("#Organization").val(0);
}


function checkid(e){
    var SAID = $(e).val();
    $(e).css({"border":"1px solid #ccc"})
    var IDType = $("#IDType").val();
    if(IDType !=2){
    if(SAID.length==13){
        var validate = validateSAID(SAID) ;
        if(validate==false){
            $(e).css({"border":"1px solid #f00"});
            console.log(validate);
        }else{
            $(e).css({"border":"1px solid #ccc"})
        }
    }
    }
    
}


function ValidateEmail(mail)   
    {  
     if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail))  
      {  
        return (true)  
      }  

        return (false)  
    }
    
    function validateSAID(id){
       try {
           if (id.length != 13) {
     
     return false;
     }
           var y1o = id.substring(0, 1)
           var y2e = id.substring(1, 2)
           var m1o = id.substring(2, 3)
           var m2e = id.substring(3, 4)
           var d1o = id.substring(4, 5)
           var d2e = id.substring(5, 6)
           var go = id.substring(6, 7)
           var s1e = id.substring(7, 8)
           var s2o = id.substring(8, 9)
           var s3e = id.substring(9, 10)
           var co = id.substring(10, 11)
           var ae = id.substring(11, 12)
           var z = id.substring(12, 13)

           var A = 0;
           A = parseInt(A) + parseInt(y1o) + parseInt(m1o) + parseInt(d1o) + parseInt(go) + parseInt(s2o) + parseInt(co);
           var B1 = y2e + m2e + d2e + s1e + s3e + ae;
           var B2 = B1 * 2;
           var i = 0;
           var B3 = 0;
           var B2string = B2.toString();
           while (B2string.length > i) {
               var x = B2string.substring(i, i + 1);
               B3 = B3 + parseInt(x);
               i = i + 1;
           }

           var C = A + B3;
           var Cstring = C.toString();
           var secNo = Cstring.substring(1, 2);
           var D = 10 - parseInt(secNo);
           while (D >= 10) D = D - 10;
           if (D == z) {
               //test for valid date in 1900
               var valid = true;
               var bd = new Date('19' + y1o + y2e, parseInt(m1o + m2e) - 1, d1o + d2e);
               if ((bd == 'NaN') | (bd == 'Invalid Date')) valid = false;
               else if (bd.getFullYear() != parseInt('19' + y1o + y2e)) valid = false;
               else if (bd.getMonth() + 1 != parseInt(m1o + m2e)) valid = false;
               else if (bd.getDate() != parseInt(d1o + d2e)) valid = false;
               //if invalid test again in 2000
               valid = true;
               bd = new Date('20' + y1o + y2e, parseInt(m1o + m2e) - 1, d1o + d2e);
               if ((bd == 'NaN') | (bd == 'Invalid Date')) valid = false;
               else if (bd.getFullYear() != parseInt('20' + y1o + y2e)) valid = false;
               else if (bd.getMonth() + 1 != parseInt(m1o + m2e)) valid = false;
               else if (bd.getDate() != parseInt(d1o + d2e)) valid = false;
               //return result
               return valid;
           }
           else {
     
               return false;
           }
       }
       catch (e) {
   
           return false;
       }
   }
   
</script>     
   
   	
   	
   </div>
</div>

<?php

function getage($birthday)
	{
		if(!empty($birthday)){
			
		
	     list($year,$month,$day) = explode("-",$birthday);
	     $year_diff  = date("Y") - $year;
	     $month_diff = date("m") - $month;
	     $day_diff   = date("d") - $day;
	     if ($day_diff < 0 && $month_diff==0){$year_diff--;}
	     if ($day_diff < 0 && $month_diff < 0){$year_diff--;}
	     return $year_diff. ' ' . 'years old';
		}else{
			return "";
		}
	}
?>