<div class="col-sm-8">

    <div class="row gray_ttc">
        <br>

        <div class="col-sm-10 col-sm-offset-1 text-left" style="padding: 10px">
            <strong>Message Setting</strong><hr>
        </div>

        <div class="col-sm-12 ">
            <br>
        </div>


        <div class="col-sm-10 col-sm-offset-1 text-left" style="padding: 0">
            <div class="col-sm-12 " style="padding: 0">
                <div class="col-sm-4">Receive message in Email:</div>
                <div class="col-sm-8">
                    <div class="radio radio-success radio-margin" >
                    
                        
                        <input type="radio" name="Receive_message" id="yes" value="1" onclick="option_val()" >
                        <label for="Yes">Yes</label>
                       
                        <span style="margin-right: 30px"></span>
                    
                        <input type="radio" name="Receive_message" id="no" value="2" onclick="option_val()">
                        <label for="No">No</label>
                  
                    </div>
                </div>

            </div>
        </div>

        <div class="col-sm-12"><br><br></div>
    </div>

</div>
<?php if( $message_setting_info->person_message_setting==1){?>
    <script>
    document.getElementById('yes').checked='checked';
    </script>
    
<?php
} else if( $message_setting_info->person_message_setting==2){
?>
   <script>
    document.getElementById('no').checked='checked';
    </script> 
<?php }?>
<script>
    function option_val(){
      var value;
      var xmlhttp = false;
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp = false;
            }
        }
        if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
            xmlhttp = new XMLHttpRequest();
        }
           if (document.getElementById('yes').checked) {
           value = document.getElementById('yes').value;
           }
     else if (document.getElementById('no').checked) {
           value = document.getElementById('no').value;
           }
          var url= '<?php echo base_url();?>'+'save-message-option';
        
        var formdata = new FormData();
        formdata.append("person_message_setting",value);
 
        
        xmlhttp.addEventListener("load", function () {
                      //alert(xmlhttp.responseText);
                      

            
            }, false);
            xmlhttp.addEventListener("error", function () {
                alert("not sent");
            }, false);
            xmlhttp.addEventListener("abort", function () {
                alert("Aborted");
            }, false);

            xmlhttp.open("POST", url);
            xmlhttp.send(formdata);

}
    
 
  
 </script>