function hesk_insertTag(e){e="%%"+e+"%%";hesk_insertAtCursor(document.form1.msg,e),document.form1.msg.focus()}function hesk_insertAtCursor(e,t){var n,o;document.selection?(e.focus(),sel=document.selection.createRange(),sel.text=t):e.selectionStart||"0"==e.selectionStart?(n=e.selectionStart,o=e.selectionEnd,e.value=e.value.substring(0,n)+t+e.value.substring(o,e.value.length),e.selectionStart=n+t.length,e.selectionEnd=n+t.length):e.value+=t}function hesk_changeAll(e){for(var t=document.form1,n=!!e.checked,o=0;o{4} | {5}",t=JSON.parse(xmlHttp.responseText),n=0;n')}function removeAttachment(e,t,n){void 0!==t&&(n=n?"../":"",$('input[name="attachments[]"][value="'+t+'"]').remove(),$.ajax({url:n+"upload_attachment.php?action=delete&fileKey="+encodeURIComponent(t),method:"GET"}))}function hesk_updateDeleteCategoryUrl(e){var t=$("#targetCat"+e).val(),e=$("a[data-confirm-button]")[e];e.href=e.href.replace(/&targetCategory=\d+/i,"&targetCategory="+t)}jQuery.fn.preventDoubleSubmission=function(){return $(this).on("submit",function(e){var t=$(this);!0===t.data("submitted")?e.preventDefault():t.data("submitted",!0)}),this};