<div>
    <p style="padding: 10px 30px; font-size: 14px; color: #424A53 ">Please take the time and update your personal profile. It is important to complete your profile with as much information as possible. This should only take you about 5 minutes. Once you have updated your profile, your account will be activated and you will be directed to your registered squads.
Thank you for your cooperation. </p>
</div>
         <div class="modal-header">
            
            <h4 class="modal-title" id="largeModalHead"><strong>Update</strong> Profile<span class="profile-name"><?= $this -> Profile["LastName"] . ', ' . $this -> Profile["FirstName"] ?></span></h4>
         </div>
         <div style="border: 1px solid #ccc;background: #fff">
            	<form class="form-group" id="EditDetailsTable" action="" method="post" width="100%">
          <div class="panel panel-default nav-tabs-vertical margin-bottom-style" style="min-height:814px;">
               <ul class="nav nav-tabs"  style="border-right: 1px dashed #d5d5d5;min-height:814px;">
                  <li class="active"><a href="#tab01" data-toggle="tab">Personal Details</a></li>
                 
                   <li><a href="#tab04" data-toggle="tab">Contact Details</a></li>
                  <li><a href="#tab03" data-toggle="tab"></span> Organisation </a></li>
                 
                  <?php if(age($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>
                  <li><a href="#tab07" data-toggle="tab"></span> Apparel </a></li>
                  <li><a href="#tab08" data-toggle="tab"></span> Social  Networks</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 site-border-top">
                              <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 recognised, 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-3">
                                  <select id="IDType" onchange="OnchangeIdType(this)" style="width:100%"  name="data[IDType]" class="form-control select IDType  col-md-12 requiredData" >
                                        <option value="1" <?php if($this->Profile['IDType']==1){ echo "selected";} ?> >South African ID No</option>
                                        <option value="2" <?php if($this->Profile['IDType']==2){ echo "selected";} ?> >Passport No</option>
                                        <option value="3" <?php if($this->Profile['IDType']==3){ echo "selected";} ?> >Birth Certificate No</option>
                                   </select>                            
                                       
                              </div>
                               <div  id="IDColom"  class="col-md-6">
                              <div class="col-md-3">
                                 <label>ID Number</label>
                              </div>
                              <div class="col-md-9">
                                  <input name="data[IDNumber]" onkeyup="checkid(this)" value="<?=$this->Profile['IDNumber'] ?>" type="text" class="form-control IDNumber" id="idNum"/>
                              </div>
                           </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;text-align: right" >
                                 <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
                                      $y = date("Y");
                                       $EndYear = $y+15;
                                       
                                       while ($y < $EndYear) {
                                       if ($y ==date("Y",strtotime($this->Profile["PassportExpireDate"])) ) {
                                       echo "<option selected value='$y' >$y</option>";
                                       } else {
                                       echo "<option value='$y' >$y</option>";
                                       }
                                       $y++;
                                       }
                                       ?>
                                    </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>Date Of Birth</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 class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Country of Birth</label>
                           </div>
                           <div class="col-md-3">
                               <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 class="col-md-3" style="text-align:right">
                                 <label>Place Of Birth</label>
                              </div>
                              <div class="col-md-3">
                                 <input name="data[BirthPlace]" value="<?= $this->Profile['BirthPlace'] ?>" type="text" class="form-control"/>
                              </div>
                           </div>
                      <?php if(age($this->Profile["DateOfBirth"] )<19)
                          {
                          ?>
                         <div class="col-md-12 site-padding site-border-top">
                               <div class="col-md-3" >
                                 <label>Marital Status</label>
                              </div>
                              <div  class="col-md-9">
                                  <select  name="data[rel_status]" class="form-control select">
                                    <?php 
                                 foreach ($this->StatusList as $t)
                                 { 
                                    	echo '<option value="'.$t['StatusName'].'" ';
                                 if($this->Profile["rel_status"] == $t['StatusName']){ echo " selected ";}
                                  	echo '>'.$t['StatusName'].'</option>';                                
                                 }
                                 ?> 
                                  </select>
                                
                              </div>
                               
                              
                           </div>
                       <?php } ?>
                        <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  value='Male' <?php if($this->Profile['Sex'] =="Male"){ echo "selected"; }?> >Male</option>
                              <option  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'); 
                                 
                                     
                                         foreach ($aEthnicity as $e) {
                                             echo "<option value='". $e ."'";
                                             if($this -> Profile["Ethnicity"]==$e){
                                                 echo "selected ";
                                             }
                                                     echo ">" . $e . "</option>";
                                         }
                                     
                                 ?>
                              </select>
                           </div>
                        </div>
                       <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="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 you are part of special needs schools, 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">
                                <?php 
                                    
                                    foreach ($this->listUnions as $type)
                                    {
                                    	
                                    			echo '<option value="'.$type['un_id'].'"       class="line'.$type['un_type'].'"';
																						
                                                        if($type['un_id']== $this->Profile["UnionType"] ){ echo " selected ";}
                                            echo '>'.$type['un_name'].'</option>';
                                    		
                                   }
                                        ?>
                                
                              </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=""/>
                               <span class="help-block">Only Enter if Applicable.</span>
                              
                           </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=""/>
                           <span class="help-block">Only Enter if Applicable.</span>
                           </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"/>
                           <span class="help-block">Only Enter if Applicable.</span>
                           </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" style=" text-align: right">
                                 <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(age($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-9">
                                 <input name="data[parent_Email]" value='<?= $this->Profile["parent_Email"] ?>'  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>Relationship</label>
                           </div>
                           <div class="col-md-9">
                               
                               <select class="select  form-control" name="data[relation]" style="width: 100%;">
                                <option value="">--- Please Select Relationship ---</option>
                                <?php 
                                foreach ($this->Relationship as $data){
                                	echo '<option value="'.$data['RelationshipName'].'" ';
					if($data['RelationshipName']== $this->Profile["relation"] ){ echo " selected ";}																	if($this->profile["relation"] == $data['RelationshipName']){ echo " selected ";}
                                            echo '>'.$data['RelationshipName'].'</option>';  
                                }
                            ?> 
                                
                            </select>
                               
                                
                           </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">
                              <select class="select  form-control" name="data[nextkin_Relationship]" style="width: 100%;">
                                <option value="">--- Please Select Relationship ---</option>
                                <?php 
                                foreach ($this->Relationship as $data){
                                	echo '<option value="'.$data['RelationshipName'].'" ';
					if($data['RelationshipName']== $this->Profile["nextkin_Relationship"] ){ echo " selected ";}																	if($this->profile["relation"] == $data['RelationshipName']){ echo " selected ";}
                                            echo '>'.$data['RelationshipName'].'</option>';  
                                }
                            ?> 
                                
                            </select>
                               </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 class="tab-pane" id="tab07">
                       
                       
                       
                       <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Track Suit:</label>
                           </div>
                           <div class="col-md-9">
                            <select class="select form-control  " name="data[TrackSuit]" >
                                <option value="">--- Please Select Size ---</option>
                                <?php 
                                $array = array("S","M","L","XL","2XL","3XL","4XL","5XL");
                                foreach ($array as $s){
                                	echo '<option value="'.$s.'" ';
						if($s== $this->Profile["TrackSuit"] ){ echo " selected ";}																if($this->profile["TrackSuit"] == $s){ echo " selected ";}
                                            echo '>'.$s.'</option>';  
		                                }
		                            ?> 
                                
                            </select>
                           </div>
                        </div>
                       <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Jacket:</label>
                           </div>
                           <div class="col-md-9">
                            <select class="select form-control " name="data[Jacket]" style="width: 100%;">
                                <option value="">--- Please Select Size ---</option>
                                <?php 
                                $array = array("S","M","L","XL","2XL","3XL","4XL","5XL");
                                foreach ($array as $s){
                                	echo '<option value="'.$s.'" ';
						if($s== $this->Profile["Jacket"] ){ echo " selected ";}																if($this->profile["Jacket"] == $s){ echo " selected ";}
                                            echo '>'.$s.'</option>';  
		                                }
		                            ?> 
                                
                            </select>
                           </div>
                        </div>
                       
                       <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Shorts:</label>
                           </div>
                           <div class="col-md-9">
                            <select class="select form-control" name="data[Shorts]" style="width: 100%;">
                                <option value="">--- Please Select Size ---</option>
                                <?php 
                                $array = array("S","M","L","XL","2XL","3XL","4XL","5XL");
                                foreach ($array as $s){
                                	echo '<option value="'.$s.'" ';
							if($s== $this->Profile["Shorts"] ){ echo " selected ";}															if($this->profile["Shorts"] == $s){ echo " selected ";}
                                            echo '>'.$s.'</option>';  
		                                }
		                            ?> 
                                
                            </select>
                           </div>
                        </div>
                       <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Running Shoes:</label>
                           </div>
                           <div class="col-md-9">
                            <select class="select form-control" name="data[RunningShoes]" style="width: 100%;">
                                <option value="">--- Please Select Size ---</option>
                                <?php 
                                $array = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18);
                                foreach ($array as $s){
                                	echo '<option value="'.$s.'" ';
							if($s== $this->Profile["RunningShoes"] ){ echo " selected ";}																if($this->profile["RunningShoes"] == $s){ echo " selected ";}
                                            echo '>'.$s.'</option>';  
		                                }
		                            ?> 
                                
                            </select>
                           </div>
                        </div>
                       <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Shirt:</label>
                           </div>
                           <div class="col-md-9">
                            <select class="select form-control" name="data[Shirt]" style="width: 100%;">
                                <option value="">--- Please Select Size ---</option>
                                <?php 
                                $array = array("S","M","L","XL","2XL","3XL","4XL","5XL");
                                foreach ($array as $s){
                                	echo '<option value="'.$s.'" ';
							if($s== $this->Profile["Shirt"] ){ echo " selected ";}															if($this->profile["Shirt"] == $s){ echo " selected ";}
                                            echo '>'.$s.'</option>';  
		                                }
		                            ?> 
                                
                            </select>
                           </div>
                        </div>
                       
               
                   </div>
                   <div class="tab-pane" id="tab08">
                       <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Facebook</label>
                           </div>
                           <div class="col-md-9">
                              <input name="data[Facebook]" value='<?= $this->Profile["Facebook"] ?>' type="text" class="form-control"/>
                            <span class="help-block">Please your facebook profile url link e.g.:https://www.facebook.com/yourusername</span>
                              
                           </div>
                        </div>
                       <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Instagram</label>
                           </div>
                           <div class="col-md-9">
                              <input name="data[Instagram]" value='<?= $this->Profile["Instagram"] ?>' type="text" class="form-control"/>
                           <span class="help-block">Please your instagram profile url link e.g.:https://www.instagram.com/yourusername</span>
                           </div>
                        </div>
                       <div class="col-md-12 site-padding site-border-top">
                           <div class="col-md-3">
                              <label>Twitter</label>
                           </div>
                           <div class="col-md-9">
                              <input name="data[Twitter]" value='<?= $this->Profile["Twitter"] ?>' type="text" class="form-control"/>
                              <span class="help-block">Please your twitter profile url link e.g.:https://www.twitter.com/yourusername</span>
                           
                           </div>
                        </div>
                   </div>
               </div>
            </div>
                    <div class="modal-footer">       
            <button type="button" class="btn btn-primary" onclick="SaveDataFirst(this)">Save ...</button>                  
         </div>
         </form>
             
         </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 SaveDataFirst(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){
       $.post("/union/first/",data,function(r){
           window.location.href="/union/";
        });
   }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>
<?php
function age($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 "";
		}
	}

?>