var JS=new function(){function e(n){return function(t,i){var r=t.cells[n].innerText,u=i.cells[n].innerText;return!isNaN(r)&&!isNaN(u)?r-u:r.localeCompare(u)}}function o(n){return window.event?window.event.keyCode:n.keyCode?n.keyCode:n.which?n.which:n.charCode}function u(n){var i=t.indexOf(n);i>-1&&t.splice(i,1)}var n,t,f,r;this.timeAgo=function(n,t="en"){var s=new Date,h=new Date(s.getTime()-n*6e4),c=s-h,l=Math.floor(c/1e3),n=Math.floor(l/60),u=Math.floor(n/60),r=Math.floor(u/24),e=Math.floor(r/7),f=Math.floor(r/30),o=Math.floor(f/12),i={en:{year:"year",years:"years",month:"month",months:"months",week:"week",weeks:"weeks",day:"day",days:"days",hour:"hour",hours:"hours",minute:"minute",minutes:"minutes",ago:"ago",justNow:"just now"},vn:{year:"năm",years:"năm",month:"tháng",months:"tháng",week:"tuần",weeks:"tuần",day:"ngày",days:"ngày",hour:"giờ",hours:"giờ",minute:"phút",minutes:"phút",ago:"trước",justNow:"mới đây"}}[t];return o>0?o+" "+i[o>1?"years":"year"]+" "+i.ago:f>0?f+" "+i[f>1?"months":"month"]+" "+i.ago:e>0?e+" "+i[e>1?"weeks":"week"]+" "+i.ago:r>0?r+" "+i[r>1?"days":"day"]+" "+i.ago:u>0?u+" "+i[u>1?"hours":"hour"]+" "+i.ago:n>0?n+" "+i[n>1?"minutes":"minute"]+" "+i.ago:i.justNow};this.showToast=function(n,t,i){var r=document.createElement("div"),f,e,u;r.textContent=n;r.style.position="absolute";r.style.backgroundColor="#333";r.style.color="#fff";r.style.padding="8px 12px";r.style.zIndex="9999";r.style.opacity="0";r.style.transition="opacity 0.5s";document.body.appendChild(r);i?(u=i.getBoundingClientRect(),f=u.top+window.scrollY+u.height+5,e=u.left+window.scrollX):(f=window.innerHeight/2-r.offsetHeight/2,e=window.innerWidth/2-r.offsetWidth/2);r.style.top=f+"px";r.style.left=e+"px";setTimeout(function(){r.style.opacity="1"},10);setTimeout(function(){r.style.opacity="0";setTimeout(function(){document.body.removeChild(r)},500)},t*1e3)};this.filterTable=function(n,t){var e,o,u,f,i,r,s;for(e=n.value.toLowerCase().trim(),o=document.getElementById(t),u=o.getElementsByTagName("tr"),i=1;i-1)){u[i].style.display="";break}};this.sortTableByColumnId=function(n,t,i=true){var f=n.closest("table"),o=Array.from(f.rows).slice(1),u,r;for(u=i?o.sort(e(t)):o.sort(e(t)).reverse(),n.setAttribute("data-sort-asc",!i),r=0;rtypeof t[i]!="undefined"?t[i]:n)};this.getDateFromAspNet=function(n){var t=/\/Date\((\d+)\)\//.exec(n);return t?new Date(parseInt(t[1])):null};this.getDateByNet=function(n){var t=/\/Date\((\d+)\)\//.exec(n);return t?new Date(parseInt(t[1])):null};this.getUniqueId=function(){return Math.floor(Math.random()*Date.now())};this.bindDDL=function(n,t,i,r){var e=document.getElementById(n),f,u;if(e==null)alert("Unable to find element id: "+n);else for(e.innerHTML="",u=0;u()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(n)};this.getQueryString=function(n,t){var i,u,r;return t==null&&(t=""),i=t,n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),u=new RegExp("[\\?&]"+n+"=([^&#]*)"),r=u.exec(window.location.href),r!=null&&(i=r[1]),i};this.getQueryStringAsInteger=function(n){var t=parseInt(this.getQueryString(n,0));return isNaN(t)&&(t=0),t};this.downloadCSV=function(n,t){this.saveToFile(n,t,"text/csv")};this.saveToFile=function(n,t,i){var u,r;i||(i="text/csv");u=new Blob([t],{type:i});window.navigator.msSaveOrOpenBlob?window.navigator.msSaveBlob(u,n):(r=window.document.createElement("a"),r.href=window.URL.createObjectURL(u),r.download=n,document.body.appendChild(r),r.click(),document.body.removeChild(r))};this.downloadText=function(n,t){var i=document.createElement("a"),r;i.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t));i.setAttribute("download",n);document.createEvent?(r=document.createEvent("MouseEvents"),r.initEvent("click",!0,!0),i.dispatchEvent(r)):i.click()};this.downloadWSFile=function(n,t,i){for(var e,r,o,f=window.atob(n),s=new Uint8Array(f.length),u=0;u=0,r.checked=f);else alert("Not found: "+n)};this.setCheckBox=function(n,t){document.getElementById(n).checked=t};this.isChecked=function(n){return document.getElementById(n).checked};this.getIsChecked=function(n){return this.isChecked(n)};this.isEnterKeyPressed=function(n){var i=o(n),t=!1;return i==13&&(t=!0,n.preventDefault()),t};this.getTimeOffset=function(){var n=new Date;return-n.getTimezoneOffset()/60};this.newWin500=function(n,t){return this.newWin(n,500,500,t)};this.newWin800=function(n,t){return this.newWin(n,800,800,t)};this.newWin9x6=function(n,t){return this.newWin(n,900,600,t)};this.showWindow=function(n,t,i,r){return this.newWin(n,i,r,t)};this.newWin=function(n,t,i,r){var f=window.screenLeft!=undefined?window.screenLeft:screen.left,e=window.screenTop!=undefined?window.screenTop:screen.top;width=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width;height=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;t.toString().indexOf("%")>=0&&(t=Math.ceil(width*(parseInt(t.replace("%",""))/100)));i.toString().indexOf("%")>=0&&(i=Math.ceil(height*(parseInt(i.replace("%",""))/100)));var o=width/2-t/2+f,s=height/2-i/2+e,u=window.open(n,r,"scrollbars=yes, width="+t+", height="+i+", top="+s+", left="+o);return window.focus&&u.focus(),u};this.setCookie=function(n,t,i){var r=new Date,u;r.setDate(r.getDate()+i);u=escape(t)+(i==null?"":"; expires="+r.toUTCString());document.cookie=n+"="+u+";path=/"};this.deleteCookie=function(n){this.setCookie(n,"",-1)};this.getCookie=function(n,t){for(var u,f,r=document.cookie.split(";"),i=0;i0&&this.msgboxClose()};this.msgboxClose=function(){var n=t.pop();n&&$("#"+n).dialog("close").remove()};this.msgbox=function(n,i,r,f,e,o,s,h,c){var l,p,y,a,v;if(r||(r=350),f||(f=300),s==null&&(s=!0),h==null&&(h=!0),c&&(i='