<script type="text/javascript">
     /*DOCTOR SEARCH LOCATION STARTS ON HOME_CUSTOM_SCRIPT*/
     /*----------------------------------*/

       var search_place;
       var input = document.getElementById('doctor_search_location');
           var options = {
               componentRestrictions: {
                   country: 'br'
               },
               types: ['(cities)']
              // types: ['(regions)']
           };

       var autocomplete = new google.maps.places.Autocomplete(input, options);
       google.maps.event.addListener(autocomplete, 'place_changed', function () 
       {
           search_place = autocomplete.getPlace();
           console.log(search_place.formatted_address, search_place.geometry.location.lat(),search_place.geometry.location.lng());   
       });
</script>

<script type="text/javascript">
 /*    var idx=window.location.toString().indexOf("#_=_"); 
     if (idx>0) { window.location = window.location.toString().substring(0, idx); } */
</script>

<?php
     if($this->session->userdata('FBData'))
     {
          $FBData = $this->session->userdata('FBData');
?>         
          <script>
               var temp = '<?php echo $FBLoginStatus?>';
               if(temp=='success')
               {
                   
                    $('#regpaitent').modal("show");
                    var fb_email = "<?php if(isset($FBData)) echo  $FBData['email']?>" ;//setting email id
                    $('#reg-form-email').val(fb_email); 
                    var fb_gender = '<?php if(isset($FBData)) echo $FBData['gender']?>'; //setting gender
                    if(fb_gender=="female"){$('#reg-form-patient-female').prop('checked', true);}
                    else if(fb_gender=="male"){$('#reg-form-patient-male').prop('checked', true);}
                    else {$('#reg-form-patient-others').prop('checked', true);}
                    var fb_name = "<?php if(isset($FBData)) echo  $FBData['first_name']?>" ;//setting name
                    $('#reg-form-patient-name').val(fb_name); 
                    <?php
                         $img = 'assets/fb_profilepic/'.$FBData['oauth_uid'].'.jpg';
                          $arrContextOptions=array(
                          "ssl"=>array(
                              "verify_peer"=>false,
                              "verify_peer_name"=>false,
                          ),
                          );  
                        
                        $imagedata = file_get_contents($FBData['picture_url'],false,stream_context_create($arrContextOptions));
                        file_put_contents($img, $imagedata); 
                    ?>
                    $("#add_pat_pic_btn,#reg-pat-temppic").remove();
                    $(".ip_reg_modal_addphoto").append("<input id='reg_pat_pic'  name='reg_pat_profilepic' type='hidden' class='ip_reg_form_input reset-form-custom from-facebook' value='<?php  echo $img; ?>'>");  
                    $(".ip_reg_modal_addphoto").append("<img  src='<?php echo base_url().$img; ?>'>");
                                             
               }
          </script>
<?php  
     }  
?>

