<? global $vis_language; ?>
<div class="modal-dialog">
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal">&times;</button>
      <h4 class="modal-title"><? echo $title;?></h4>
    </div>
    <div class="modal-body">
     <div class="row">
                <div class="col-sm-12">
                    <form role="form"  target="vis_hidden_frame" class="form-horizontal" name="vis_client_email_form" id="vis_client_email_form">
                        <div class="form-group">
                            <label class="col-sm-3 control-label txt_nowrap"><? echo $vis_language['TXTCLIENTEMAIL']; ?></label>
                            <div class="col-sm-9">
                                <input class="form-control input-sm" type="text" name="vis_additional_email" id="vis_additional_email" value=""/>
                            </div>
                        </div>
                        <input type="hidden" name="vis_client_id" value="<? echo $operation['vis_client_id']; ?>" />
						<input type="hidden" id="vis_domain_id" name="vis_domain_id" value="<? echo $operation['vis_domain_id']; ?>" />
                    </form>
                </div>
            </div>
         </div>
    <div class="modal-footer">
	  <a class="btn btn-primary" onclick="sendChat();"><? echo $vis_language['TXTADD']; ?></a>
    </div>
  </div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
<script> 
$(".selectpicker").selectpicker();

function sendChat(){ 
	var email = $('#vis_additional_email').val(); 
	var client = $('#vis_client_id').val(); 
	var domain = $('#vis_domain_id').val(); 
	$.ajax({
           url: 'index.php',
           data: {'vis_module':"client", 'vis_operation':"add_email", 'vis_additional_email':email, 'vis_client_id':client, 'vis_domain':domain},
           success: function(data) {  
		    if(data=='blank'){ 
			$("#vis_global_msg_div").visInterface("load_global_message", "<?=$vis_language['TXTBLANKFIELD']?>");	
		    }else if(data=='repeat'){  
				$("#vis_global_msg_div").visInterface("load_global_message", "<?=$vis_language['TXTEMAILALREADYEXIST']?>");
		    }else if(data=='err'){
			 $("#vis_global_msg_div").visInterface("load_global_message", "<?=$vis_language['MSGEMAILMISS']?>");
			}else{
				 $("#vis_global_msg_div").visInterface("load_global_message", "<?=$vis_language['MSGSUCCOPRT']?>");
				 $("#short_summary").visExecution("load_area",{"vis_module":"client", "vis_operation":"display_short_summary", "vis_client_id":"<? echo $operation['vis_client_id'];?>"});
				 $(".modal").modal("toggle");
				 
		    }
		},
		    error: function() {
            alert('ERROR!!!');
        }
    });
}

</script>