function showMessage(n,t,i){var r=i?$(String.format("#{0}",i)):$("#lblMessage");if(r.length>0){r.html(n);switch(t){case MessageType.Success:r.css("color","green");break;case MessageType.Error:r.css("color","red");break;case MessageType.Notify:r.css("color","orange");break;case MessageType.Information:r.css("color","#696059")}}}function showMessageDialog(n,t){var u=$("#lblMessage"),i;if(n&&n.length>0){i=$("#imgDialog"),u.html(n);switch(t){case MessageType.Success:i.attr({src:ApplicationVariables.SiteURL+"/Content/images/popup_success.gif"});break;case MessageType.Error:i.attr({src:ApplicationVariables.SiteURL+"/Content/images/popup_error.gif"});break;case MessageType.Notify:i.attr({src:ApplicationVariables.SiteURL+"/Content/images/popup_notify.gif"});break;case MessageType.Information:i.attr({src:ApplicationVariables.SiteURL+"/Content/images/icon_comment.gif"})}var r=$("#dvMessageDialog"),f=($(window).width()-MessageDialog.Width)/2,e=($(window).height()-MessageDialog.Height)/2;r.dialog("option","position",[f,e]),r.dialog("open")}}function popupTop(n){return Math.max(0,$(window).height()/2+$(window).scrollTop())-n/2}function popupLeft(n){return Math.max(0,$(window).width()/2+$(window).scrollLeft())-n/2}function myelem(n){return $('<input type="hidden" value="'+n+'" disabled="disabled"/>')}function myval(n){return n.val()}function isMobileAgent(){for(var t=navigator.userAgent.toLocaleLowerCase(),n=0;n<MobileAgentTypes.length;n++)if(t.indexOf(MobileAgentTypes[n])!=-1)return!0;return!1}function isChromeAgent(){var n=navigator.userAgent.toLocaleLowerCase();return n.indexOf("chrome")!=-1}function isSafariAgent(){var n=navigator.userAgent.toLocaleLowerCase();return n.indexOf("safari")!=-1&&n.indexOf("chrome")==-1}function isIEAgent(){var n=navigator.userAgent.toLocaleLowerCase();return n.indexOf("msie")!=-1}function isIE10AboveAgent(){var n=0;return navigator.appVersion.indexOf("MSIE")!=-1&&(n=parseFloat(navigator.appVersion.split("MSIE")[1])),n>=10}function getWindowHeight(){return $(window).height()}function getWindowWidth(){return $(window).width()}function escapeClick(n){var t=t==null?n:t;t.preventDefault?(t.preventDefault(),t.stopPropagation()):window.event&&(window.event.returnValue=!1,window.event.cancelBubble=!0)}function parseToShortDate(n){if(n!=null){var t=parseToDate(n),i=adjustMonthOrDay(t.getDate()),r=adjustMonthOrDay(t.getMonth()+1),u=t.getFullYear();return r+"/"+i+"/"+u}return""}function parseToDate(n){return n?isDate(n)?n:new Date(parseInt(n.substr(6))):null}function isDate(n){var t=!1;return Object.prototype.toString.call(n)==="[object Date]"&&(t=!isNaN(n.getTime())),t}function getDateTimeTicks(){var n=new Date;return n.getTime()*1e4+621355968000000000}function adjustMonthOrDay(n){var t=String(n);return n<10&&(t="0"+t),t}function setPickerDate(){var n=$("#dateFrom"),t=$("#dateTo"),r=new Date,i=!1,u=$("#ddlRange option:selected").val();switch(u){case"Week":i=!0,n.datepicker("setDate","-7d"),t.datepicker("setDate",r);break;case"Month":i=!0,n.datepicker("setDate","-1m"),t.datepicker("setDate",r);break;case"Custom":n.datepicker("setDate","-7d"),t.datepicker("setDate",r);break;default:n.datepicker("setDate",""),t.datepicker("setDate","")}n.datepicker(i?"disable":"enable"),t.datepicker(i?"disable":"enable")}function loadCombo(n){var i=$.parseJSON(n),t="<select>";return $(i).each(function(n,i){t+=String.format("<option value='{0}'>{1}<\/option>",i.Value,i.Text)}),t+"<\/select>"}function getFileNameFromPath(n){if(n.lentgh!=0){var t=n.lastIndexOf("/");if(t!=-1)return n=n.substring(t+1,n.length),t=n.indexOf("?"),t!=-1&&(n=n.substring(0,t)),n}return n}function getUserFileSysName(n,t){return String.format("{0}_{1}",t.toString("yyyy-MM-dd"),n)}function pasteHtmlAtCaret(n){var i,t,r,u,e,f;if(window.getSelection){if(i=window.getSelection(),i.getRangeAt&&i.rangeCount){for(t=i.getRangeAt(0),t.deleteContents(),r=document.createElement("div"),r.innerHTML=n,u=document.createDocumentFragment();e=r.firstChild;)f=u.appendChild(e);t.insertNode(u),f&&(t=t.cloneRange(),t.setStartAfter(f),t.collapse(!0),i.removeAllRanges(),i.addRange(t))}}else document.selection&&document.selection.type!="Control"&&document.selection.createRange().pasteHTML(n)}function validateControl(n,t,i){return!t&&(n.val().trim()==""||n.val().trim()==i)?(n.addClass("inputInvalid"),n.attr("title","Field is required"),!1):(n.removeAttr("title"),n.removeClass("inputInvalid"),!0)}function isValidEmail(n){return regexp=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/,regexp.test(n)}function setControlValidStyle(n,t){t?(n.removeAttr("title"),n.removeClass("inputInvalid")):(n.addClass("inputInvalid"),n.attr("title","Field is required"))}function setControlEnable(n,t){n.length>0&&(t?n.removeAttr("disabled"):n.attr("disabled","disabled"))}function showHideControl(n,t){n.length>0&&(t?n.show():n.hide())}function visibleControl(n,t){t?n.css("visibility","visible"):n.css("visibility","hidden")}function checkCheckBox(n){var t=n.is(":checked");n.prop("checked",!t)}function getSearchPostValue(n){return n.length==0||n=="-1"?null:n}function getSearchPostBoolValue(n){return n=="-1"?null:n=="1"?!0:!1}function convertStringToBool(n){return n.length==0?!1:(n=n.toLowerCase(),n=="true"?!0:!1)}function confirmDelete(){return confirm("Are you sure you want to delete this item ?")}function confirmDeleteItems(){return confirm("Are you sure you want to delete selected items ?")}function textWithCoverFocusIn(n){$(n).hasClass("textCover")&&($(n).val(""),$(n).removeClass("textCover"))}function textWithCoverFocusOut(n,t){$(n).val().length==0&&($(n).val(t),$(n).addClass("textCover"))}function textWithCoverDrop(n){return escapeClick(n),!1}function markAllNotificationsAsRead(){var n=ApplicationVariables.SiteURL+"/Special/MarkAllNotificationsAsReviewed";showAjaxLoader(),$.ajax({type:"POST",url:n,contentType:"application/json; charset=utf-8",success:function(n){$("#header_notification_bar").html(n)},error:function(n,t,i){showMessageDialog(i,MessageType.Error)},complete:function(){hideAjaxLoader()}})}function showAjaxLoader(){var n=$("#imgcover");n.css("position","absolute"),n.css("top",Math.max(0,($(window).height()-$(n).outerHeight())/2+$(window).scrollTop())+"px"),n.css("left",Math.max(0,($(window).width()-$(n).outerWidth())/2+$(window).scrollLeft())+"px"),$("#dvAjaxLoader").css("height",jQuery(document).height()),n.show(),$("#dvAjaxLoader").show()}function hideAjaxLoader(){$("#dvAjaxLoader").hide(),$("#imgcover").hide()}var MessageType={Success:3,Information:2,Notify:1,Error:0},MobileAgentTypes=["ipad","iphone","android"],AgentType={iPhone:0,iPad:1,Android:2,Desktop:3},FileStatuses={Pending:1,Published:2,Rejected:3},MessageDialog={Width:420,Height:170},FileDialog={Width:450,Height:480};String.format=String.prototype.format=function(){for(var n=0,t=typeof this=="function"&&!n++?arguments[0]:this;n<arguments.length;n++)t=t.replace(/\{\d+?\}/,arguments[n]);return t},String.prototype.toDateFromAspNet=function(){var dte=eval("new "+this.replace(/\//g,"")+";");return dte.setMinutes(dte.getMinutes()-dte.getTimezoneOffset()),dte},String.prototype.trimEnd=function(n){var t=typeof this=="function"&&!i++?arguments[0]:this,r;return t.length>0&&(r=t.lastIndexOf(n),r!=-1)?t.substring(0,r):t},typeof String.prototype.trim!="function"&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),$(document).ready(function(){var n=$("#header_notification_bar div.dropdown-menu.notification ul.notifications");n.length>0&&n.slimScroll({position:"right",color:"#808080",railColor:"#dff1fb",railVisible:!0,height:"",alwaysVisible:!0})})