<? 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>
        <? if($is_setting==1){ ?><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="#/home/view_alerts/<? echo $vis_language['TXTALERTS']; ?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTALERTS']; ?>',{'vis_module':'home','vis_operation':'view_alerts'});" class="link"><? echo $operation['view_title']; ?></a></li>
         <li class="active"> <? echo $vis_language['TXTADDALERT'];?></li>
      </ul>
      <div>
      </div>
   </div>
</section>
<section class="padder">
   <section class="panel panel-default">
      <header class="panel-heading sub_header"><? echo $vis_language['TXTADDALERT']; ?></header>
      <div class="panel-body">
         <form  class="form-horizontal" id="vis_alert_form" name="vis_alert_form" method="post">
            <input type="hidden" name="total_alert_critaria" id="total_alert_critaria" value="0" />
            <input type="hidden" name="total_alert_or_critaria" id="total_alert_or_critaria" value="0" />
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTTITLE']; ?></label>
               <div class="col-sm-10">
                  <input class="form-control input-sm" type="text" name="vis_alert_title" id="vis_alert_title" >
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTEMAILTEMPLATE']; ?></label>
               <div class="col-sm-10">
                  <select name="vis_template" id="vis_template" class="input-sm form-control selectpicker"  <? if(count($etemplate)>10) echo 'data-live-search="true"';?>><?
                     for($i=0;$i<count($etemplate);$i++){
                         $selected = ($etemplate[$i]['etemplate_id']==8)?"selected='selected'":"";
						  echo '<option '.$selected.' value="'.$etemplate[$i]['etemplate_id'].'">'.$etemplate[$i]['etemplate_name'].'</option>'; }?>
                  </select>
               </div>
            </div>
            <? 
               if(VIS_DOMAIN_ACCESS==0) { ?>
             <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTTEAM']; ?></label>
               <div class="col-sm-10">
				   <div class="dept_access_list">
                  <?
                     for($i=0; $i<count($staff_group); $i++) {
                         $staff_group_display_list.=$staff_group[$i]['group_id'].",";
                         if($staff_group[$i]['department_access']==0) $access_arr = 0;
                         else $access_arr = explode(',',$staff_group[$i]['department_access']);
                      ?>
                  <label class="checkbox-inline i-checks">
                  <input type="checkbox" value="<? echo $staff_group[$i]['group_id']; ?>"  name="vis_staff_team[]" /> <i></i>&nbsp;<? echo $staff_group[$i]['group_name']; ?></label><br/>
                  <? } ?>
                  <input type="hidden" value="<? echo $staff_group_display_list; ?>" name="staff_group_display_list" style="display:none;" />
               </div>
               </div>
            </div>
            <?
               } if(VIS_DOMAIN_ACCESS==0) { ?>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTSTAFF']; ?></label>
			   <div class="col-sm-10">
			   <div class=" dept_access_list">
                  <?
                      for($i=0;$i<count($staff_details);$i++) {?>
                  <label class="checkbox-inline i-checks">
                  <input type="checkbox"  name="vis_staff[]" value="<? echo $staff_details[$i]['staff_id']; ?>" /> <i></i>&nbsp;<? echo $staff_details[$i]['first_name'].' '.$staff_details[$i]['last_name']; ?></label><br/>  <? } ?>
				  </div>
               </div>
            </div>
            <?
               }
               else {
               	echo '<input type="hidden" name="vis_staff" value="'.VIS_STAFF_ID.'" />';
               } ?>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTEVENT']; ?></label>
			   <div class="col-sm-10">
			   <div class="dept_access_list">
				   <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="0" /> <i></i>&nbsp;<? echo $vis_language['TXTNEWTICKET']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="1" /> <i></i>&nbsp;<? echo $vis_language['TXTNEWCLIENTREPLY']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="2" /> <i></i>&nbsp;<? echo $vis_language['TXTNEWSTAFFREPLY']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="3" /> <i></i>&nbsp;<? echo $vis_language['TXTCLIENTADD']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="4" /> <i></i>&nbsp;<? echo $vis_language['TXTCLIENTDELETE']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="5" /> <i></i>&nbsp;<? echo $vis_language['TXTTICKETDEPARTMENTCHANGE']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="6" /> <i></i>&nbsp;<? echo $vis_language['TXTTICKETSTATUSCHANGE']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="7" /> <i></i>&nbsp;<? echo $vis_language['TXTTICKETPRIORITYCHANGE']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
				  <input type="checkbox" name="vis_event[]" value="50" /> <i></i>&nbsp;<? echo $vis_language['TXTCHANGECATEGORY']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
				  <input type="checkbox" name="vis_event[]" value="51" /> <i></i>&nbsp;<? echo $vis_language['TXTCHANGESUBCATEGORY']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
				  <input type="checkbox" name="vis_event[]" value="52" /> <i></i>&nbsp;<? echo $vis_language['TXTCHANGEITEM']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
				  <input type="checkbox" name="vis_event[]" value="53" /> <i></i>&nbsp;<? echo $vis_language['TXTCHANGELEVEL']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="8" /> <i></i>&nbsp;<? echo $vis_language['TXTTICKETASSIGNE']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="9" /> <i></i>&nbsp;<? echo $vis_language['TXTTICKETMERGE']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="10" /> <i></i>&nbsp;<? echo $vis_language['TXTNOTEADD']; ?></label><br/>
				  <?if(VIS_MODULE_ACCESS_BILLING==1){?><label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="11" /> <i></i>&nbsp;<? echo $vis_language['TXTINVOICECREATED']; ?></label><br/><? } ?>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="12" /> <i></i>&nbsp;<? echo $vis_language['TXTTICKETPOSTDELETE']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="13" /> <i></i>&nbsp;<? echo $vis_language['TXTMOVETOTRASH']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="14" /> <i></i>&nbsp;<? echo $vis_language['TXTFLAGCHANGE']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="15" /> <i></i>&nbsp;<? echo $vis_language['TXTTYPECHANGE']; ?></label><br/>
                  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="16" /> <i></i>&nbsp;<? echo $vis_language['TXTONOVERDUE']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="17"/> <i></i>&nbsp;<? echo $vis_language['TXTONUNRESOLVED']; ?></label><br/>
                  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="49"/> <i></i>&nbsp;<? echo $vis_language['TXTADDCOMMENT']; ?></label><br/>
				</div>
               </div>
             </div>
<!-- For ITIL purpose -->
			 <?php if(VIS_ITIL==1 && (isset($module['itil']) && $module['itil']==1)){?>
             <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTITILEVENT']; ?></label>
			   <div class="col-sm-10">
			   <div class="dept_access_list">
				   <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="18" /> <i></i>&nbsp;<? echo $vis_language['TXTNEWPROBLEM']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="19" /> <i></i>&nbsp;<? echo $vis_language['TXTUPDATEPROBLEMDEPT']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="20" /> <i></i>&nbsp;<? echo $vis_language['TXTUPDATEPROBLEMSTATUS']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="21" /> <i></i>&nbsp;<? echo $vis_language['TXTUPDATEPROBLEMPRIORITY']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="22" /> <i></i>&nbsp;<? echo $vis_language['TXTUPDATEPROBLEMIMPACT']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="23" /> <i></i>&nbsp;<? echo $vis_language['TXTPROBLEMASSIGN']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="24" /> <i></i>&nbsp;<? echo $vis_language['TXTADDROOTCAUSE']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="25" /> <i></i>&nbsp;<? echo $vis_language['TXTADDPROBLEMIMPACT']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="26" /> <i></i>&nbsp;<? echo $vis_language['TXTADDPROBLEMSYMPTOMS']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="27" /> <i></i>&nbsp;<? echo $vis_language['TXTLINKPERMANENTSOLUTION']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="28" /> <i></i>&nbsp;<? echo $vis_language['TXTLINKWORKAROUNDSOLUTION']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="29" /> <i></i>&nbsp;<? echo $vis_language['TXTNEWCHANGE']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="30" /> <i></i>&nbsp;<? echo $vis_language['TXTUPDATECHANGEDEPT']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="31" /> <i></i>&nbsp;<? echo $vis_language['TXTUPDATECHANGESTATUS']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="32" /> <i></i>&nbsp;<? echo $vis_language['TXTUPDATEPCHANGEPRIORITY']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="33" /> <i></i>&nbsp;<? echo $vis_language['TXTUPDATEPCHANGEIMPACT']; ?></label><br/>
                  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="34" /> <i></i>&nbsp;<? echo $vis_language['TXTUPDATEPCHANGERISK']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="35"/> <i></i>&nbsp;<? echo $vis_language['TXTCHANGEASSIGN']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="36"/> <i></i>&nbsp;<? echo $vis_language['TXTUPDATEPCHANGETYPE']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="37" /> <i></i>&nbsp;<? echo $vis_language['TXTCHANGEREASON']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="38"/> <i></i>&nbsp;<? echo $vis_language['TXTADDCHANGEIMPACT']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="39"/> <i></i>&nbsp;<? echo $vis_language['TXTADDROLLOUTPLAN']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="40"/> <i></i>&nbsp;<? echo $vis_language['TXTADDBACKOUTPLAN']; ?></label><br/>
                  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="41" /> <i></i>&nbsp;<? echo $vis_language['TXTNEWRELEASE']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="42"/> <i></i>&nbsp;<? echo $vis_language['TXTUPDATERELEASEEDEPT']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="43"/> <i></i>&nbsp;<? echo $vis_language['TXTUPDATERELEASESTATUS']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="44" /> <i></i>&nbsp;<? echo $vis_language['TXTUPDATEPRELEASEPRIORITY']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="45"/> <i></i>&nbsp;<? echo $vis_language['TXTUPDATERELEASETYPE']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="46"/> <i></i>&nbsp;<? echo $vis_language['TXTRELEASEASSIGN']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="47"/> <i></i>&nbsp;<? echo $vis_language['TXTADDBUILDPLAN']; ?></label><br/>
				  <label class="checkbox-inline i-checks">
                  <input type="checkbox" name="vis_event[]" value="48"/> <i></i>&nbsp;<? echo $vis_language['TXTADDTESTPLAN']; ?></label><br/>
				 <? if(!empty($locations)){?>
				  <label class="checkbox-inline i-checks">
				  <input type="checkbox" name="vis_event[]" value="54" /> <i></i>&nbsp;<? echo $vis_language['TXTCHANGELOCATION']; ?></label><br/>
				  <? }?>
				</div>
               </div>
             </div>
             <?php }?>
		   <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTDISPLAYORDER']; ?></label>
               <div class="col-sm-10">
                  <input class="form-control input-sm" type="text" name="vis_alert_order" id="vis_alert_order" value="0">
               </div>
            </div>
            <div class="form-group">
               <div class="col-sm-2"><h5><? echo $vis_language['TXTCRITERIA']; ?></h5></div>
            </div>
            <div class="line b-b line-lg pull-in"></div><br/>

            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTMATCHANDCONDITIONS']; ?></label>
               <div class="col-sm-10"><div id="vis_alert_options" ></div></div>
            </div>
            <div class="form-group m-t-n-md">
               <label class="col-sm-10 control-label"></label>
               <div class="col-sm-2">
                  <label>
                  <button type="button" class="btn btn-primary btn-xs"  onclick="javascript:add_alert_criteria()"><? echo $vis_language['TXTADDCRITERIA']; ?></button>
                  </label>
               </div>
            </div><br/><br/>
             <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTMATCHORCONDITIONS']; ?></label>
               <div class="col-sm-10"><div id="vis_alert_or_options" ></div></div>
            </div>
            <div class="form-group m-t-n-md">
               <label class="col-sm-10 control-label"></label>
               <div class="col-sm-2">
				  <label>
                  <button type="button" class="btn btn-primary btn-xs"  onclick="javascript:add_alert_or_criteria()"><? echo $vis_language['TXTADDCRITERIA']; ?></button>
                  </label>
               </div>
            </div>

            <div class="line b-b line-lg pull-in"></div>
            <br/>
            <? if($sms_setting[1]!=-1) { ?>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTSMSALERT']; ?></label>
               <div class="col-sm-10">
                  <div class="radio i-checks m-r-lg pull-left">
				  <label>
                  <input name="vis_alert_status" id="vis_alert_status_yes" type="radio" value="1" checked="checked" /><i></i>
                  <? echo $vis_language['TXTENABLE']; ?></label></div>
                  <div class="radio i-checks pull-left">
				  <label>
                  <input name="vis_alert_status" id="vis_alert_status_no" type="radio" value="0" /> <i></i>
                  <? echo $vis_language['TXTDISABLE']; ?>
                  </label></div>
               </div>
            </div>
            <? } ?>
             <? if($hipchat_setting[1]!=-1 && $hipchat_setting !='') { ?>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTHIPCHATALERT']; ?></label>
               <div class="col-sm-10">
                  <div class="radio i-checks m-r-lg pull-left">
				  <label>
                  <input name="vis_hipchat_alert_status" id="vis_hipchat_alert_status_yes" type="radio" value="1" onclick= "hide_hipchat_div(1)" checked="checked" /><i></i>
                  <? echo $vis_language['TXTENABLE']; ?></label></div>
                  <div class="radio i-checks pull-left">
				  <label>
                  <input name="vis_hipchat_alert_status" id="vis_hipchat_alert_status_no" type="radio" value="0" onclick= "hide_hipchat_div(0)" /> <i></i>
                  <? echo $vis_language['TXTDISABLE']; ?>
                  </label></div>
               </div>
            </div>
            <div id = 'vis_hipchat_div'>
             <div class="form-group" >
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTNOTIFICATIONTO']; ?></label>
               <div class="col-sm-10">
                  <div class="radio i-checks m-r-lg pull-left">
				  <label>
                  <input name="vis_hipchat_notification" id="vis_hipchat_alert_status_yes" type="radio" onclick= "hide_room_list('1');" value="1" checked="checked" /><i></i>
                  <? echo $vis_language['TXTSTAFF']; ?></label></div>
                  <div class="radio i-checks pull-left">
				  <label>
                  <input name="vis_hipchat_notification" id="vis_hipchat_alert_status_no" type="radio" onclick= "hide_room_list('0');" value="0" /> <i></i>
                  <? echo $vis_language['TXTROOM']; ?>
                  </label></div>
               </div>
            </div>
            
            <div class="form-group" id='hipchat_room_list' style="display:none">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTROOM']; ?></label>
			   <div class="col-sm-10">
			   <div class=" dept_access_list">
                  <? 
                      for($i=0;$i<count($roomlist);$i++) { $row = get_object_vars($roomlist[$i]);?>
						    <label class="checkbox-inline i-checks">
                  <input type="checkbox"  name="vis_room_ids[]" value="<? echo $row['id']; ?>" /> <i></i>&nbsp;<? echo $row['name']; ?></label><br/> 
						 <? 
						  }
                  ?>
				  </div>
               </div>
            </div>
            </div>
            
           
            
            <? } ?>
              <? 
              if($slack_setting[1]!=-1 && $slack_setting !='') { ?>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTSLACK']; ?></label>
               <div class="col-sm-10">
                  <div class="radio i-checks m-r-lg pull-left">
				  <label>
                  <input name="vis_slack_alert_status" id="vis_slack_alert_status_yes" type="radio" value="1" onclick= "hide_slack_div(1)" checked="checked" /><i></i>
                  <? echo $vis_language['TXTENABLE']; ?></label></div>
                  <div class="radio i-checks pull-left">
				  <label>
                  <input name="vis_slack_alert_status" id="vis_slack_alert_status_no" type="radio" value="0" onclick= "hide_slack_div(0)" /> <i></i>
                  <? echo $vis_language['TXTDISABLE']; ?>
                  </label></div>
               </div>
            </div>
            
            <div id='vis_slack_div'>
             <div class="form-group" >
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTNOTIFICATIONTO']; ?></label>
               <div class="col-sm-10">
                  <div class="radio i-checks m-r-lg pull-left">
				  <label>
                  <input name="vis_slack_notification" id="vis_slack_alert_status_yes" type="radio" onclick= "hide_channel_list('1');" value="1" checked="checked" /><i></i>
                  <? echo $vis_language['TXTSTAFF']; ?></label></div>
                  <div class="radio i-checks pull-left">
				  <label>
                  <input name="vis_slack_notification" id="vis_slack_alert_status_no" type="radio" onclick= "hide_channel_list('0');" value="0" /> <i></i>
                  <? echo $vis_language['TXTCHANNEL']; ?>
                  </label></div>
               </div>
            </div>
            
            <div class="form-group" id='slack_channel_list' style="display:none">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTCHANNEL']; ?></label>
			   <div class="col-sm-10">
			   <div class=" dept_access_list">
                  <? 
                      for($i=0;$i<count($channel_list);$i++) { $row = get_object_vars($channel_list[$i]);?>
						    <label class="checkbox-inline i-checks">
                  <input type="checkbox"  name="vis_channel_ids[]" value="<? echo $row['id']; ?>" /> <i></i>&nbsp;<? echo $row['name']; ?></label><br/> 
						 <? 
						  }
                  ?>
				  </div>
               </div>
            </div>
            </div>
           
            <? } ?>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTSTATUS']; ?></label>
               <div class="col-sm-1">
                  <label class="switch">
                  <input type="checkbox" checked="checked" name="vis_status"  id="vis_status" >
                  <span ></span>
                  </label>
               </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':'home', 'vis_operation':'save_alert', 'vis_form':'vis_alert_form'})"><? echo $vis_language['TXTADD']; ?></button>
               </div>
            </div>
      </div>
      </form>
      </div>
   </section>
</section>
<style>
.selectpicker span:nth-child(2){
color:#000000 !important;
}
</style>
<script>
   $(".selectpicker").selectpicker();
   function select_picker()
   {
   $('.start').datetimepicker();
   $(".selectpicker").selectpicker();
   }
</script>
<script>
   function add_alert_criteria() {
       var total=document.getElementById("total_alert_critaria");
       var num=parseInt(total.value)+1;
       total.value=num;
       var newDiv=document.createElement("DIV");

    var newCritera='<div class="form-group"><div class="col-sm-3"><select name="vis_main_alert'+num+'" id="vis_main_alert'+num+'" onchange="changeAlertOption('+num+',1)" class="form-control input-sm selectpicker"  data-live-search="true"><option value="0"><? echo $vis_language['TXTSUBJECT']; ?></option><option value="1"><? echo $vis_language['TXTMESSAGE'];?></option><option value="4"><?echo $vis_language['TXTCLIENTNAME'];?></option><option value="5"><? echo $vis_language['TXTCLIENTEMAIL'];?></option><option value="6"><? echo $vis_language['TXTORGANIZATION'];?></option><option value="22"><? echo $vis_language['TXTCLIENTLANGUAGE'];?></option><option value="7"><? echo $vis_language['TXTDEPARTMENT'];?></option><option value="8"><? echo $vis_language['TXTSTATUS'];?></option><option value="9"><? echo $vis_language['TXTPRIORITY'];?></option><option value="23"><? echo $vis_language['TXTLABEL'];?></option><option value="21"><? echo $vis_language['TXTTICKETTYPE'];?></option><option value="34"><? echo $vis_language['TXTTICKETCATEGORY'];?></option><option value="35"><? echo $vis_language['TXTTICKETSUBCATEGORY'];?></option><option value="36"><? echo $vis_language['TXTTICKETITEM'];?></option><option value="37"><? echo $vis_language['TXTTICKETLEVEL'];?></option><? if(VIS_ITIL==1 && !empty($locations)) {?><option value="38"><? echo $vis_language['TXTLOCATION'];?></option><? } ?><option value="10"><? echo $vis_language['TXTOWNER'];?></option><option value="29"><? echo $vis_language['TXTOPERATOR'];?></option><option value="11"><? echo $vis_language['TXTFLAGTYPE'];?></option><option value="12"><? echo $vis_language['TXTLASTACTIVITY'];?></option><option value="28"><? echo $vis_language['TXTLASTREPLIER'];?></option><option value="16"><? echo $vis_language['TXTCREATIONDATE'];?></option><option value="15"><? echo $vis_language['TXTSLAPLAN'];?></option><option value="19"><? echo $vis_language['TXTHASATTACHMENT'];?></option><option value="24"><? echo $vis_language['TXTCHANNEL'];?></option><option value="25"><? echo $vis_language['TXTTOEMAIL'];?></option><option value="26"><? echo $vis_language['TXTCREATIONTIME'];?></option><option value="17"><? echo $vis_language['TXTOVERDUETIME'];?></option><option value="27"><? echo $vis_language['TXTRESOLUTIONDUETIME'];?></option><?php if(VIS_ITIL==1 && (isset($module['itil']) && $module['itil']==1)){?><option value="30"><? echo $vis_language['TXTIMPACT'];?></option><option value="31"><? echo $vis_language['TXTRISK'];?></option><option value="32"><? echo $vis_language['TXTCHANGETYPE'];?></option><option value="33"><? echo $vis_language['TXTRELEASETYPE'];?></option><?php }?><option value="39"><? echo $vis_language['TXTSCHEDULE'];?></option></select></div><div class="col-sm-3" id="vis_criteria_option'+num+'"><select class="form-control input-sm selectpicker" name="vis_sub_alert'+num+'" id="vis_sub_alert'+num+'"><option value="0"><? echo $vis_language['TXTCONTAIN']; ?></option><option value="1"><? echo $vis_language['TXTDOESNOTCONTAIN']; ?></option><option value="2"><? echo $vis_language['TXTEQUAL'];?></option><option value="3"><? echo $vis_language['TXTNOTEQUAL'];?></option></select></div><div class="col-sm-3" id="vis_criteria_text'+num+'"><input name="vis_alert_text'+num+'" id="vis_alert_text'+num+'" type="text" class="form-control input-sm" /></div><label class="col-sm-1" ><i class="vh vh-cross" onclick="javascript:close_alert_criteria('+num+',1)" style="cursor:pointer" title="<? echo $vis_language['TXTCLOSE']; ?>"></i></label></div>';

       newDiv.id="vis_alert_sub_criteria"+num;
       newDiv.innerHTML=newCritera;
       document.getElementById("vis_alert_options").appendChild(newDiv);
   select_picker();
   }
   function add_alert_or_criteria() {
       var total=document.getElementById("total_alert_or_critaria");
       var num=parseInt(total.value)+1;
       total.value=num;
       var newDiv=document.createElement("DIV");

       var newCritera='<div class="form-group"><div class="col-sm-3"><select name="vis_main_alert_or'+num+'" id="vis_main_alert_or'+num+'" onchange="changeAlertOption('+num+',0)" class="form-control input-sm selectpicker"  data-live-search="true"><option value="0"><? echo $vis_language['TXTSUBJECT']; ?></option><option value="1"><? echo $vis_language['TXTMESSAGE'];?></option><option value="4"><?echo $vis_language['TXTCLIENTNAME'];?></option><option value="5"><? echo $vis_language['TXTCLIENTEMAIL'];?></option><option value="6"><? echo $vis_language['TXTORGANIZATION'];?></option><option value="22"><? echo $vis_language['TXTCLIENTLANGUAGE'];?></option><option value="7"><? echo $vis_language['TXTDEPARTMENT'];?></option><option value="8"><? echo $vis_language['TXTSTATUS'];?></option><option value="9"><? echo $vis_language['TXTPRIORITY'];?></option><option value="23"><? echo $vis_language['TXTLABEL'];?></option><option value="21"><? echo $vis_language['TXTTICKETTYPE'];?></option><option value="34"><? echo $vis_language['TXTTICKETCATEGORY'];?></option><option value="35"><? echo $vis_language['TXTTICKETSUBCATEGORY'];?></option><option value="36"><? echo $vis_language['TXTTICKETITEM'];?></option><option value="37"><? echo $vis_language['TXTTICKETLEVEL'];?></option><? if(VIS_ITIL==1 && !empty($locations)) {?><option value="38"><? echo $vis_language['TXTLOCATION'];?></option><? } ?><option value="10"><? echo $vis_language['TXTOWNER'];?></option><option value="29"><? echo $vis_language['TXTOPERATOR'];?></option><option value="11"><? echo $vis_language['TXTFLAGTYPE'];?></option><option value="12"><? echo $vis_language['TXTLASTACTIVITY'];?></option><option value="28"><? echo $vis_language['TXTLASTREPLIER'];?></option><option value="16"><? echo $vis_language['TXTCREATIONDATE'];?></option><option value="15"><? echo $vis_language['TXTSLAPLAN'];?></option><option value="19"><? echo $vis_language['TXTHASATTACHMENT'];?></option><option value="24"><? echo $vis_language['TXTCHANNEL'];?></option><option value="25"><? echo $vis_language['TXTTOEMAIL'];?></option><option value="26"><? echo $vis_language['TXTCREATIONTIME'];?></option><option value="17"><? echo $vis_language['TXTOVERDUETIME'];?></option><option value="27"><? echo $vis_language['TXTRESOLUTIONDUETIME'];?></option><?php if(VIS_ITIL==1 && (isset($module['itil']) && $module['itil']==1)){?><option value="30"><? echo $vis_language['TXTIMPACT'];?></option><option value="31"><? echo $vis_language['TXTRISK'];?></option><option value="32"><? echo $vis_language['TXTCHANGETYPE'];?></option><option value="33"><? echo $vis_language['TXTRELEASETYPE'];?></option><?php }?><option value="39"><? echo $vis_language['TXTSCHEDULE'];?></option></select></div><div class="col-sm-3" id="vis_criteria_option_or'+num+'"><select class="form-control input-sm selectpicker" name="vis_sub_alert_or'+num+'" id="vis_sub_alert_or'+num+'"><option value="0"><? echo $vis_language['TXTCONTAIN']; ?></option><option value="1"><? echo $vis_language['TXTDOESNOTCONTAIN']; ?></option><option value="2"><? echo $vis_language['TXTEQUAL'];?></option><option value="3"><? echo $vis_language['TXTNOTEQUAL'];?></option></select></div><div class="col-sm-3" id="vis_criteria_text_or'+num+'"><input name="vis_alert_text_or'+num+'" id="vis_alert_text_or'+num+'" type="text" class="form-control input-sm" /></div><label class="col-sm-1" ><i class="vh vh-cross" onclick="javascript:close_alert_criteria('+num+',0)" style="cursor:pointer" title="<? echo $vis_language['TXTCLOSE']; ?>"></i></label></div>';

       newDiv.id="vis_alert_sub_or_criteria"+num;
       newDiv.innerHTML=newCritera;
       document.getElementById("vis_alert_or_options").appendChild(newDiv);
   select_picker();
   }
   function changeAlertOption(num,condition) {
       var tempcondition='';
       if(condition==0) tempcondition='_or';
       var mainOpt=document.getElementById("vis_main_alert"+tempcondition+num).value;
       var subOpt=document.getElementById("vis_criteria_option"+tempcondition+num);
       var subTxt=document.getElementById("vis_criteria_text"+tempcondition+num);
       if(mainOpt==0 || mainOpt==4 || mainOpt==5 || mainOpt==25) {
           subOpt.innerHTML='<select name="vis_sub_alert'+tempcondition+num+'" id="vis_sub_alert'+tempcondition+num+'" class="form-control input-sm selectpicker"><option value="0"><? echo $vis_language['TXTCONTAIN'];?></option><option value="1"><? echo $vis_language['TXTDOESNOTCONTAIN'];?></option><option value="2"><? echo $vis_language['TXTEQUAL'];?></option><option value="3"><? echo $vis_language['TXTNOTEQUAL'];?></option></select>';
       }
       else if(mainOpt==1 || mainOpt==2 || mainOpt==3 || mainOpt==20) {
           subOpt.innerHTML='<select name="vis_sub_alert'+tempcondition+num+'" id="vis_sub_alert'+tempcondition+num+'" class="form-control input-sm selectpicker"><option value="0"><? echo $vis_language['TXTCONTAIN'];?></option><option value="1"><? echo $vis_language['TXTDOESNOTCONTAIN'];?></option></select>';
       }
       else if(mainOpt==6 || mainOpt==7 || mainOpt==8 || mainOpt==9 || mainOpt==10 || mainOpt==11 || mainOpt==15 || mainOpt==18 || mainOpt==19 || mainOpt==21 || mainOpt==22 || mainOpt==23 || mainOpt==24 || mainOpt==30 || mainOpt==31 || mainOpt==32 || mainOpt==33 || mainOpt==34 || mainOpt==35 || mainOpt==36 || mainOpt==37 || mainOpt==38 || mainOpt==39) {
           subOpt.innerHTML='<select name="vis_sub_alert'+tempcondition+num+'" id="vis_sub_alert'+tempcondition+num+'" class="form-control input-sm selectpicker"><option value="0"><? echo $vis_language['TXTEQUAL'];?></option><option value="1"><? echo $vis_language['TXTNOTEQUAL'];?></option></select>';
       }
       else if(mainOpt==12 || mainOpt==13 || mainOpt==14 || mainOpt==16) {
           subOpt.innerHTML='<select name="vis_sub_alert'+tempcondition+num+'" id="vis_sub_alert'+tempcondition+num+'" class="form-control input-sm selectpicker"><option value="0"><? echo $vis_language['TXTLESSTHAN'];?></option><option value="1"><? echo $vis_language['TXTGREATERTHAN'];?></option></select>';
       }else if(mainOpt==26) {
           subOpt.innerHTML='<select name="vis_sub_alert'+tempcondition+num+'" id="vis_sub_alert'+tempcondition+num+'" class="form-control input-sm selectpicker"><option value="0"><? echo $vis_language['TXTAFTER'];?></option></select>';
       }else if(mainOpt==27 || mainOpt==17) {
           subOpt.innerHTML='<select name="vis_sub_alert'+tempcondition+num+'" id="vis_sub_alert'+tempcondition+num+'" class="form-control input-sm selectpicker"><option value="0"><? echo $vis_language['TXTAFTER'];?></option><option value="1"><? echo $vis_language['TXTBEFORE'];?></option></select>';
       }else if(mainOpt==28) {
           subOpt.innerHTML='<select name="vis_sub_alert'+tempcondition+num+'" id="vis_sub_alert'+tempcondition+num+'" class="form-control input-sm selectpicker"><option value="0"><? echo $vis_language['TXTSTAFF'];?></option><option value="1"><? echo $vis_language['TXTCLIENT'];?></option></select>';
       }else if(mainOpt==29) {
           subOpt.innerHTML='<select name="vis_sub_alert'+tempcondition+num+'" id="vis_sub_alert'+tempcondition+num+'" class="form-control input-sm selectpicker"><option value="0"><? echo $vis_language['TXTSTAFF'];?></option></select>';
       }

       if(mainOpt==0 || mainOpt==1 || mainOpt==2 || mainOpt==3 || mainOpt==4 || mainOpt==5 || mainOpt==20 || mainOpt==25) {
           subTxt.innerHTML='<input name="vis_alert_text'+tempcondition+num+'" id="vis_alert_text'+tempcondition+num+'" type="text" value="" class="form-control input-sm" />';
       }
       else if(mainOpt==6) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
      for($i=0;$i<count($user_groups);$i++) $temp.='<option value="'.$user_groups[$i]['group_id'].'">'.addslashes($user_groups[$i]['group_name']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }
       else if(mainOpt==7) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
      for($i=0;$i<count($departments);$i++) $temp.='<option value="'.$departments[$i]['department_id'].'">'.addslashes($departments[$i]['domain_name']).' :: '.addslashes($departments[$i]['department_name']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }
       else if(mainOpt==8) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
      for($i=0;$i<count($status);$i++) $temp.='<option value="'.$status[$i]['status_id'].'">'.addslashes($status[$i]['status_name']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }
       else if(mainOpt==9) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
      for($i=0;$i<count($priorities);$i++) $temp.='<option value="'.$priorities[$i]['priority_id'].'">'.addslashes($priorities[$i]['priority_name']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }
	    else if(mainOpt==34) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
      for($i=0;$i<count($categories);$i++) $temp.='<option value="'.$categories[$i]['category_id'].'">'.addslashes($categories[$i]['title']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }
	   else if(mainOpt==35) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
	    for($i=0;$i<count($categories);$i++){ 
			$temp.='<optgroup label="'.addslashes($categories[$i]['title']).'">';
			for($j=0;$j<count($subcategories);$j++){
				if($categories[$i]['category_id'] == $subcategories[$j]['category_id']) {
					$temp.='<option value="'.$subcategories[$j]['subcategory_id'].'">'.addslashes($subcategories[$j]['title']).'</option>';
				}
			}
			$temp.='</optgroup>';
	    }     
        $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }
	   else if(mainOpt==36) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
	  for($i=0;$i<count($subcategories);$i++){
		$temp.='<optgroup label="'.$subcategories[$i]['title'].'">';
			for($j=0;$j<count($items);$j++) {
				if($subcategories[$i]['subcategory_id'] == $items[$j]['subcategory_id']) {
					$temp.='<option value="'.$items[$j]['item_id'].'">'.addslashes($items[$j]['title']).'</option>';
				}
			}
			$temp.='</optgroup>';
	   }
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }
	   else if(mainOpt==37) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
      for($i=0;$i<count($levels);$i++) $temp.='<option value="'.$levels[$i]['level_id'].'">'.addslashes($levels[$i]['title']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }
	   else if(mainOpt==38) { <?
			if(count($locations)>10) $select1= 'data-live-search="true"';
	           $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker"'.$select1.'>';
               $temp .= vis_show_subcategories($locations,'');
			   function vis_show_subcategories($locations,$call=NULL) {
				   for($i=0;$i<count($locations);$i++){ 
					   $temp.='<option value="'.$locations[$i]['location_id'].'">'.addslashes($locations[$i]['name']).'</option>';
					   if($locations[$i]['subcat']!=NULL) { 
					    	$temp .= vis_show_subcategories($locations[$i]['subcat'],'sub_cat'); 
					   }
				   }
				   return $temp;
			   }
               $temp.='</select>';
               echo "subTxt.innerHTML='".$temp."'"; ?>
       }
       else if(mainOpt==10 || mainOpt==29) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker"><option value="0">'.$vis_language['TXTOPERATOR'].'</option>';
      for($i=0;$i<count($staff_details);$i++) $temp.='<option value="'.$staff_details[$i]['staff_id'].'">'.addslashes(trim($staff_details[$i]['first_name'].' '.$staff_details[$i]['last_name'])).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }
       else if(mainOpt==11) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
      for($i=0;$i<count($flags);$i++)
	  {
		 if($flags[$i]['flag_color']=='#ffffff'){
		 $class_var="vh-flag-empty";
		 $color='';
		 }
		 else{
		 $class_var="vh-flag";
		 $color=$flags[$i]['flag_color'];
		 }
	  	$temp.='<option value="'.$flags[$i]['flag_id'].'" data-icon="vh vh-lg '.$class_var.'" style="color:'.$color.'">'.addslashes($flags[$i]['flag_name']).'</option>';
      }
	  $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }
       else if(mainOpt==12 || mainOpt==13 || mainOpt==14 || mainOpt==16) {
           subTxt.innerHTML='<input name="vis_alert_text'+tempcondition+num+'" id="vis_alert_text'+tempcondition+num+'" type="text" value="" class="form-control input-sm start" />';
       }
       else if(mainOpt==15) { <?
      $temp='<select name="vis_alert_text\'+num+\'" id="vis_alert_text\'+num+\'" class="form-control input-sm selectpicker">';
      for($i=0;$i<count($sla);$i++) $temp.='<option value="'.$sla[$i]['sla_id'].'">'.addslashes($sla[$i]['sla_name']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }
       else if(mainOpt==18 || mainOpt==19) {
           subTxt.innerHTML='<select name="vis_alert_text'+tempcondition+num+'" id="vis_alert_text'+tempcondition+num+'" class="form-control input-sm selectpicker"><option value="0"><? echo $vis_language['TXTTRUE'];?></option></select>';
       }
       else if(mainOpt==21) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
      for($i=0;$i<count($ticket_types);$i++) $temp.='<option value="'.$ticket_types[$i]['type_id'].'">'.addslashes($ticket_types[$i]['type_name']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."'"; ?>
       }
       else if(mainOpt==22) { <?
       if(count($client_language)>10) $select1= 'data-live-search="true"';
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker"'.$select1.'>';
      for($i=0;$i<count($client_language);$i++) $temp.='<option value="'.$client_language[$i]['language_id'].'">'.addslashes($client_language[$i]['language_name']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."'"; ?>
       }
       else if(mainOpt==23) { <?
       if(count($label_details)>10) $select1= 'data-live-search="true"';
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker"'.$select1.'>';
      for($i=0;$i<count($label_details);$i++) $temp .= '<option data-id="alert_label" data-bgcolor="'.$label_details[$i]['label_color'].'" value="'.$label_details[$i]['label_id'].'">'.addslashes($label_details[$i]['label_name']).'</option>';
	  $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."'"; ?>
       }
       else if(mainOpt==24) { <?
       if(count($channel_details)>10) $select1= 'data-live-search="true"';
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker"'.$select1.'>';
      for($i=0;$i<count($channel_details);$i++) $temp.='<option value="'.$channel_details[$i]['channel_id'].'">'.addslashes($channel_details[$i]['channel_name']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."'"; ?>
       }else if(mainOpt==26 || mainOpt==27 || mainOpt==17) {
           subTxt.innerHTML='<input name="vis_alert_text'+tempcondition+num+'_hr" id="vis_alert_text'+tempcondition+num+'_hr" type="text" value="" class="form-control input-sm tkt_right_menu vis_fl" /><label class="vis_fl">&nbsp;hr&nbsp;&nbsp;&nbsp;</label><input name="vis_alert_text'+tempcondition+num+'_mi" id="vis_alert_text'+tempcondition+num+'_mi" type="text" value="" class="form-control input-sm tkt_right_menu vis_fl" /><label class="vis_fl">&nbsp;min</label>';
       }
       else if(mainOpt==28) {
           subTxt.innerHTML='';
       }else if(mainOpt==30) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
      for($i=0;$i<count($impact);$i++) $temp.='<option value="'.$impact[$i]['impact_id'].'">'.addslashes($impact[$i]['name']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }else if(mainOpt==31) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
      for($i=0;$i<count($risks);$i++) $temp.='<option value="'.$risks[$i]['risk_id'].'">'.addslashes($risks[$i]['name']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }else if(mainOpt==32) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
      for($i=0;$i<count($release_type);$i++) $temp.='<option value="'.$release_type[$i]['release_type_id'].'">'.addslashes($release_type[$i]['name']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }else if(mainOpt==33) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
      for($i=0;$i<count($change_type);$i++) $temp.='<option value="'.$change_type[$i]['change_type_id'].'">'.addslashes($change_type[$i]['name']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }else if(mainOpt==39) { <?
      $temp='<select name="vis_alert_text\'+tempcondition+num+\'" id="vis_alert_text\'+tempcondition+num+\'" class="form-control input-sm selectpicker">';
      for($i=0;$i<count($schedule);$i++) $temp.='<option value="'.$schedule[$i]['schedule_id'].'">'.addslashes($schedule[$i]['schedule_name']).'</option>';
      $temp.='</select>';
      echo "subTxt.innerHTML='".$temp."';"; ?>
       }
   select_picker();
   }
   function close_alert_criteria(num,condition) {
       var tempcondition='';
       if(condition==0) tempcondition='_or';
       if(num==1) $("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['MSGDEFAULTCRITERIA']; ?>");
       else document.getElementById("vis_alert_sub"+tempcondition+"_criteria"+num).innerHTML="";
   }
   function reset_alert_filter() {
       document.getElementById("vis_alert_options").innerHTML="";
       document.getElementById("total_alert_critaria").value=0;
       add_alert_criteria();
   }
   add_alert_criteria();
   add_alert_or_criteria();
   function hide_room_list(room_ids)
  {
	  if(room_ids==0)$('#hipchat_room_list').show();
	  else $('#hipchat_room_list').hide();
  }
  function hide_hipchat_div(hipchat_status)
  {
	  if(hipchat_status==1)$('#vis_hipchat_div').show();
	  else $('#vis_hipchat_div').hide();
  }
  
  function hide_channel_list(room_ids)
  {
	  if(room_ids==0)$('#slack_channel_list').show();
	  else $('#slack_channel_list').hide();
  }
  function hide_slack_div(slack_status)
  {
	  if(slack_status==1)$('#vis_slack_div').show();
	  else $('#vis_slack_div').hide();
  }
</script>
