<? global $vis_language; ?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
   <div class="col-sm-6">
      <h3 class="m-b-xs text-black"><? echo $operation['view_title'];?></h3>
      <ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
         <li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME']; ?></a></li>
         <li><a class="link" href="#/setting/setting_menu/<? echo $vis_language['TXTSETTINGS'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTSETTINGS'];?>',{'vis_module':'setting','vis_operation':'setting_menu'});"><? echo $vis_language['TXTSETTINGS']; ?></a></li>
         <li> <a href="#/setting/view_survey/<? echo $vis_language['TXTSURVEY']; ?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTSURVEY']; ?>',{'vis_module':'setting','vis_operation':'view_survey'});" class="link"><? echo $vis_language['TXTSURVEY']; ?></a></li>
         <li> <a href="#/setting/view_surveyfield/<? echo $vis_language['TXTSURVEYFIELD']; ?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTSURVEYFIELD']; ?>',{'vis_module':'setting','vis_operation':'view_surveyfield'});" class="link"><? echo $operation['view_title']; ?></a></li>
         <li class="active"> <? echo addslashes($vis_language['TXTADDSURVEYFIELD']); ?></li>
      </ul>
      <div>
      </div>
   </div>
</section>
<section class="padder">
   <section class="panel panel-default">
      <header class="panel-heading sub_header"><? echo $vis_language['TXTADDSURVEYFIELD']; ?></header>
      <div class="panel-body">
         <form  class="form-horizontal" id="vis_surveyfield_form" name="vis_surveyfield_form" method="post">
            <input type="hidden" name="vis_operation" value="add_surveyfield" />
            <input type="hidden" name="vis_module" value="setting" />
            <input type="hidden" name="fldcnt" id="fldcnt" value="0" />
            <input type="hidden" name="total_fldcnt" id="total_fldcnt" value="0" />
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTSURVEY']; ?></label>
               <div class="col-sm-10">
                  <select name="vis_customgroup_name" id="vis_customgroup_name" class="input-sm form-control selectpicker"  <? if(count($custom_group_details)>10) echo 'data-live-search="true"';?>>
                     <?
                        for($k=0;$k<count($custom_group_details);$k++){ ?>
                     <option value="<? echo $custom_group_details[$k]['customgroup_id']; ?>"><? echo $custom_group_details[$k]['customgroup_name']; ?></option>
                     <?
                        } ?>
                  </select>
               </div>
            </div>
            <div class="line b-b line-lg pull-in"></div>
            <br/>
            <div class="form-group padder">
               <div class="col-sm-2 control-label custom" id="labels">
                  <ul class="nav">
                     <li><a href="javascript:void(0);" onclick="field_select(0)">Textbox</a></li>
                     <li><a href="javascript:void(0);" onclick="field_select(1)">Textarea</a></li>
                     <li><a href="javascript:void(0);" onclick="field_select(2)">Password</a></li>
                     <li><a href="javascript:void(0);" onclick="field_select(3)">Checkbox</a></li>
                     <li><a href="javascript:void(0);" onclick="field_select(4)">Radio button</a></li>
                     <li><a href="javascript:void(0);" onclick="field_select(5)">Select box</a></li>
                     <li><a href="javascript:void(0);" onclick="field_select(6)">Multiple select box</a></li>
                     <li><a href="javascript:void(0);" onclick="field_select(7)">Date Time</a></li>
                  </ul>
               </div>
               <div id="subfields" class="col-sm-10"></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">
                  <button type="button" class="btn btn-primary" onclick="$('#vis_workpanel_div').visExecution('submit_form',{'vis_module':'setting', 'vis_operation':'add_surveyfield', 'vis_form':'vis_surveyfield_form'})"><? echo $vis_language['TXTADD']; ?></button>
               </div>
            </div>
      </div>
      </form>
      </div>
   </section>
</section>
<script language="javascript">
   var fieldCount=0;
   var fieldCnt=0;
   var z=0;
   $(".selectpicker").selectpicker();
   function new_customfield(){
       quick_ajax('index.php?_module=admin&_op=new_customfield');
       try{
           document.getElementById('fldcnt').value = 0;
           document.getElementById('total_fldcnt').value = 0;
           document.getElementById('rdcnt').value = 0;
           document.getElementById('chcnt').value = 0;
       }
       catch(a){}
       fieldCount = 0;
       fieldCnt = 0;
       z=0;
   }
   function cancel_cust(did) {
      // if(fieldCnt==1) {
         //  document.getElementById("custom_submit").disabled=true;
         //  document.getElementById("custom_closeall").disabled=true;
       //}
       st=did.substr(4,did.length);

       document.getElementById(did).style.display="none";
   	document.getElementById('total_fldcnt').value=parseInt(document.getElementById('total_fldcnt').value)-1;
       document.getElementById('title'+st).value="no_field";
   	var new_top=parseInt($("#labels").css("marginTop"))-parseInt($("#"+did).height()/4);
   	if(new_top>=0)
   	$("#labels").css("marginTop",new_top+"px");
   	else
   	$("#labels").css("marginTop","0px");
   }
   function new_tab(did,cnt) {
       var obj = document.getElementById(did);
       var i = obj.rows.length;
       var tr = obj.insertRow(i);
       var td = tr.insertCell(0);

       if(obj.id.substr(0, 5) == 'chtab') {

         td.innerHTML = '<label class="checkbox-inline p-d-sm i-checks"><input type="checkbox" name="'+obj.id+i+'" value="1"><i></i></label><div class="form-group"></div>';
         td.innerHTML += '<? if($language_details!=-1) { ?><label class="col-sm-3 control-label"><?
               for($i=0;$i<count($language_details);$i++) { ?> <? echo $language_details[$i]['language_name']; ?></label><div class="form-group"></div><?}}?>';
        
         td = tr.insertCell(1);
         td.innerHTML = '<input type="text" name="txt'+obj.id+i+'"  class="form-control input-sm"><div class="form-group"></div>';
         td.innerHTML += '<? if($language_details!=-1) {   for($i=0;$i<count($language_details);$i++) { ?><input type="text" name="vis_language_'+obj.id+i+'<? echo $language_details[$i]['language_id']; ?>" value="<? echo $priority_lang[$language_details[$i]['language_id']]; ?>"  class="form-control input-sm"><div class="form-group"></div><?}}?>';	
         document.getElementById('chcnt'+(document.getElementById('vis_count_ck'+cnt).value)).value = i;
       }
       if(obj.id.substr(0, 5) == 'rdtab') {

           td.innerHTML = '<div class="radio i-checks p-d-sm"><label><input type="radio" name="'+obj.id+'0" value="'+i+'"><i></i></label></div><div class="form-group"></div>';
           td.innerHTML += '<? if($language_details!=-1) { ?><label class="col-sm-3 control-label"><?
               for($i=0;$i<count($language_details);$i++) { ?> <? echo $language_details[$i]['language_name']; ?></label><div class="form-group"></div><?}}?>';
           td = tr.insertCell(1);
           td.innerHTML = '<input type="text" name="txt'+obj.id+i+'"  class="form-control input-sm"><div class="form-group"></div>';
           td.innerHTML += '<? if($language_details!=-1) {   for($i=0;$i<count($language_details);$i++) { ?><input type="text" name="vis_language_'+obj.id+i+'<? echo $language_details[$i]['language_id']; ?>" value="<? echo $priority_lang[$language_details[$i]['language_id']]; ?>"  class="form-control input-sm"><div class="form-group"></div><?}}?>';	
           document.getElementById('rdcnt'+(document.getElementById('vis_count_rd'+cnt).value)).value = i;
       }
       i++;
   }

   function field_select(cnt) {
       var fieldObj=document.getElementById("subfields");
       var fieldDetail='<div class="form-group"><label class="col-sm-3 font-bold control-label"><? echo $vis_language['TXTFIELDDETAILS']; ?></label><label class="col-sm-9 control-label" ><i class="vh vh-cross" style="cursor:pointer" title="<? echo $vis_language['TXTCLOSE']; ?>" onclick="javascript:cancel_cust(\'cust'+fieldCount+'\')"></i></label></div><div class="form-group"><div class="col-sm-3 control-label"><? echo $vis_language['TXTFIELDTITLE']; ?></div><div class="col-sm-9"><input type="text" name="title'+fieldCount+'" id="title'+fieldCount+'" class="form-control input-sm"></div></div><div class="form-group"><div class="col-sm-3 control-label"><? echo $vis_language['TXTDEFAULTVALUE']; ?></div><div class="col-sm-9"><input name="def'+fieldCount+'"  id="def'+fieldCount+'" type="text" class="form-control input-sm"></div></div><div class="form-group"><div class="col-sm-3  control-label"><? echo $vis_language['TXTFIELDDESCRIPTION']; ?></div><div class="col-sm-9"><input name="desc'+fieldCount+'" id="desc'+fieldCount+'" type="text" class="form-control input-sm"></div></div><div class="form-group"><div class="col-sm-3 control-label"><? echo addslashes($vis_language['TXTDISPLAYORDER']); ?></div><div class="col-sm-9"><input name="ord'+fieldCount+'" id="ord'+fieldCount+'" type="text" value="'+fieldCount+'" class="form-control input-sm"></div></div><div class="form-group"><div class="col-sm-3 control-label"><? echo addslashes($vis_language['TXTREGULAREXPRESSIONVALIDATION']); ?></div><div class="col-sm-9"><select name="regexp'+fieldCount+'" id="regexp'+fieldCount+'" class="input-sm form-control selectpicker"><option value="none"><? echo $vis_language['TXTNONE']; ?></option><option value="email"><? echo $vis_language['TXTEMAIL']; ?></option><option value="numeric"><? echo $vis_language['TXTNUMERIC']; ?></option><option value="alphabetic"><? echo $vis_language['TXTALPHABETIC']; ?></option><option value="alnumhyphen"><? echo $vis_language['TXTALPHANUMERIC']; ?></option></select></div></div><div class="form-group"><div class="col-sm-3 control-label"><? echo $vis_language['TXTISREQUIRED']; ?></div><div class="col-sm-9 "><div class="radio i-checks m-r-lg pull-left"><label><input name="req'+fieldCount+'" id="req'+fieldCount+'" type="radio" value="1" ><i></i> <? echo $vis_language['TXTYES']; ?></label></div><div class="radio i-checks m-r-lg pull-left"><label><input name="req'+fieldCount+'" id="req'+fieldCount+'" type="radio" value="0" checked ><i></i> <? echo $vis_language['TXTNO']; ?></label></div></div></div><div class="form-group"><div class="col-sm-3 control-label"><? echo $vis_language['TXTUSEREDITABLE']; ?></div><div class="col-sm-9"><div class="radio i-checks m-r-lg pull-left"><label><input name="useredt'+fieldCount+'" id="useredt'+fieldCount+'" type="radio" value="1" checked="checked" ><i></i> <? echo $vis_language['TXTYES']; ?></label></div><div class="radio i-checks m-r-lg pull-left"><label><input name="useredt'+fieldCount+'" id="useredt'+fieldCount+'" type="radio" value="0" ><i></i> <? echo $vis_language['TXTNO']; ?></label></div></div></div><div class="form-group"><div class="col-sm-3  control-label"><? echo $vis_language['TXTSTAFFEDITABLE']; ?></div><div class="col-sm-9 "><div class="radio i-checks m-r-lg pull-left"><label><input name="staffedt'+fieldCount+'" id="staffedt'+fieldCount+'" type="radio" value="1" checked="checked" ><i></i> <? echo $vis_language['TXTYES']; ?></label></div><div class="radio i-checks m-r-lg pull-left"><label><input name="staffedt'+fieldCount+'" id="staffedt'+fieldCount+'" type="radio" value="0"  ><i></i> <? echo $vis_language['TXTNO']; ?></label></div></div></div><div class="form-group"><div class="col-sm-3  control-label"><? echo $vis_language['TXTSTATUS']; ?></div><div class="col-sm-1"><label class="switch"><input type="checkbox" checked="checked" name="vis_status'+fieldCount+'"  id="vis_status'+fieldCount+'"><span></span></label></div></div><? if($language_details!=-1) { ?><div class="form-group"><div class="col-sm-12"><h5><? echo $vis_language['MSGLANGTRANSFORSURVEYFIELDGROUP']; ?></h5></div><div class="line b-b line-lg pull-in"></div><br/><?
       for($i=0;$i<count($language_details);$i++) { ?> <div class="col-sm-3 control-label"><? echo $language_details[$i]['language_name']; ?></div><div class="col-sm-9"><input class="form-control input-sm" type="text" name="vis_language_'+fieldCount+'<? echo $language_details[$i]['language_id']; ?>" type="text" value="<? echo $priority_lang[$language_details[$i]['language_id']]; ?>" /><div class="form-group"></div></div><? } ?></div> <? } ?>';

       var fileDetail='<table style="width:100%" border="0" cellspacing="3" cellpadding="3"><tr><td><? echo $vis_language['TXTFIELDDETAILS']; ?></td><td colspan="2" align="right"><span class="vis-icon vis-icon-close" onclick="cancel_cust(\'cust'+fieldCount+'\')"></span></td></tr><tr><td><? echo $vis_language['TXTFIELDTITLE']; ?></td><td><input type="text" name="title'+fieldCount+'" id="title'+fieldCount+'"></td></tr><tr><td><? echo $vis_language['TXTDEFAULTVALUE']; ?></td><td><input name="def'+fieldCount+'"  id="def'+fieldCount+'" type="text"></td></tr><tr><td><? echo $vis_language['TXTFIELDDESCRIPTION']; ?></td><td><input name="desc'+fieldCount+'" id="desc'+fieldCount+'" type="text"></td></tr><tr><td><? echo addslashes($vis_language['TXTDISPLAYORDER']); ?></td><td><input name="ord'+fieldCount+'" id="ord'+fieldCount+'" type="text" value="'+fieldCount+'"></td></tr></table>';

       var fieldDetails='<div class="form-group"><label class="col-sm-3 font-bold control-label"><? echo $vis_language['TXTFIELDDETAILS']; ?></label><label class="col-sm-9 control-label" ><i class="vh vh-cross" style="cursor:pointer" title="<? echo $vis_language['TXTCLOSE']; ?>" onclick="javascript:cancel_cust(\'cust'+fieldCount+'\')"></i></label></div><div class="form-group"><div class="col-sm-3 control-label"><? echo $vis_language['TXTFIELDTITLE']; ?></div><div class="col-sm-9"><input type="text" name="title'+fieldCount+'" id="title'+fieldCount+'" class="form-control input-sm"></div></div><div class="form-group"><div class="col-sm-3 control-label"><? echo $vis_language['TXTFIELDDESCRIPTION']; ?></div><div class="col-sm-9"><input  name="desc'+fieldCount+'" id="desc'+fieldCount+'" type="text" class="form-control input-sm"></div></div><div class="form-group"><div class="col-sm-3  control-label"><? echo addslashes($vis_language['TXTDISPLAYORDER']); ?></div><div class="col-sm-9 "><input name="ord'+fieldCount+'" id="ord'+fieldCount+'" type="text" value="'+fieldCount+'" class="form-control input-sm"></div></div><div class="form-group"><div class="col-sm-3 control-label"><? echo $vis_language['TXTUSEREDITABLE']; ?></div><div class="col-sm-9"><div class="radio i-checks m-r-lg pull-left"><label><input name="useredt'+fieldCount+'" id="useredt'+fieldCount+'" type="radio" value="1" checked="checked" ><i></i> <? echo $vis_language['TXTYES']; ?></label></div><div class="radio i-checks m-r-lg pull-left"><label><input name="useredt'+fieldCount+'" id="useredt'+fieldCount+'" type="radio" value="0"><i></i> <? echo $vis_language['TXTNO']; ?></label></div></div></div><div class="form-group"><div class="col-sm-3 control-label"><? echo $vis_language['TXTSTAFFEDITABLE']; ?></div><div class="col-sm-9"><div class="radio i-checks m-r-lg pull-left"><label><input name="staffedt'+fieldCount+'" id="staffedt'+fieldCount+'" type="radio" value="1" checked ><i></i> <? echo $vis_language['TXTYES']; ?></label></div><div class="radio i-checks m-r-lg pull-left"><label><input name="staffedt'+fieldCount+'" id="staffedt'+fieldCount+'" type="radio" value="0" ><i></i> <? echo $vis_language['TXTNO']; ?></label></div></div></div><div class="form-group"><div class="col-sm-3  control-label"><? echo $vis_language['TXTSTATUS']; ?></div><div class="col-sm-1"><label class="switch"><input type="checkbox" checked="checked" name="vis_status'+fieldCount+'"  id="vis_status'+fieldCount+'"><span></span></label></div></div>';

       var dateTimeDetails='<div class="form-group"><label class="col-sm-3 font-bold control-label"><? echo $vis_language['TXTFIELDDETAILS']; ?></label><label class="col-sm-9 control-label" ><i class="vh vh-cross" style="cursor:pointer" title="<? echo $vis_language['TXTCLOSE']; ?>" onclick="javascript:cancel_cust(\'cust'+fieldCount+'\')"></i></label></div><div class="form-group"><div class="col-sm-3 control-label"><? echo $vis_language['TXTFIELDTITLE']; ?></div><div class="col-sm-9 "><input type="text" name="title'+fieldCount+'" id="title'+fieldCount+'" class="form-control input-sm"></div></div><div class="form-group"><div class="col-sm-3 control-label"><? echo $vis_language['TXTFIELDDESCRIPTION']; ?></div><div class="col-sm-9 "><input  name="desc'+fieldCount+'" id="desc'+fieldCount+'" type="text" class="form-control input-sm"></div></div><div class="form-group"><div class="col-sm-3 control-label"><? echo addslashes($vis_language['TXTDISPLAYORDER']); ?></div><div class="col-sm-9"><input name="ord'+fieldCount+'" id="ord'+fieldCount+'" type="text" value="'+fieldCount+'" class="form-control input-sm"></div></div><div class="form-group"><div class="col-sm-3 control-label"><? echo $vis_language['TXTDEFAULTVALUE']; ?></div><div class="col-sm-9  "><span class="input-group-addon no-padder no-borders start"><input class="form-control input-sm" type="text" name="def'+fieldCount+'"  id="def'+fieldCount+'"></span></div></div><div class="form-group"><div class="col-sm-3 control-label"><? echo $vis_language['TXTUSEREDITABLE']; ?></div><div class="col-sm-9 "><div class="radio i-checks m-r-lg pull-left"><label><input name="useredt'+fieldCount+'" id="useredt'+fieldCount+'" type="radio" value="1" checked="checked" ><i></i> <? echo $vis_language['TXTYES']; ?></label></div><div class="radio i-checks m-r-lg pull-left"><label><input name="useredt'+fieldCount+'" id="useredt'+fieldCount+'" type="radio" value="0"><i></i> <? echo $vis_language['TXTNO']; ?></label></div></div></div><div class="form-group"><div class="col-sm-3 control-label"><? echo $vis_language['TXTSTAFFEDITABLE']; ?></div><div class="col-sm-9 "><div class="radio i-checks m-r-lg pull-left"><label><input name="staffedt'+fieldCount+'" id="staffedt'+fieldCount+'" type="radio" value="1" checked ><i></i> <? echo $vis_language['TXTYES']; ?></label></div><div class="radio i-checks m-r-lg pull-left"><label><input name="staffedt'+fieldCount+'" id="staffedt'+fieldCount+'" type="radio" value="0" ><i></i> <? echo $vis_language['TXTNO']; ?></label></div></div></div><div class="form-group"><div class="col-sm-3  control-label"><? echo $vis_language['TXTSTATUS']; ?></div><div class="col-sm-1"><label class="switch"><input type="checkbox" checked="checked" name="vis_status'+fieldCount+'"  id="vis_status'+fieldCount+'"><span></span></label></div></div><? if($language_details!=-1) { ?><div class="form-group"><div class="col-sm-12"><h5><? echo $vis_language['MSGLANGTRANSFORSURVEYFIELDGROUP']; ?></h5></div><div class="line b-b line-lg pull-in"></div><br/><?
               for($i=0;$i<count($language_details);$i++) { ?> <div class="col-sm-3 control-label"><? echo $language_details[$i]['language_name']; ?></div><div class="col-sm-9"><input class="form-control input-sm" type="text" name="vis_language_'+fieldCount+'<? echo $language_details[$i]['language_id'];?>" type="text" value="<? echo $priority_lang[$language_details[$i]['language_id']]; ?>" /><div class="form-group"></div></div><? } ?></div> <? } ?>';



       var chk = '<div class="form-group"><div class="col-sm-3 control-label"><? echo addslashes($vis_language['TXTOPTIONFIELDS']); ?></div><div class="col-sm-12 control-label"></div></div><div class="form-group"><div class="col-sm-3 control-label"><i class="vh vh-plus" style="font-size:10px;"></i><a href="javascript:void(0)"  id="newtab" class="link m-xs" onclick="javascript:new_tab(\'chtab'+z+'\','+z+');"><? echo $vis_language['TXTADD']; ?></a></div><input type ="hidden" id="vis_count_ck'+z+'" value="'+z+'"><input type="hidden" id="chcnt'+fieldCount+'" name="chcnt'+fieldCount+'"><div class="col-sm-9 "><table id="chtab'+z+'"><tr><td><label class="checkbox-inline p-d-sm i-checks"><input type="checkbox" value="1" name="chtab'+z+'0" id="chtab'+z+'0"><i></i></label><div class="form-group"></div></td><td width="100%"><input type="text" name="txtchtab'+z+'0" id="txtchtab'+z+'0" class="form-control input-sm"><div class="form-group"></td></tr></div><? if($language_details!=-1) { 
               for($i=0;$i<count($language_details);$i++) { ?><tr><td><label class="col-sm-3 control-label"> <? echo $language_details[$i]['language_name']; ?></label><div class="form-group"></div></td><td width="100%"><input class="form-control input-sm" type="text" name="vis_language_chtab'+z+'0<? echo $language_details[$i]['language_id']; ?>"  value="<? echo $priority_lang[$language_details[$i]['language_id']]; ?>" /><div class="form-group"></td><? } ?></tr> <? } ?></table></div><div class="col-sm-5 "></div></div><? if($language_details!=-1) { ?><div class="form-group"><div class="col-sm-12"><h5><? echo $vis_language['MSGLANGTRANSFORSURVEYFIELDGROUP']; ?></h5></div><div class="line b-b line-lg pull-in"></div><br/><?
               for($i=0;$i<count($language_details);$i++) { ?> <div class="col-sm-3 control-label"><? echo $language_details[$i]['language_name']; ?></div><div class="col-sm-9"><input class="form-control input-sm" type="text" name="vis_language_'+fieldCount+'<? echo $language_details[$i]['language_id']; ?>" type="text" value="<? echo $priority_lang[$language_details[$i]['language_id']]; ?>" /><div class="form-group"></div></div><? } ?></div> <? } ?>';

       var rad = '<div class="form-group"><div class="col-sm-3 control-label"><? echo addslashes($vis_language['TXTOPTIONFIELDS']); ?></div><div class="col-sm-12  control-label"></div></div><div class="form-group"><div class="col-sm-3 spacing control-label"><input type ="hidden" id="vis_count_rd'+z+'" value="'+z+'"><input type="hidden" id="rdcnt'+fieldCount+'" name="rdcnt'+fieldCount+'"><i class="vh vh-plus" style="font-size:10px;"></i><a href="javascript:void(0)" id="newtab"  class="link m-xs" onclick="javascript:new_tab(\'rdtab'+z+'\','+z+');"><? echo $vis_language['TXTADD']; ?></a></div><div class="col-sm-9 "><table id="rdtab'+z+'"><tr><td><div class="radio p-d-sm i-checks"><label><input type="radio" name="rdtab'+z+'0" id="rdtab'+z+'0" value="1"><i></i></label></div><div class="form-group"></div></td><td width="100%"><input type="text" name="txtrdtab'+z+'0" id="txtrdtab'+z+'0" class="form-control input-sm"><div class="form-group"></div></td></tr></div><? if($language_details!=-1) {
               for($i=0;$i<count($language_details);$i++) { ?> <tr><td><label class="col-sm-3 control-label"><? echo $language_details[$i]['language_name']; ?></label><div class="form-group"></div></td><td width="100%"><input class="form-control input-sm" type="text" name="vis_language_rdtab'+z+'0<? echo $language_details[$i]['language_id']; ?>"  value="<? echo $priority_lang[$language_details[$i]['language_id']]; ?>" /><div class="form-group"></td><? } ?></tr> <? } ?></table></div><div class="col-sm-5 "></div></div><? if($language_details!=-1) { ?><div class="form-group"><div class="col-sm-12"><h5><? echo $vis_language['MSGLANGTRANSFORSURVEYFIELDGROUP']; ?></h5></div><div class="line b-b line-lg pull-in"></div><br/><?
               for($i=0;$i<count($language_details);$i++) { ?> <div class="col-sm-3 control-label"><? echo $language_details[$i]['language_name']; ?></div><div class="col-sm-9"><input class="form-control input-sm" type="text" name="vis_language_'+fieldCount+'<? echo $language_details[$i]['language_id']; ?>" type="text" value="<? echo $priority_lang[$language_details[$i]['language_id']]; ?>" /><div class="form-group"></div></div><? } ?></div> <? } ?>';
       switch(cnt) {
           case 0:
               var txtdiv = document.createElement('div');
               txtdiv.id = "cust"+fieldCount;
   			txtdiv.className ="form-group";
               txtdiv.innerHTML += '<input type="hidden" name="field'+fieldCount+'" id="field'+fieldCount+'" readonly value="1">';
               txtdiv.innerHTML += '<div class="col-sm-12 "><fieldset class="scheduler-border"><legend class="scheduler-border">Textbox</legend>'+fieldDetail+'</fieldset></div><br />';
               fieldObj.appendChild(txtdiv);
               //frmvalidator.addValidation("title"+fieldCount,"req","Required Field Title","global_msg");
               z++;

           break;
           case 1:
           var txtdiv = document.createElement('div');
               txtdiv.id = "cust"+fieldCount;
   			txtdiv.className ="form-group";
               txtdiv.innerHTML += '<textarea name="field'+fieldCount+'" id="field'+fieldCount+'" readonly style="display:none">3</textarea>';
               txtdiv.innerHTML += '<div class="col-sm-12 "><fieldset class="scheduler-border"><legend class="scheduler-border">TextArea</legend>'+fieldDetail+'</fieldset></div><br />';
               fieldObj.appendChild(txtdiv);
               //frmvalidator.addValidation("title"+fieldCount,"req","Required Field Title","global_msg");
               z++;
           break;
           case 2:
           var txtdiv = document.createElement('div');
               txtdiv.id = "cust"+fieldCount;
   			txtdiv.className ="form-group";
               txtdiv.innerHTML += '<input type="hidden" name="field'+fieldCount+'" id="field'+fieldCount+'" readonly value="2">';
               txtdiv.innerHTML += '<div class="col-sm-12 "><fieldset class="scheduler-border"><legend class="scheduler-border">Password</legend>'+fieldDetail+'</fieldset></div><br />';
               fieldObj.appendChild(txtdiv);
               //frmvalidator.addValidation("title"+fieldCount,"req","Required Field Title","global_msg");
               z++;
           break;
           case 3:
           var txtdiv = document.createElement('div');
               txtdiv.id = "cust"+fieldCount;
   			txtdiv.className ="form-group";
               txtdiv.innerHTML += '<input type="hidden" checked="checked" name="field'+fieldCount+'" id="field'+fieldCount+'" value="4">';
               txtdiv.innerHTML += '<div class="col-sm-12 "><fieldset class="scheduler-border"><legend class="scheduler-border">Checkbox</legend>'+fieldDetails+chk+'</fieldset></div><br />';
               fieldObj.appendChild(txtdiv);
               //frmvalidator.addValidation("title"+fieldCount,"req","Required Field Title","global_msg");
               z++;
           break;
           case 4:
           var txtdiv = document.createElement('div');
               txtdiv.id = "cust"+fieldCount;
   			txtdiv.className ="form-group";
               txtdiv.innerHTML += '<input type="hidden" checked="checked" name="field'+fieldCount+'" id="field'+fieldCount+'" value="5">';
               txtdiv.innerHTML += '<div class="col-sm-12 "><fieldset class="scheduler-border"><legend class="scheduler-border">Radio Button</legend>'+fieldDetails+rad+'</fieldset></div><br />';
               fieldObj.appendChild(txtdiv);
               //frmvalidator.addValidation("title"+fieldCount,"req","Required Field Title","global_msg");
               z++;
           break;
           case 5:
           var txtdiv = document.createElement('div');
               txtdiv.id = "cust"+fieldCount;
   			txtdiv.className ="form-group";
               txtdiv.innerHTML += '<select name="field'+fieldCount+'" id="field'+fieldCount+'" style="display:none" ><option value="6">Select</option></select>';
               txtdiv.innerHTML += '<div class="col-sm-12 "><fieldset class="scheduler-border"><legend class="scheduler-border">Select Box</legend>'+fieldDetails+rad+'</fieldset></div><br />';
               fieldObj.appendChild(txtdiv);
               //frmvalidator.addValidation("title"+fieldCount,"req","Required Field Title","global_msg");
               z++;
           break;
           case 6:
           var txtdiv = document.createElement('div');
               txtdiv.id = "cust"+fieldCount;
   			txtdiv.className ="form-group";
               txtdiv.innerHTML += '<select size="2" cols="40" multiple="multiple" name="field'+fieldCount+'" id="field'+fieldCount+'" style="display:none"><option value="7" selected="selected">Listbox</option></select>';
               txtdiv.innerHTML += '<div class="col-sm-12 "><fieldset class="scheduler-border"><legend class="scheduler-border">Multiple Select Box</legend>'+fieldDetails+chk+'</fieldset></div><br />';
               fieldObj.appendChild(txtdiv);
               //frmvalidator.addValidation("title"+fieldCount,"req","Required Field Title","global_msg");
               z++;
           break;
           case 7:
           var txtdiv = document.createElement('div');
               txtdiv.id = "cust"+fieldCount;
   			txtdiv.className ="form-group";
               txtdiv.innerHTML += '<input type="hidden" name="field'+fieldCount+'" id="field'+fieldCount+'" readonly value="8">';
               txtdiv.innerHTML += '<div class="col-sm-12 "><fieldset class="scheduler-border"><legend class="scheduler-border">Date Time</legend>'+dateTimeDetails+'</fieldset></div><br />';
               fieldObj.appendChild(txtdiv);
   			 $('.start').datetimepicker();
             z++;
               //frmvalidator.addValidation("title"+fieldCount,"req","Required Field Title","err_custf"+fieldCount);
           break;
           case 8:
           var txtdiv = document.createElement('div');
               txtdiv.id = "cust"+fieldCount;
   			txtdiv.className ="form-group";
               txtdiv.innerHTML += '<input type="hidden" name="field'+fieldCount+'" id="field'+fieldCount+'" readonly value="9">';
               txtdiv.innerHTML += '<div class="col-sm-12 "><fieldset class="scheduler-border"><legend class="scheduler-border">File</legend>'+fileDetail+'</fieldset></div><br />';
               fieldObj.appendChild(txtdiv);
               //frmvalidator.addValidation("title"+fieldCount,"req","Required Field Title","err_custf"+fieldCount);
               z++;
           break;
           default:
               window.alert("Error in Field Selection");
           break;
       }
       //frmvalidator.addValidation("title"+fieldCount,"req","Required Field Field Title","err_custf");
       fieldCount++;
       fieldCnt++;
       document.getElementById('fldcnt').value=fieldCnt;
   	document.getElementById('total_fldcnt').value=parseInt(document.getElementById('total_fldcnt').value)+1;
   	var new_top=parseInt($("#labels").css("marginTop"))+parseInt($("#"+txtdiv.id).height()/4);
   	if(new_top>=0)
   	$("#labels").css("marginTop",new_top+"px");
   	else
   	$("#labels").css("marginTop","0px");
   	$(".selectpicker").selectpicker();
   //	+'px'
   }
</script>
<style>
   .custom{
   border: 1px solid #cbd5dd;
   }
   fieldset.scheduler-border {
   border: 1px solid #cbd5dd !important;
   padding: 0 1.4em 1.4em 1.4em !important;
   }
   legend.scheduler-border {
   font-size: 17px !important;
   margin-bottom:4px !important;
   width:inherit !important; /* Or auto */
   border-bottom:none !important;
   font-weight: bold !important;
   }
</style>
