<? global $vis_language; 	$quick_insert=-1; ?>
<div class="modal-dialog modal-lg">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
            <h4 class="modal-title"><? echo $vis_language['TXTCLONE']; ?> <? echo strtolower ($vis_language['TXTARTICLES']);?></h4>
        </div>
        <div class="modal-body" id="parent_list">
            <div class="row">
                <div class="col-sm-12">
					 <section class="padder">
   <section class="panel-default">
      <div class="panel-body">
         <form id="vis_clone_form" name="vis_clone_form" method="post" class="form-horizontal">
                <div class="form-group">
               <label class="col-sm-3 control-label"><? echo $vis_language['TXTDOMAIN']; ?></label>
               <div class="col-sm-9">
                  <select id="vis_domain_id" name="vis_domain_id"  class="form-control input-sm selectpicker" <? if(count($domains)>10) echo 'data-live-search="true"';?> onchange="return getcategorylist(this.value);">
                     <?
                     if($domains!=-1) for($i=0;$i<count($domains); $i++){  ?>
                     <? if($operation['vis_domain_id']==$domains[$i]['domain_id']){?>
                     <option value="<? echo $domains[$i]['domain_id']; ?>" selected="selected" ><? echo $domains[$i]['domain_name']; ?> </option>
                     <? }else{?>
					 <option value="<? echo $domains[$i]['domain_id']; ?>" ><? echo $domains[$i]['domain_name']; ?> </option>
					 <? } } ?>
                  </select>
               </div>
            </div>
                 
                 <div class="form-group">
               <label class="col-sm-3 control-label"><? echo ucfirst($vis_language['TXTDESTINATION']); ?> <? echo strtolower($vis_language['TXTCATEGORY']); ?></label>
              <div class="col-sm-9" >
              <div class="control-label" style="text-align:left;"> <span id="seletctcat"></span> <span>
               <a href="javascript:void(0);" onclick="showcatlist();"><span class="vis_button label vh-success-bg vis-pointer" ><? echo $vis_language['TXTSELECT']; ?></span></a></span></div>
               <div id="catdrp" class="hide scrollable" >
                  <?php include(VIS_PATH_TEMPLATE.'clone_cat_list.php') ?>
                  </div>
               </div>
            </div>
            
                  <div class="line b-b line-lg pull-in"></div>
            <br/>
            <div class="form-group">
               <div class="col-sm-4 col-sm-offset-2">
               <input name="vis_parent" id="vis_parent" type="hidden"  value="0"/>
				    <input name="vis_article_id" id="vis_article_id" type="hidden"  value="<? echo $operation['vis_article_id'];?>"/>
        <button type="button" class="btn btn-primary" onclick="createclone();"><? echo $vis_language['TXTCLONE']; ?></button>
               </div>
            </div>
               </form>
      </div>
   </section>
</section>
                   
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
$(".selectpicker").selectpicker();
function createclone(){
	var data = { 'vis_action': $("#vis_clone_form").serialize(), 'vis_module': 'selfhelp', 'vis_operation': 'add_clone_article', 'vis_form': 'vis_clone_form' };
    $.ajax({
		url: 'index.php',
		data: data,
		type: "POST",
		success: function(data) {
			if(data==1)
			{
			$("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['MSGSUCCOPRT']; ?>");
   $("#vis_workpanel_div").visExecution("load_module","<? echo $vis_language['TXTARTICLES'];?>",{"vis_module":"selfhelp", "vis_operation":"view_articles"});
			$('#ajaxModal').modal('toggle');
			}else{
				$("#vis_global_msg_div").visInterface("load_global_message", data);
			}
		},
		error: function(xhr, ajaxOptions, thrownError) {$("#vis_global_msg_div").visInterface("load_global_message", "Error: "+xhr.status+" - "+thrownError);}
	});
}


function getcategorylist(dom_id){
	$('#seletctcat').html('');
						document.getElementById("vis_parent").value='';
	var data = {'vis_module':'selfhelp','vis_operation':'view_categories','vis_static_area':'vis_client_merge_area','vis_domain_id':dom_id,'vis_set':2};
							$.ajax({
					url: 'index.php',
					data: data,
					type: "POST",
					success: function(data) {
						$('#catdrp').html(data);
						
					},
					error: function(xhr, ajaxOptions, thrownError) {$("#vis_global_msg_div").visInterface("load_global_message", "Error: "+xhr.status+" - "+thrownError);}
				});
}
function showcatlist()
{
	$('#catdrp').removeClass('hide');
}
</script>
