forked from vitmalina/w2ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathw2ui-fields.min.js
5 lines (5 loc) · 97.3 KB
/
w2ui-fields.min.js
1
2
3
4
5
/* w2ui-fields.js 1.5.x (nightly), part of w2ui (c) http://w2ui.com, [email protected] */
var w2ui=w2ui||{},w2obj=w2obj||{},w2utils=function(a){function b(a){var b=/^[0-1]+$/;return b.test(a)}function c(a){var b=/^[-+]?[0-9]+$/;return b.test(a)}function d(a){return"string"==typeof a&&(a=a.replace(/\s+/g,"").replace(w2utils.settings.groupSymbol,"").replace(w2utils.settings.decimalSymbol,".")),("number"==typeof a||"string"==typeof a&&""!==a)&&!isNaN(Number(a))}function e(a){var b=w2utils.settings,c=new RegExp("^"+(b.currencyPrefix?"\\"+b.currencyPrefix+"?":"")+"[-+]?"+(b.currencyPrefix?"\\"+b.currencyPrefix+"?":"")+"[0-9]*[\\"+b.decimalSymbol+"]?[0-9]+"+(b.currencySuffix?"\\"+b.currencySuffix+"?":"")+"$","i");return"string"==typeof a&&(a=a.replace(new RegExp(b.groupSymbol,"g"),"")),"object"==typeof a||""===a?!1:c.test(a)}function f(a){var b=/^[a-fA-F0-9]+$/;return b.test(a)}function g(a){var b=/^[a-zA-Z0-9_-]+$/;return b.test(a)}function h(a){var b=/^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return b.test(a)}function i(a,b,d){if(!a)return!1;var e,f,g,h="Invalid Date";if(null==b&&(b=w2utils.settings.date_format),"function"==typeof a.getUTCFullYear&&"function"==typeof a.getUTCMonth&&"function"==typeof a.getUTCDate)g=a.getUTCFullYear(),e=a.getUTCMonth(),f=a.getUTCDate();else if("function"==typeof a.getFullYear&&"function"==typeof a.getMonth&&"function"==typeof a.getDate)g=a.getFullYear(),e=a.getMonth(),f=a.getDate();else{if(a=String(a),new RegExp("mon","ig").test(b)){b=b.replace(/month/gi,"m").replace(/mon/gi,"m").replace(/dd/gi,"d").replace(/[, ]/gi,"/").replace(/\/\//g,"/").toLowerCase(),a=a.replace(/[, ]/gi,"/").replace(/\/\//g,"/").toLowerCase();for(var i=0,j=w2utils.settings.fullmonths.length;j>i;i++){var k=w2utils.settings.fullmonths[i];a=a.replace(new RegExp(k,"ig"),parseInt(i)+1).replace(new RegExp(k.substr(0,3),"ig"),parseInt(i)+1)}}var l=a.replace(/-/g,"/").replace(/\./g,"/").toLowerCase().split("/"),m=b.replace(/-/g,"/").replace(/\./g,"/").toLowerCase();"mm/dd/yyyy"===m&&(e=l[0],f=l[1],g=l[2]),"m/d/yyyy"===m&&(e=l[0],f=l[1],g=l[2]),"dd/mm/yyyy"===m&&(e=l[1],f=l[0],g=l[2]),"d/m/yyyy"===m&&(e=l[1],f=l[0],g=l[2]),"yyyy/dd/mm"===m&&(e=l[2],f=l[1],g=l[0]),"yyyy/d/m"===m&&(e=l[2],f=l[1],g=l[0]),"yyyy/mm/dd"===m&&(e=l[1],f=l[2],g=l[0]),"yyyy/m/d"===m&&(e=l[1],f=l[2],g=l[0]),"mm/dd/yy"===m&&(e=l[0],f=l[1],g=l[2]),"m/d/yy"===m&&(e=l[0],f=l[1],g=parseInt(l[2])+1900),"dd/mm/yy"===m&&(e=l[1],f=l[0],g=parseInt(l[2])+1900),"d/m/yy"===m&&(e=l[1],f=l[0],g=parseInt(l[2])+1900),"yy/dd/mm"===m&&(e=l[2],f=l[1],g=parseInt(l[0])+1900),"yy/d/m"===m&&(e=l[2],f=l[1],g=parseInt(l[0])+1900),"yy/mm/dd"===m&&(e=l[1],f=l[2],g=parseInt(l[0])+1900),"yy/m/d"===m&&(e=l[1],f=l[2],g=parseInt(l[0])+1900)}return c(g)&&c(e)&&c(f)?(g=+g,e=+e,f=+f,h=new Date(g,e-1,f),null==e?!1:"Invalid Date"==String(h)?!1:h.getMonth()+1!==e||h.getDate()!==f||h.getFullYear()!==g?!1:d===!0?h:!0):!1}function j(b,c){if(null==b)return!1;var d,e;b=String(b),b=b.toUpperCase(),e=b.indexOf("PM")>=0;var f=e||b.indexOf("AM")>=0;d=f?12:24,b=b.replace("AM","").replace("PM",""),b=a.trim(b);var g=b.split(":"),h=parseInt(g[0]||0),i=parseInt(g[1]||0),j=parseInt(g[2]||0);return f&&1===g.length||2===g.length||3===g.length?""===g[0]||0>h||h>d||!this.isInt(g[0])||g[0].length>2?!1:g.length>1&&(""===g[1]||0>i||i>59||!this.isInt(g[1])||2!==g[1].length)?!1:g.length>2&&(""===g[2]||0>j||j>59||!this.isInt(g[2])||2!==g[2].length)?!1:f||d!==h||0===i&&0===j?f&&1===g.length&&0===h?!1:c===!0?(e&&(h+=12),{hours:h,minutes:i,seconds:j}):!0:!1:!1}function k(a,b,c){if(w2utils.use_momentjs){var d=moment(a,b),e=d.isValid();return e&&c===!0?d.clone().toDate():e}return b=b.split("|")[0],a=a.split(" ")[0],i(a,b,c)}function l(a){if(""===a||null==a||"object"==typeof a&&!a.getMonth)return"";var b=new Date(a);if(w2utils.isInt(a)&&(b=new Date(Number(a))),"Invalid Date"==String(b))return"";var c=new Date,d=(c.getTime()-b.getTime())/1e3,e="",f="";return 0>d?(e='<span style="color: #aaa">0 sec</span>',f=""):60>d?(e=Math.floor(d),f="sec",0>d&&(e=0,f="sec")):3600>d?(e=Math.floor(d/60),f="min"):86400>d?(e=Math.floor(d/60/60),f="hour"):2592e3>d?(e=Math.floor(d/24/60/60),f="day"):31536e3>d?(e=Math.floor(d/30/24/60/60*10)/10,f="month"):126144e3>d?(e=Math.floor(d/365/24/60/60*10)/10,f="year"):d>=126144e3&&(e=Math.floor(d/365.25/24/60/60*10)/10,f="year"),e+" "+f+(e>1?"s":"")}function m(a){if(""===a||null==a||"object"==typeof a&&!a.getMonth)return"";var b=new Date(a);if(w2utils.isInt(a)&&(b=new Date(Number(a))),"Invalid Date"==String(b))return"";var c=w2utils.settings.shortmonths,d=new Date,e=new Date;e.setTime(e.getTime()-864e5);var f=c[b.getMonth()]+" "+b.getDate()+", "+b.getFullYear(),g=c[d.getMonth()]+" "+d.getDate()+", "+d.getFullYear(),h=c[e.getMonth()]+" "+e.getDate()+", "+e.getFullYear(),i=b.getHours()-(b.getHours()>12?12:0)+":"+(b.getMinutes()<10?"0":"")+b.getMinutes()+" "+(b.getHours()>=12?"pm":"am"),j=b.getHours()-(b.getHours()>12?12:0)+":"+(b.getMinutes()<10?"0":"")+b.getMinutes()+":"+(b.getSeconds()<10?"0":"")+b.getSeconds()+" "+(b.getHours()>=12?"pm":"am"),k=f;return f===g&&(k=i),f===h&&(k=w2utils.lang("Yesterday")),'<span title="'+f+" "+j+'">'+k+"</span>"}function n(a){if(!w2utils.isFloat(a)||""===a)return"";if(a=parseFloat(a),0===a)return 0;var b=["Bt","KB","MB","GB","TB"],c=parseInt(Math.floor(Math.log(a)/Math.log(1024)));return(Math.floor(a/Math.pow(1024,c)*10)/10).toFixed(0===c?0:1)+" "+b[c]}function o(a,b,c){return parseFloat(a).toLocaleString(w2utils.settings.locale,{minimumFractionDigits:b,useGrouping:c})}function p(a,b){if(b||(b=this.settings.date_format),""===a||null==a||"object"==typeof a&&!a.getMonth)return"";var c=new Date(a);if(w2utils.isInt(a)&&(c=new Date(Number(a))),"Invalid Date"==String(c))return"";var d=c.getFullYear(),e=c.getMonth(),f=c.getDate();return b.toLowerCase().replace("month",w2utils.settings.fullmonths[e]).replace("mon",w2utils.settings.shortmonths[e]).replace(/yyyy/g,d).replace(/yyy/g,d).replace(/yy/g,d>2e3?100+parseInt(String(d).substr(2)):String(d).substr(2)).replace(/(^|[^a-z$])y/g,"$1"+d).replace(/mm/g,(10>e+1?"0":"")+(e+1)).replace(/dd/g,(10>f?"0":"")+f).replace(/th/g,1==f?"st":"th").replace(/th/g,2==f?"nd":"th").replace(/th/g,3==f?"rd":"th").replace(/(^|[^a-z$])m/g,"$1"+(e+1)).replace(/(^|[^a-z$])d/g,"$1"+f)}function q(a,b){w2utils.settings.shortmonths,w2utils.settings.fullmonths;if(b||(b=this.settings.time_format),""===a||null==a||"object"==typeof a&&!a.getMonth)return"";var c=new Date(a);if(w2utils.isInt(a)&&(c=new Date(Number(a))),w2utils.isTime(a)){var d=w2utils.isTime(a,!0);c=new Date,c.setHours(d.hours),c.setMinutes(d.minutes)}if("Invalid Date"==String(c))return"";var e="am",f=c.getHours(),g=c.getHours(),h=c.getMinutes(),i=c.getSeconds();return 10>h&&(h="0"+h),10>i&&(i="0"+i),(-1!==b.indexOf("am")||-1!==b.indexOf("pm"))&&(f>=12&&(e="pm"),f>12&&(f-=12)),b.toLowerCase().replace("am",e).replace("pm",e).replace("hhh",10>f?"0"+f:f).replace("hh24",10>g?"0"+g:g).replace("h24",g).replace("hh",f).replace("mm",h).replace("mi",h).replace("ss",i).replace(/(^|[^a-z$])h/g,"$1"+f).replace(/(^|[^a-z$])m/g,"$1"+h).replace(/(^|[^a-z$])s/g,"$1"+i)}function r(a,b){var c;return""===a||null==a||"object"==typeof a&&!a.getMonth?"":(c="string"!=typeof b?[this.settings.date_format,this.settings.time_format]:b.split("|"),"h12"==c[1]&&(c[1]="h:m pm"),"h24"==c[1]&&(c[1]="h24:m"),this.formatDate(a,c[0])+" "+this.formatTime(a,c[1]))}function s(b){if(null==b)return b;switch(typeof b){case"number":break;case"string":b=a.trim(String(b).replace(/(<([^>]+)>)/gi,""));break;case"object":for(var c in b)b[c]=this.stripTags(b[c])}return b}function t(a){if(null==a)return a;switch(typeof a){case"number":break;case"string":a=String(a).replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""");break;case"object":for(var b in a)a[b]=this.encodeTags(a[b])}return a}function u(a){return""===a||null==a?"":String(a).replace(/([;&,\.\+\*\~'`:"\!\^#$%@\[\]\(\)=<>\|\/? {}\\])/g,"\\$1")}function v(a){function b(a){a=String(a).replace(/\r\n/g,"\n");for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);128>d?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b}var c,d,e,f,g,h,i,j="",k=0,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";for(a=b(a);k<a.length;)c=a.charCodeAt(k++),d=a.charCodeAt(k++),e=a.charCodeAt(k++),f=c>>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,isNaN(d)?h=i=64:isNaN(e)&&(i=64),j=j+l.charAt(f)+l.charAt(g)+l.charAt(h)+l.charAt(i);return j}function w(a){function b(a){for(var b,c,d="",e=0,f=0;e<a.length;)f=a.charCodeAt(e),128>f?(d+=String.fromCharCode(f),e++):f>191&&224>f?(b=a.charCodeAt(e+1),d+=String.fromCharCode((31&f)<<6|63&b),e+=2):(b=a.charCodeAt(e+1),c=a.charCodeAt(e+2),d+=String.fromCharCode((15&f)<<12|(63&b)<<6|63&c),e+=3);return d}var c,d,e,f,g,h,i,j="",k=0,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");k<a.length;)f=l.indexOf(a.charAt(k++)),g=l.indexOf(a.charAt(k++)),h=l.indexOf(a.charAt(k++)),i=l.indexOf(a.charAt(k++)),c=f<<2|g>>4,d=(15&g)<<4|h>>2,e=(3&h)<<6|i,j+=String.fromCharCode(c),64!==h&&(j+=String.fromCharCode(d)),64!==i&&(j+=String.fromCharCode(e));return j=b(j)}function x(b,c,d,e){function f(a,b,c){var d=!!window.webkitURL;return d||null==c||(b=c),";"+a+": "+b+"; -webkit-"+a+": "+b+"; -moz-"+a+": "+b+"; -ms-"+a+": "+b+"; -o-"+a+": "+b+";"}var g=a(b).width(),h=a(b).height(),i=.5;if(!b||!c)return void console.log("ERROR: Cannot do transition when one of the divs is null");switch(b.parentNode.style.cssText+=f("perspective","700px")+"; overflow: hidden;",b.style.cssText+="; position: absolute; z-index: 1019; "+f("backface-visibility","hidden"),c.style.cssText+="; position: absolute; z-index: 1020; "+f("backface-visibility","hidden"),d){case"slide-left":b.style.cssText+="overflow: hidden; "+f("transform","translate3d(0, 0, 0)","translate(0, 0)"),c.style.cssText+="overflow: hidden; "+f("transform","translate3d("+g+"px, 0, 0)","translate("+g+"px, 0)"),a(c).show(),window.setTimeout(function(){c.style.cssText+=f("transition",i+"s")+";"+f("transform","translate3d(0, 0, 0)","translate(0, 0)"),b.style.cssText+=f("transition",i+"s")+";"+f("transform","translate3d(-"+g+"px, 0, 0)","translate(-"+g+"px, 0)")},1);break;case"slide-right":b.style.cssText+="overflow: hidden; "+f("transform","translate3d(0, 0, 0)","translate(0, 0)"),c.style.cssText+="overflow: hidden; "+f("transform","translate3d(-"+g+"px, 0, 0)","translate(-"+g+"px, 0)"),a(c).show(),window.setTimeout(function(){c.style.cssText+=f("transition",i+"s")+"; "+f("transform","translate3d(0px, 0, 0)","translate(0px, 0)"),b.style.cssText+=f("transition",i+"s")+"; "+f("transform","translate3d("+g+"px, 0, 0)","translate("+g+"px, 0)")},1);break;case"slide-down":b.style.cssText+="overflow: hidden; z-index: 1; "+f("transform","translate3d(0, 0, 0)","translate(0, 0)"),c.style.cssText+="overflow: hidden; z-index: 0; "+f("transform","translate3d(0, 0, 0)","translate(0, 0)"),a(c).show(),window.setTimeout(function(){c.style.cssText+=f("transition",i+"s")+"; "+f("transform","translate3d(0, 0, 0)","translate(0, 0)"),b.style.cssText+=f("transition",i+"s")+"; "+f("transform","translate3d(0, "+h+"px, 0)","translate(0, "+h+"px)")},1);break;case"slide-up":b.style.cssText+="overflow: hidden; "+f("transform","translate3d(0, 0, 0)","translate(0, 0)"),c.style.cssText+="overflow: hidden; "+f("transform","translate3d(0, "+h+"px, 0)","translate(0, "+h+"px)"),a(c).show(),window.setTimeout(function(){c.style.cssText+=f("transition",i+"s")+"; "+f("transform","translate3d(0, 0, 0)","translate(0, 0)"),b.style.cssText+=f("transition",i+"s")+"; "+f("transform","translate3d(0, 0, 0)","translate(0, 0)")},1);break;case"flip-left":b.style.cssText+="overflow: hidden; "+f("transform","rotateY(0deg)"),c.style.cssText+="overflow: hidden; "+f("transform","rotateY(-180deg)"),a(c).show(),window.setTimeout(function(){c.style.cssText+=f("transition",i+"s")+"; "+f("transform","rotateY(0deg)"),b.style.cssText+=f("transition",i+"s")+"; "+f("transform","rotateY(180deg)")},1);break;case"flip-right":b.style.cssText+="overflow: hidden; "+f("transform","rotateY(0deg)"),c.style.cssText+="overflow: hidden; "+f("transform","rotateY(180deg)"),a(c).show(),window.setTimeout(function(){c.style.cssText+=f("transition",i+"s")+"; "+f("transform","rotateY(0deg)"),b.style.cssText+=f("transition",i+"s")+"; "+f("transform","rotateY(-180deg)")},1);break;case"flip-down":b.style.cssText+="overflow: hidden; "+f("transform","rotateX(0deg)"),c.style.cssText+="overflow: hidden; "+f("transform","rotateX(180deg)"),a(c).show(),window.setTimeout(function(){c.style.cssText+=f("transition",i+"s")+"; "+f("transform","rotateX(0deg)"),b.style.cssText+=f("transition",i+"s")+"; "+f("transform","rotateX(-180deg)")},1);break;case"flip-up":b.style.cssText+="overflow: hidden; "+f("transform","rotateX(0deg)"),c.style.cssText+="overflow: hidden; "+f("transform","rotateX(-180deg)"),a(c).show(),window.setTimeout(function(){c.style.cssText+=f("transition",i+"s")+"; "+f("transform","rotateX(0deg)"),b.style.cssText+=f("transition",i+"s")+"; "+f("transform","rotateX(180deg)")},1);break;case"pop-in":b.style.cssText+="overflow: hidden; "+f("transform","translate3d(0, 0, 0)","translate(0, 0)"),c.style.cssText+="overflow: hidden; "+f("transform","translate3d(0, 0, 0)","translate(0, 0)")+"; "+f("transform","scale(.8)")+"; opacity: 0;",a(c).show(),window.setTimeout(function(){c.style.cssText+=f("transition",i+"s")+"; "+f("transform","scale(1)")+"; opacity: 1;",b.style.cssText+=f("transition",i+"s")+";"},1);break;case"pop-out":b.style.cssText+="overflow: hidden; "+f("transform","translate3d(0, 0, 0)","translate(0, 0)")+"; "+f("transform","scale(1)")+"; opacity: 1;",c.style.cssText+="overflow: hidden; "+f("transform","translate3d(0, 0, 0)","translate(0, 0)")+"; opacity: 0;",a(c).show(),window.setTimeout(function(){c.style.cssText+=f("transition",i+"s")+"; opacity: 1;",b.style.cssText+=f("transition",i+"s")+"; "+f("transform","scale(1.7)")+"; opacity: 0;"},1);break;default:b.style.cssText+="overflow: hidden; "+f("transform","translate3d(0, 0, 0)","translate(0, 0)"),c.style.cssText+="overflow: hidden; "+f("transform","translate3d(0, 0, 0)","translate(0, 0)")+"; opacity: 0;",a(c).show(),window.setTimeout(function(){c.style.cssText+=f("transition",i+"s")+"; opacity: 1;",b.style.cssText+=f("transition",i+"s")},1)}setTimeout(function(){"slide-down"===d&&(a(b).css("z-index","1019"),a(c).css("z-index","1020")),c&&a(c).css({opacity:"1"}).css(w2utils.cssPrefix({transition:"",transform:"","backface-visibility":""})),b&&(a(b).css({opacity:"1"}).css(w2utils.cssPrefix({transition:"",transform:"","backface-visibility":""})),b.parentNode&&a(b.parentNode).css(w2utils.cssPrefix("perspective",""))),"function"==typeof e&&e()},1e3*i)}function y(b,c,d){var e={};"object"==typeof c?e=c:(e.msg=c,e.spinner=d),e.msg||0===e.msg||(e.msg=""),w2utils.unlock(b),a(b).prepend('<div class="w2ui-lock"></div><div class="w2ui-lock-msg"></div>');var f=a(b).find(".w2ui-lock"),g=a(b).find(".w2ui-lock-msg");e.msg||g.css({"background-color":"transparent",border:"0px"}),e.spinner===!0&&(e.msg='<div class="w2ui-spinner" '+(e.msg?"":'style="width: 35px; height: 35px"')+"></div>"+e.msg),null!=e.opacity&&f.css("opacity",e.opacity),"function"==typeof f.fadeIn?(f.fadeIn(200),g.html(e.msg).fadeIn(200)):(f.show(),g.html(e.msg).show(0)),a().w2tag()}function z(b,d){c(d)?(a(b).find(".w2ui-lock").fadeOut(d),setTimeout(function(){a(b).find(".w2ui-lock").remove(),a(b).find(".w2ui-lock-msg").remove()},d)):(a(b).find(".w2ui-lock").remove(),a(b).find(".w2ui-lock-msg").remove())}function A(b,c){var d=a(b),e={left:parseInt(d.css("border-left-width"))||0,right:parseInt(d.css("border-right-width"))||0,top:parseInt(d.css("border-top-width"))||0,bottom:parseInt(d.css("border-bottom-width"))||0},f={left:parseInt(d.css("margin-left"))||0,right:parseInt(d.css("margin-right"))||0,top:parseInt(d.css("margin-top"))||0,bottom:parseInt(d.css("margin-bottom"))||0},g={left:parseInt(d.css("padding-left"))||0,right:parseInt(d.css("padding-right"))||0,top:parseInt(d.css("padding-top"))||0,bottom:parseInt(d.css("padding-bottom"))||0};switch(c){case"top":return e.top+f.top+g.top;case"bottom":return e.bottom+f.bottom+g.bottom;case"left":return e.left+f.left+g.left;case"right":return e.right+f.right+g.right;case"width":return e.left+e.right+f.left+f.right+g.left+g.right+parseInt(d.width());case"height":return e.top+e.bottom+f.top+f.bottom+g.top+g.bottom+parseInt(d.height());case"+width":return e.left+e.right+f.left+f.right+g.left+g.right;case"+height":return e.top+e.bottom+f.top+f.bottom+g.top+g.bottom}return 0}function B(b,c){var d,e='<div id="_tmp_width" style="position: absolute; top: -900px;'+c+'">'+b+"</div>";return a("body").append(e),d=a("#_tmp_width").width(),a("#_tmp_width").remove(),d}function C(a){var b=this.settings.phrases[a];return null==b?a:b}function D(b){return b||(b="en-us"),"string"!=typeof b?void(w2utils.settings=a.extend(!0,w2utils.settings,b)):(5===b.length&&(b="locale/"+b+".json"),w2utils.settings.phrases={},void a.ajax({url:b,type:"GET",dataType:"JSON",async:!1,cache:!1,success:function(b){w2utils.settings=a.extend(!0,w2utils.settings,b)},error:function(){console.log("ERROR: Cannot load locale "+b)}}))}function E(){if(J.scrollBarSize)return J.scrollBarSize;var b='<div id="_scrollbar_width" style="position: absolute; top: -300px; width: 100px; height: 100px; overflow-y: scroll;"> <div style="height: 120px">1</div></div>';return a("body").append(b),J.scrollBarSize=100-a("#_scrollbar_width > div").width(),a("#_scrollbar_width").remove(),String(navigator.userAgent).indexOf("MSIE")>=0&&(J.scrollBarSize=J.scrollBarSize/2),J.scrollBarSize}function F(a,b){return a&&null!=a.name?null!=w2ui[a.name]?(console.log('ERROR: The parameter "name" is not unique. There are other objects already created with the same name (obj: '+a.name+")."),!1):w2utils.isAlphaNumeric(a.name)?!0:(console.log('ERROR: The parameter "name" has to be alpha-numeric (a-z, 0-9, dash and underscore). '),!1):(console.log('ERROR: The parameter "name" is required but not supplied in $().'+b+"()."),!1)}function G(b,c,d,e){a.isArray(c)||(c=[c]);for(var f=0;f<c.length;f++)if(c[f].id===b)return console.log('ERROR: The parameter "id='+b+'" is not unique within the current '+d+". (obj: "+e+")"),!1;return!0}function H(a){var b=[],c=a.replace(/\/\(/g,"(?:/").replace(/\+/g,"__plus__").replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,function(a,c,d,e,f,g){return b.push({name:e,optional:!!g}),c=c||"",""+(g?"":c)+"(?:"+(g?c:"")+(d||"")+(f||d&&"([^/.]+?)"||"([^/]+?)")+")"+(g||"")}).replace(/([\/.])/g,"\\$1").replace(/__plus__/g,"(.+)").replace(/\*/g,"(.*)");return{path:new RegExp("^"+c+"$","i"),keys:b}}function I(b,c,d){var e={},f={},g="";a.isPlainObject(b)?(e=b,c===!0&&(d=!0)):e[b]=c;for(var h in e)f[h]=e[h],f["-webkit-"+h]=e[h],f["-moz-"+h]=e[h].replace("-webkit-","-moz-"),f["-ms-"+h]=e[h].replace("-webkit-","-ms-"),f["-o-"+h]=e[h].replace("-webkit-","-o-");if(d===!0)for(var h in f)g+=h+": "+f[h]+"; ";else g=f;return g}var J={},K={version:"1.5.x",settings:{locale:"en-us",date_format:"m/d/yyyy",time_format:"hh:mi pm",currencyPrefix:"$",currencySuffix:"",currencyPrecision:2,groupSymbol:",",decimalSymbol:".",shortmonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],fullmonths:["January","February","March","April","May","June","July","August","September","October","November","December"],shortdays:["M","T","W","T","F","S","S"],fulldays:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],weekStarts:"M",dataType:"HTTP",phrases:{},dateStartYear:1950,dateEndYear:2020},isBin:b,isInt:c,isFloat:d,isMoney:e,isHex:f,isAlphaNumeric:g,isEmail:h,isDate:i,isTime:j,isDateTime:k,age:l,date:m,formatSize:n,formatNumber:o,formatDate:p,formatTime:q,formatDateTime:r,stripTags:s,encodeTags:t,escapeId:u,base64encode:v,base64decode:w,transition:x,lock:y,unlock:z,lang:C,locale:D,getSize:A,getStrWidth:B,scrollBarSize:E,checkName:F,checkUniqueId:G,parseRoute:H,cssPrefix:I,isIOS:-1!=navigator.userAgent.toLowerCase().indexOf("iphone")||-1!=navigator.userAgent.toLowerCase().indexOf("ipod")||-1!=navigator.userAgent.toLowerCase().indexOf("ipad")?!0:!1,isIE:-1!=navigator.userAgent.toLowerCase().indexOf("msie")||-1!=navigator.userAgent.toLowerCase().indexOf("trident")?!0:!1,use_momentjs:"function"==typeof moment&&"string"==typeof moment.version};return K}(jQuery);w2utils.event={on:function(a,b){return $.isPlainObject(a)||(a={type:a}),a=$.extend({type:null,execute:"before",target:null,onComplete:null},a),a.type?b?($.isArray(this.handlers)||(this.handlers=[]),void this.handlers.push({event:a,handler:b})):void console.log("ERROR: You must specify event handler function when calling .on() method of "+this.name):void console.log("ERROR: You must specify event type when calling .on() method of "+this.name)},off:function(a,b){if($.isPlainObject(a)||(a={type:a}),a=$.extend({},{type:null,execute:"before",target:null,onComplete:null},a),!a.type)return void console.log("ERROR: You must specify event type when calling .off() method of "+this.name);b||(b=null);for(var c=[],d=0,e=this.handlers.length;e>d;d++){var f=this.handlers[d];(f.event.type!==a.type&&"*"!==a.type||f.event.target!==a.target&&null!=a.target||f.handler!==b&&null!=b)&&c.push(f)}this.handlers=c},trigger:function(a){var a=$.extend({type:null,phase:"before",target:null},a,{isStopped:!1,isCancelled:!1,preventDefault:function(){this.isCancelled=!0},stopPropagation:function(){this.isStopped=!0}});"before"===a.phase&&(a.onComplete=null);var b,c,d;null==a.target&&(a.target=null),$.isArray(this.handlers)||(this.handlers=[]);for(var e=this.handlers.length-1;e>=0;e--){var f=this.handlers[e];if(!(f.event.type!==a.type&&"*"!==f.event.type||f.event.target!==a.target&&null!=f.event.target||f.event.execute!==a.phase&&"*"!==f.event.execute&&"*"!==f.event.phase)&&(a=$.extend({},f.event,a),b=[],d=new RegExp(/\((.*?)\)/).exec(f.handler),d&&(b=d[1].split(/\s*,\s*/)),2===b.length?f.handler.call(this,a.target,a):f.handler.call(this,a),a.isStopped===!0||a.stop===!0))return a}var g="on"+a.type.substr(0,1).toUpperCase()+a.type.substr(1);return"before"===a.phase&&"function"==typeof this[g]&&(c=this[g],b=[],d=new RegExp(/\((.*?)\)/).exec(c),d&&(b=d[1].split(/\s*,\s*/)),2===b.length?c.call(this,a.target,a):c.call(this,a),a.isStopped===!0||a.stop===!0)?a:null!=a.object&&"before"===a.phase&&"function"==typeof a.object[g]&&(c=a.object[g],b=[],d=new RegExp(/\((.*?)\)/).exec(c),d&&(b=d[1].split(/\s*,\s*/)),2===b.length?c.call(this,a.target,a):c.call(this,a),a.isStopped===!0||a.stop===!0)?a:("after"===a.phase&&"function"==typeof a.onComplete&&a.onComplete.call(this,a),a)}},function(a){a.fn.w2render=function(b){a(this).length>0&&("string"==typeof b&&w2ui[b]&&w2ui[b].render(a(this)[0]),"object"==typeof b&&b.render(a(this)[0]))},a.fn.w2destroy=function(a){!a&&this.length>0&&(a=this.attr("name")),"string"==typeof a&&w2ui[a]&&w2ui[a].destroy(),"object"==typeof a&&a.destroy()},a.fn.w2marker=function(){function b(a,b){for(;-1!=b.innerHTML.indexOf('<span class="w2ui-marker">');)b.innerHTML=b.innerHTML.replace(/\<span class=\"w2ui\-marker\"\>(.*)\<\/span\>/gi,"$1")}var c=Array.prototype.slice.call(arguments,0);return a(this).each(0!=c.length&&c[0]?function(a,d){function e(a){return'<span class="w2ui-marker">'+a+"</span>"}b(a,d);for(var f=0;f<c.length;f++){var g=c[f];"string"!=typeof g&&(g=String(g)),g=g.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&").replace(/&/g,"&").replace(/</g,">").replace(/>/g,"<");var h=new RegExp(g+"(?!([^<]+)?>)","gi");d.innerHTML=d.innerHTML.replace(h,e)}}:b)},a.fn.w2tag=function(b,c){return 1==arguments.length&&"object"==typeof b&&(c=b,null!=c.html&&(b=c.html)),c=a.extend({id:null,html:b,position:"right",left:0,top:0,style:"",css:{},"class":"",onShow:null,onHide:null,hideOnKeyPress:!0,hideOnBlur:!1},c),0===a(this).length?void a(".w2ui-tag").each(function(b,c){var d=a(c).data("options");null==d&&(d={}),a(a(c).data("taged-el")).removeClass(d["class"]),clearInterval(a(c).data("timer")),a(c).remove()}):a(this).each(function(d,e){function f(){j=a("#w2ui-tag-"+i),j.length<=0||(clearInterval(j.data("timer")),j.remove(),a(e).off(".w2tag",f).removeClass(c["class"]).removeData("w2tag"),a(e).length>0&&(a(e)[0].style.cssText=k),"function"==typeof c.onHide&&c.onHide())}function g(){if(0===a(e).length||0===a(e).offset().left&&0===a(e).offset().top||0==j.find(".w2ui-tag-body").length)return clearInterval(j.data("timer")),void f();var b="w2ui-tag-right",d=parseInt(a(e).offset().left+e.offsetWidth+(c.left?c.left:0)),g=parseInt(a(e).offset().top+(c.top?c.top:0)),h=j.find(".w2ui-tag-body"),i=h[0].offsetWidth,k=h[0].offsetHeight;return"top"==c.position&&(b="w2ui-tag-top",d=parseInt(a(e).offset().left+(c.left?c.left:0))-14,g=parseInt(a(e).offset().top+(c.top?c.top:0))-k-10),"bottom"==c.position&&(b="w2ui-tag-bottom",d=parseInt(a(e).offset().left+(c.left?c.left:0))-14,g=parseInt(a(e).offset().top+e.offsetHeight+(c.top?c.top:0))+10),"left"==c.position&&(b="w2ui-tag-left",d=parseInt(a(e).offset().left+(c.left?c.left:0))-i-20,g=parseInt(a(e).offset().top+(c.top?c.top:0))),j.data("position")!==d+"x"+g&&j.css(w2utils.cssPrefix({transition:".2s"})).css({left:d+"px",top:g+"px"}).data("position",d+"x"+g),{left:d,top:g,"class":b}}var h=c.id?c.id:e.id,i=w2utils.escapeId(h),j=a("#w2ui-tag-"+i);if(""===b||null==b)return j.css("opacity",0),clearInterval(j.data("timer")),void j.remove();if(0!=j.length)c=a.extend(j.data("options"),c),j.data("options",c),j.find(".w2ui-tag-body").attr("style",c.style).html(c.html);else{var k="";a(e).length>0&&(k=a(e)[0].style.cssText),a("body").append('<div id="w2ui-tag-'+h+'" class="w2ui-tag '+(a(e).parents(".w2ui-popup").length>0?"w2ui-tag-popup":"")+'"> <div style="margin: -2px 0px 0px -2px; white-space: nowrap;"> <div class="w2ui-tag-body" style="'+(c.style||"")+'">'+b+"</div> </div></div>"),j=a("#w2ui-tag-"+i),a(e).data("w2tag",j.get(0))}setTimeout(function(){if(a(e).offset()){var b=g();j.css({opacity:"1",left:b.left+"px",top:b.top+"px"}).data("options",c).data("taged-el",e).data("position",b.left+"x"+b.top).data("timer",setInterval(g,100)).find(".w2ui-tag-body").addClass(b["class"]),a(e).css(c.css).off(".w2tag").addClass(c["class"]),c.hideOnKeyPress&&a(e).on("keypress.w2tag",f),c.hideOnBlur&&a(e).on("blur.w2tag",f),"function"==typeof c.onShow&&c.onShow()}},1)})},a.fn.w2overlay=function(b,c){function d(){var b=a("#w2ui-overlay"+h);if(b.data("element")===g[0]&&0!==b.length){var c=a(g).offset()||{},f=c.left+"x"+c.top;b.data("position")!==f?e():setTimeout(d,250)}}function e(b){if(!b||0==b.button){var d=a("#w2ui-overlay"+h);if(d.data("keepOpen")===!0)return void d.removeData("keepOpen");var f;"function"==typeof c.onHide&&(f=c.onHide()),f!==!1&&(d.remove(),a(document).off("click",e),clearInterval(d.data("timer")))}}function f(){var b=a("#w2ui-overlay"+h),d=b.find(" > div");if(b.length>0){d.height("auto").width("auto");var e=!1,i=d.height(),j=d.width();c.width&&c.width<j&&(j=c.width),30>j&&(j=30),c.tmp.contentHeight&&(i=parseInt(c.tmp.contentHeight),d.height(i),setTimeout(function(){var a=d.find("div.menu > table");i>a.height()&&d.find("div.menu").css("overflow-y","hidden")},1),setTimeout(function(){var a=d.find("div.menu");"auto"!=a.css("overflow-y")&&a.css("overflow-y","auto")},10)),c.tmp.contentWidth&&(j=parseInt(c.tmp.contentWidth),d.width(j),setTimeout(function(){j>d.find("div.menu > table").width()&&d.find("div.menu").css("overflow-x","hidden")},1),setTimeout(function(){d.find("div.menu").css("overflow-x","auto")},10));var k=(j-17)/2,l=c.left,m=c.width,n=c.tipLeft;switch(c.align){case"both":l=17+parseInt(c.left),0===c.width&&(c.width=w2utils.getSize(a(g),"width")),c.maxWidth&&c.width>c.maxWidth&&(c.width=c.maxWidth);break;case"left":l=17+parseInt(c.left);break;case"right":l=w2utils.getSize(a(g),"width")-j+14+parseInt(c.left),n=j-40}m=30!==j||m?c.width?c.width:"auto":30,25>k&&(l=25-k,n=Math.floor(k));var o,p,q;if(c.contextMenu)o=c.originalEvent.pageX+8,p=c.originalEvent.pageY-0,q=c.originalEvent.pageY;else{var r=g.offset()||{};o=(r.left>25?r.left:25)+l,p=r.top+w2utils.getSize(g,"height")+c.top+7,q=r.top}b.css({left:o+"px",top:p+"px","min-width":m,"min-height":c.height?c.height:"auto"});var r=d.offset()||{},s=window.innerHeight+a(document).scrollTop()-r.top-7,t=window.innerWidth+a(document).scrollLeft()-r.left-7;if(c.contextMenu&&(s=window.innerHeight-c.originalEvent.pageY-15,t=window.innerWidth-c.originalEvent.pageX),s>-50&&210>s||c.openAbove===!0){var u;c.contextMenu?(s=c.originalEvent.pageY-7,u=5):(s=r.top-a(document).scrollTop()-7,u=24),c.maxHeight&&s>c.maxHeight&&(s=c.maxHeight),i>s&&(e=!0,d.height(s).width(j).css({"overflow-y":"auto"}),i=s),b.addClass("bottom-arrow"),b.css("top",q-i-u+c.top+"px"),b.find(">style").html("#w2ui-overlay"+h+":before { margin-left: "+parseInt(n)+"px; }#w2ui-overlay"+h+":after { margin-left: "+parseInt(n)+"px; }")}else c.maxHeight&&s>c.maxHeight&&(s=c.maxHeight),i>s&&(e=!0,d.height(s).width(j).css({"overflow-y":"auto"})),b.addClass("top-arrow"),b.find(">style").html("#w2ui-overlay"+h+":before { margin-left: "+parseInt(n)+"px; }#w2ui-overlay"+h+":after { margin-left: "+parseInt(n)+"px; }");j=d.width(),t=window.innerWidth+a(document).scrollLeft()-r.left-7,c.maxWidth&&t>c.maxWidth&&(t=c.maxWidth),j>t&&"both"!==c.align&&(c.align="right",setTimeout(function(){f()},1)),(c.contextMenu||c.noTip)&&b.find(">style").html("#w2ui-overlay"+h+":before { display: none; }#w2ui-overlay"+h+":after { display: none; }"),e&&"both"!=c.align&&d.width(j+w2utils.scrollBarSize()+2)}}var g=this,h="",i={name:null,html:"",align:"none",left:0,top:0,tipLeft:30,noTip:!1,selectable:!1,width:0,height:0,maxWidth:null,maxHeight:null,contextMenu:!1,style:"","class":"",overlayStyle:"",onShow:null,onHide:null,openAbove:!1,tmp:{}};1==arguments.length&&(c="object"==typeof b?b:{html:b}),2==arguments.length&&(c.html=b),a.isPlainObject(c)||(c={}),c=a.extend({},i,c),c.name&&(h="-"+c.name);var j;if(0==this.length||""===c.html||null==c.html)return a("#w2ui-overlay"+h).length>0?(j=a("#w2ui-overlay"+h)[0].hide,"function"==typeof j&&j()):a("#w2ui-overlay"+h).remove(),a(this);a("#w2ui-overlay"+h).length>0&&(j=a("#w2ui-overlay"+h)[0].hide,a(document).off("click",j),"function"==typeof j&&j()),g.length>0&&(null==g[0].tagName||"BODY"==g[0].tagName.toUpperCase())&&(c.contextMenu=!0),c.contextMenu&&null==c.originalEvent&&console.log("ERROR: for context menu you need to pass options.originalEvent."),a("body").append('<div id="w2ui-overlay'+h+'" style="display: none; left: 0px; top: 0px; '+c.overlayStyle+'" class="w2ui-reset w2ui-overlay '+(a(this).parents(".w2ui-popup, .w2ui-overlay-popup").length>0?"w2ui-overlay-popup":"")+'"> <style></style> <div style="min-width: 100%; '+c.style+'" class="'+c["class"]+'"></div></div>');var k=a("#w2ui-overlay"+h),l=k.find(" > div");l.html(c.html);var m=l.css("background-color");null!=m&&"rgba(0, 0, 0, 0)"!==m&&"transparent"!==m&&k.css({"background-color":m,"border-color":m});var n=a(g).offset()||{};return k.data("element",g.length>0?g[0]:null).data("options",c).data("position",n.left+"x"+n.top).fadeIn("fast").on("click",function(a){"LABEL"==a.target.tagName.toUpperCase()&&a.stopPropagation()}).on("mousedown",function(b){a("#w2ui-overlay"+h).data("keepOpen",!0),-1!=["INPUT","TEXTAREA","SELECT"].indexOf(b.target.tagName.toUpperCase())||c.selectable||b.preventDefault()}),k[0].hide=e,k[0].resize=f,setTimeout(function(){f(),a(document).off("click",e).on("click",e),"function"==typeof c.onShow&&c.onShow()},10),d(),a(this)},a.fn.w2menu=function(b,c){function d(){setTimeout(function(){a("#w2ui-overlay"+i+" tr.w2ui-selected").removeClass("w2ui-selected");var b=a("#w2ui-overlay"+i+" tr[index="+c.index+"]"),d=a("#w2ui-overlay"+i+" div.menu").scrollTop();if(b.addClass("w2ui-selected"),c.tmp&&(c.tmp.contentHeight=a("#w2ui-overlay"+i+" table").height()+(c.search?50:10)),c.tmp&&(c.tmp.contentWidth=a("#w2ui-overlay"+i+" table").width()),a("#w2ui-overlay"+i).length>0&&a("#w2ui-overlay"+i)[0].resize(),b.length>0){var e=b[0].offsetTop-5,f=a("#w2ui-overlay"+i+" div.menu"),g=f.height();
a("#w2ui-overlay"+i+" div.menu").scrollTop(d),(d>e||e+b.height()>d+g)&&a("#w2ui-overlay"+i+" div.menu").animate({scrollTop:e-(g-2*b.height())/2},200,"linear")}},1)}function e(b){var e=this.value,f=b.keyCode,g=!1;switch(f){case 13:a("#w2ui-overlay"+i).remove(),a.fn.w2menuClick(b,c.index);break;case 9:case 27:a("#w2ui-overlay"+i).remove(),a.fn.w2menuClick(b,-1);break;case 38:for(c.index=w2utils.isInt(c.index)?parseInt(c.index):0,c.index--;c.index>0&&c.items[c.index].hidden;)c.index--;if(0===c.index&&c.items[c.index].hidden)for(;c.items[c.index]&&c.items[c.index].hidden;)c.index++;c.index<0&&(c.index=0),g=!0;break;case 40:for(c.index=w2utils.isInt(c.index)?parseInt(c.index):0,c.index++;c.index<c.items.length-1&&c.items[c.index].hidden;)c.index++;if(c.index===c.items.length-1&&c.items[c.index].hidden)for(;c.items[c.index]&&c.items[c.index].hidden;)c.index--;c.index>=c.items.length&&(c.index=c.items.length-1),g=!0}if(!g){for(var j=0,k=0;k<c.items.length;k++){var l=c.items[k],m="",n="";-1!==["is","begins with"].indexOf(c.match)&&(m="^"),-1!==["is","ends with"].indexOf(c.match)&&(n="$");try{var o=new RegExp(m+e+n,"i");l.hidden=o.test(l.text)||"..."===l.text?!1:!0}catch(p){}"enum"===h.type&&-1!==a.inArray(l.id,ids)&&(l.hidden=!0),l.hidden!==!0&&j++}for(c.index=0;c.index<c.items.length-1&&c.items[c.index].hidden;)c.index++;0>=j&&(c.index=-1)}a(h).w2menu("refresh",c),d()}function f(){if(c.spinner)return'<table class="w2ui-drop-menu"><tbody><tr><td style="padding: 5px 10px 10px 10px; text-align: center"> <div class="w2ui-spinner" style="width: 18px; height: 18px; position: relative; top: 5px;"></div> <div style="display: inline-block; padding: 3px; color: #999;">'+w2utils.lang("Loading...")+"</div></td></tr></tbody></table>";for(var a=0,b='<table cellspacing="0" cellpadding="0" class="w2ui-drop-menu"><tbody>',d=null,e=null,f=0;f<c.items.length;f++){var g=c.items[f];if("string"==typeof g?g={id:g,text:g}:(null!=g.text&&null==g.id&&(g.id=g.text),null==g.text&&null!=g.id&&(g.text=g.id),null!=g.caption&&(g.text=g.caption),d=g.img,e=g.icon,null==d&&(d=null),null==e&&(e=null)),-1!=["radio","check"].indexOf(c.type)&&(e=g.checked===!0?"w2ui-icon-check":"w2ui-icon-empty"),g.hidden!==!0){var h="",i=g.text;if("function"==typeof c.render&&(i=c.render(g,c)),d&&(h='<td class="menu-icon"><div class="w2ui-tb-image w2ui-icon '+d+'"></div></td>'),e&&(h='<td class="menu-icon" align="center"><span class="w2ui-icon '+e+'"></span></td>'),null==i||""===i||/^-+$/.test(i))b+='<tr><td colspan="3" style="padding: 6px; pointer-events: none"><div style="border-top: 1px solid silver;"></div></td></tr>';else{var j=a%2===0?"w2ui-item-even":"w2ui-item-odd";c.altRows!==!0&&(j="");var k=1;""==h&&k++,null==g.count&&null==g.hotkey&&k++,null==g.tooltip&&null!=g.hint&&(g.tooltip=g.hint),b+='<tr index="'+f+'" style="'+(g.style?g.style:"")+'" '+(g.tooltip?'title="'+g.tooltip+'"':"")+' class="'+j+" "+(c.index===f?"w2ui-selected":"")+" "+(g.disabled===!0?"w2ui-disabled":"")+'" onmousedown="if ('+(g.disabled===!0?"true":"false")+") return; $.fn.w2menuDown(event, '"+f+'\');" onmouseout="if ('+(g.disabled===!0?"true":"false")+") return; $.fn.w2menuOut(event, '"+f+'\');" onclick="event.stopPropagation(); if ('+(g.disabled===!0?"true":"false")+") return; $.fn.w2menuClick(event, '"+f+"');\">"+h+' <td class="menu-text" colspan="'+k+'">'+i+'</td> <td class="menu-count">'+(null!=g.count?"<span>"+g.count+"</span>":"")+(null!=g.hotkey?'<span class="hotkey">'+g.hotkey+"</span>":"")+"</td></tr>",a++}}c.items[f]=g}return 0===a&&(b+='<tr><td style="padding: 13px; color: #999; text-align: center">'+c.msgNoItems+"</div></td></tr>"),b+="</tbody></table>"}var g={type:"normal",index:null,items:[],render:null,msgNoItems:"No items",onSelect:null,tmp:{}},h=this,i="";if("refresh"!==b){if("refresh-index"===b){var j=a("#w2ui-overlay"+i+" div.menu"),k=j.find("tr[index="+c.index+"]"),l=j.scrollTop();if(j.find("tr.w2ui-selected").removeClass("w2ui-selected"),k.addClass("w2ui-selected"),k.length>0){var m=k[0].offsetTop-5,n=j.height();j.scrollTop(l),(l>m||m+k.height()>l+n)&&j.animate({scrollTop:m-(n-2*k.height())/2},200,"linear")}return}1===arguments.length?c=b:c.items=b,"object"!=typeof c&&(c={}),c=a.extend({},g,c),a.fn.w2menuOptions=c,c.name&&(i="-"+c.name),"function"==typeof c.select&&"function"!=typeof c.onSelect&&(c.onSelect=c.select),"function"==typeof c.onRender&&"function"!=typeof c.render&&(c.render=c.onRender),a.fn.w2menuClick=function(b,d){-1!=["radio","check"].indexOf(c.type)&&a(b.target).parents("tr").find(".w2ui-icon").removeClass("w2ui-icon-empty").addClass("w2ui-icon-check"),"function"==typeof c.onSelect&&setTimeout(function(){c.onSelect({index:d,item:c.items[d],originalEvent:b})},10);var e=a("#w2ui-overlay"+i);"function"==typeof e[0].hide&&(e.removeData("keepOpen"),e[0].hide())},a.fn.w2menuDown=function(b){var d=a(b.target).parents("tr"),e=d.find(".w2ui-icon");e.hasClass("w2ui-icon-empty")?("radio"==c.type&&e.parents("table").find(".w2ui-icon").removeClass("w2ui-icon-check").addClass("w2ui-icon-empty"),e.removeClass("w2ui-icon-empty").addClass("w2ui-icon-check")):e.hasClass("w2ui-icon-check")&&"check"==c.type&&e.removeClass("w2ui-icon-check").addClass("w2ui-icon-empty"),d.parent().find("tr").removeClass("w2ui-selected"),d.addClass("w2ui-selected"),a.fn.w2menuTmp=d},a.fn.w2menuOut=function(){var b=a(a.fn.w2menuTmp);b.length>0&&(b.removeClass("w2ui-selected"),b.find(".w2ui-icon").removeClass("w2ui-icon-check"),delete a.fn.w2menuTmp)};var o="";if(c.search){o+='<div style="position: absolute; top: 0px; height: 40px; left: 0px; right: 0px; border-bottom: 1px solid silver; background-color: #ECECEC; padding: 8px 5px;"> <div class="w2ui-icon icon-search" style="position: absolute; margin-top: 4px; margin-left: 6px; width: 11px; background-position: left !important;"></div> <input id="menu-search" type="text" style="width: 100%; outline: none; padding-left: 20px;" onclick="event.stopPropagation();"/></div>',c.style+=";background-color: #ECECEC",c.index=0;for(var p=0;p<c.items.length;p++)c.items[p].hidden=!1}o+='<div class="menu" style="position: absolute; top: '+(c.search?40:0)+'px; bottom: 0px; width: 100%; overflow: auto;">'+f()+"</div>";var q=a(this).w2overlay(o,c);return setTimeout(function(){if(a("#w2ui-overlay"+i+" #menu-search").on("keyup",e).on("keydown",function(a){9===a.keyCode&&(a.stopPropagation(),a.preventDefault())}),c.search){if(-1!=["text","password"].indexOf(a(h)[0].type)||"TEXTAREA"==a(h)[0].tagName.toUpperCase())return;a("#w2ui-overlay"+i+" #menu-search").focus()}},200),d(),q}if(a("#w2ui-overlay"+i).length>0){c=a.extend(a.fn.w2menuOptions,c);var l=a("#w2ui-overlay"+i+" div.menu").scrollTop();a("#w2ui-overlay"+i+" div.menu").html(f()),a("#w2ui-overlay"+i+" div.menu").scrollTop(l),setTimeout(function(){d()},1)}else a(this).w2menu(c)},a.fn.w2color=function(b,c){function d(a){for(var b='<div class="w2ui-color"><table cellspacing="5"><tbody>',c=0;c<g.length-1;c++){b+="<tr>";for(var d=0;d<g[c].length;d++)b+='<td> <div class="color '+(""==g[c][d]?"no-color":"")+'" style="background-color: #'+g[c][d]+';" name="'+g[c][d]+'" index="'+c+":"+d+'">'+(a==g[c][d]?"•":" ")+" </div></td>",a==g[c][d]&&(f=[c,d]);b+="</tr>",2>c&&(b+='<tr><td style="height: 8px" colspan="8"></td></tr>')}var e=g[g.length-1];return b+='<tr><td style="height: 8px" colspan="8"></td></tr><tr> <td colspan="4" style="text-align: left"><input placeholder="#FFF000" style="margin-left: 1px; width: 74px" maxlength="7"/></td> <td><div class="color" style="background-color: #'+e[0]+';" name="'+e[0]+'" index="8:0">'+(a==e[0]?"•":" ")+'</div></td> <td><div class="color" style="background-color: #'+e[1]+';" name="'+e[1]+'" index="8:0">'+(a==e[1]?"•":" ")+'</div></td> <td><div class="color" style="background-color: #'+e[2]+';" name="'+e[2]+'" index="8:0">'+(a==e[2]?"•":" ")+'</div></td> <td><div class="color" style="background-color: #'+e[3]+';" name="'+e[3]+'" index="8:0">'+(a==e[3]?"•":" ")+'</div></td></tr><tr><td style="height: 4px" colspan="8"></td></tr>',b+="</tbody></table></div>"}var e=a(this)[0],f=[-1,-1];null==a.fn.w2colorPalette&&(a.fn.w2colorPalette=[["000000","888888","BBBBBB","DDDDDD","EEEEEE","F7F7F7","FFFFFF",""],["FF011B","FF9838","FFFD59","01FD55","00FFFE","006CE7","9B24F4","FF21F5"],["FFEAEA","FCEFE1","FCF5E1","EBF7E7","E9F3F5","ECF4FC","EAE6F4","F5E7ED"],["F4CCCC","FCE5CD","FFF2CC","D9EAD3","D0E0E3","CFE2F3","D9D1E9","EAD1DC"],["EA9899","F9CB9C","FEE599","B6D7A8","A2C4C9","9FC5E8","B4A7D6","D5A6BD"],["E06666","F6B26B","FED966","93C47D","76A5AF","6FA8DC","8E7CC3","C27BA0"],["CC0814","E69138","F1C232","6AA84F","45818E","3D85C6","674EA7","A54D79"],["99050C","B45F17","BF901F","37761D","124F5C","0A5394","351C75","741B47"],["F2F2F2","F2F2F2","F2F2F2","F2F2F2","F2F2F2"]]);var g=a.fn.w2colorPalette;"string"!=typeof b&&(b=""),b&&(b=String(b).toUpperCase()),0==a("#w2ui-overlay").length?a(e).w2overlay(d(b),{onHide:function(){"function"==typeof c&&c(a(e).data("_color")),a(e).removeData("_color")}}):a("#w2ui-overlay .w2ui-color").parent().html(d(b)),a("#w2ui-overlay .color").on("mousedown",function(b){var c=a(b.originalEvent.target).attr("name");f=a(b.originalEvent.target).attr("index").split(":"),a(e).data("_color",c)}).on("mouseup",function(){setTimeout(function(){a("#w2ui-overlay").length>0&&a("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)}),a("#w2ui-overlay input").on("mousedown",function(b){a("#w2ui-overlay").data("keepOpen",!0),setTimeout(function(){a("#w2ui-overlay").data("keepOpen",!0)},10),b.stopPropagation()}).on("keyup",function(){""!=this.value&&"#"!=this.value[0]&&(this.value="#"+this.value)}).on("change",function(){var d=this.value;return"#"==d.substr(0,1)&&(d=d.substr(1)),6!=d.length?void a(this).w2tag("Invalid color."):(a.fn.w2colorPalette[g.length-1].unshift(d.toUpperCase()),a(e).w2color(b,c),void setTimeout(function(){a("#w2ui-overlay input")[0].focus()},100))}).w2field("hex"),e.nav=function(c){switch(c){case"up":f[0]--;break;case"down":f[0]++;break;case"right":f[1]++;break;case"left":f[1]--}return f[0]<0&&(f[0]=0),f[0]>g.length-2&&(f[0]=g.length-2),f[1]<0&&(f[1]=0),f[1]>g[0].length-1&&(f[1]=g[0].length-1),b=g[f[0]][f[1]],a(e).data("_color",b),b}}}(jQuery),function(a){var b=function(b){this.el=null,this.helpers={},this.type=b.type||"text",this.options=a.extend(!0,{},b),this.onSearch=b.onSearch||null,this.onRequest=b.onRequest||null,this.onLoad=b.onLoad||null,this.onError=b.onError||null,this.onClick=b.onClick||null,this.onAdd=b.onAdd||null,this.onNew=b.onNew||null,this.onRemove=b.onRemove||null,this.onMouseOver=b.onMouseOver||null,this.onMouseOut=b.onMouseOut||null,this.onIconClick=b.onIconClick||null,this.onScroll=b.onScroll||null,this.tmp={},delete this.options.type,delete this.options.onSearch,delete this.options.onRequest,delete this.options.onLoad,delete this.options.onError,delete this.options.onClick,delete this.options.onMouseOver,delete this.options.onMouseOut,delete this.options.onIconClick,delete this.options.onScroll,a.extend(!0,this,w2obj.field)};a.fn.w2field=function(c,d){if(0!=this.length){if(0==arguments.length){var e=a(this).data("w2field");return e}return"string"==typeof c&&"object"==typeof d&&(c=a.extend(!0,{},d,{type:c})),"string"==typeof c&&null==d&&(c={type:c}),c.type=String(c.type).toLowerCase(),this.each(function(d,e){var f=a(e).data("w2field");if(null==f){var f=new b(c);return a.extend(f,{handlers:[]}),e&&(f.el=a(e)[0]),f.init(),a(e).data("w2field",f),f}if(f.clear(),"clear"!=c.type){var f=new b(c);return a.extend(f,{handlers:[]}),e&&(f.el=a(e)[0]),f.init(),a(e).data("w2field",f),f}})}var f=b.prototype;return f[c]?f[c].apply(f,Array.prototype.slice.call(arguments,1)):void 0},b.prototype={custom:{},addType:function(a,b){return a=String(a).toLowerCase(),this.custom[a]=b,!0},removeType:function(a){return a=String(a).toLowerCase(),this.custom[a]?(delete this.custom[a],!0):!1},init:function(){var b,c=this,d=this.options;if("function"==typeof this.custom[this.type])return void this.custom[this.type].call(this,d);if(-1==["INPUT","TEXTAREA"].indexOf(this.el.tagName.toUpperCase()))return void console.log("ERROR: w2field could only be applied to INPUT or TEXTAREA.",this.el);switch(this.type){case"text":case"int":case"float":case"money":case"currency":case"percent":case"alphanumeric":case"bin":case"hex":b={min:null,max:null,step:1,autoFormat:!0,currencyPrefix:w2utils.settings.currencyPrefix,currencySuffix:w2utils.settings.currencySuffix,currencyPrecision:w2utils.settings.currencyPrecision,decimalSymbol:w2utils.settings.decimalSymbol,groupSymbol:w2utils.settings.groupSymbol,arrows:!1,keyboard:!0,precision:null,silent:!0,prefix:"",suffix:""},this.options=a.extend(!0,{},b,d),d=this.options,d.numberRE=new RegExp("["+d.groupSymbol+"]","g"),d.moneyRE=new RegExp("["+d.currencyPrefix+d.currencySuffix+d.groupSymbol+"]","g"),d.percentRE=new RegExp("["+d.groupSymbol+"%]","g"),-1!=["text","alphanumeric","hex","bin"].indexOf(this.type)&&(d.arrows=!1,d.keyboard=!1),this.addPrefix(),this.addSuffix();break;case"color":b={prefix:"#",suffix:'<div style="width: '+(parseInt(a(this.el).css("font-size"))||12)+'px"> </div>',arrows:!1,keyboard:!1},a.extend(d,b),this.addPrefix(),this.addSuffix(),a(this.el).attr("maxlength",6),""!=a(this.el).val()&&setTimeout(function(){c.change()},1);break;case"date":b={format:w2utils.settings.date_format,keyboard:!0,silent:!0,start:"",end:"",blocked:{},colored:{}},this.options=a.extend(!0,{},b,d),d=this.options,null==a(this.el).attr("placeholder")&&a(this.el).attr("placeholder",d.format);break;case"time":b={format:w2utils.settings.time_format,keyboard:!0,silent:!0,start:"",end:""},this.options=a.extend(!0,{},b,d),d=this.options,null==a(this.el).attr("placeholder")&&a(this.el).attr("placeholder",d.format);break;case"datetime":b={format:w2utils.settings.date_format+"|hh24:mm",keyboard:!0,silent:!0,start:"",end:"",blocked:[],colored:{},placeholder:null,format_mjs:"M/D/YYYY HH:mm",btn_now:!0},this.options=a.extend(!0,{},b,d),d=this.options,null==a(this.el).attr("placeholder")&&a(this.el).attr("placeholder",d.placeholder||d.format);break;case"list":case"combo":if(b={items:[],selected:{},url:null,method:null,interval:350,postData:{},minLength:1,cacheMax:250,maxDropHeight:350,maxDropWidth:null,match:"begins",silent:!0,icon:null,iconStyle:"",onSearch:null,onRequest:null,onLoad:null,onError:null,onIconClick:null,renderDrop:null,compare:null,filter:!0,prefix:"",suffix:"",openOnFocus:!1,markSearch:!1},d.items=this.normMenu(d.items),"list"==this.type){if(b.openOnFocus=!0,b.suffix='<div class="arrow-down" style="margin-top: '+(parseInt(a(this.el).height())-6)/2+'px;"></div>',a(this.el).addClass("w2ui-select"),!a.isPlainObject(d.selected)&&d.items)for(var e=0;e<d.items.length;e++){var f=d.items[e];if(f&&f.id==d.selected){d.selected=a.extend(!0,{},f);break}}this.watchSize()}d=a.extend({},b,d,{align:"both",altRows:!0}),this.options=d,a.isPlainObject(d.selected)||(d.selected={}),a(this.el).data("selected",d.selected),d.url&&this.request(0),"list"==this.type&&this.addFocus(),this.addPrefix(),this.addSuffix(),setTimeout(function(){c.refresh()},10),a(this.el).attr("autocomplete","off"),null!=d.selected.text&&a(this.el).val(d.selected.text);break;case"enum":b={items:[],selected:[],max:0,url:null,interval:350,method:null,postData:{},minLength:1,cacheMax:250,maxWidth:250,maxHeight:350,maxDropHeight:350,maxDropWidth:null,match:"contains",silent:!0,openOnFocus:!1,markSearch:!0,renderDrop:null,renderItem:null,compare:null,filter:!0,style:"",onSearch:null,onRequest:null,onLoad:null,onError:null,onClick:null,onAdd:null,onNew:null,onRemove:null,onMouseOver:null,onMouseOut:null,onScroll:null},d=a.extend({},b,d,{align:"both",suffix:"",altRows:!0}),d.items=this.normMenu(d.items),d.selected=this.normMenu(d.selected),this.options=d,a.isArray(d.selected)||(d.selected=[]),a(this.el).data("selected",d.selected),d.url&&this.request(0),this.addSuffix(),this.addMulti(),this.watchSize();break;case"file":b={selected:[],max:0,maxSize:0,maxFileSize:0,maxWidth:250,maxHeight:350,maxDropHeight:350,maxDropWidth:null,silent:!0,renderItem:null,style:"",onClick:null,onAdd:null,onRemove:null,onMouseOver:null,onMouseOut:null},d=a.extend({},b,d,{align:"both",altRows:!0}),this.options=d,a.isArray(d.selected)||(d.selected=[]),a(this.el).data("selected",d.selected),null==a(this.el).attr("placeholder")&&a(this.el).attr("placeholder",w2utils.lang("Attach files by dragging and dropping or Click to Select")),this.addMulti(),this.watchSize()}this.tmp={onChange:function(a){c.change.call(c,a)},onClick:function(a){c.click.call(c,a)},onFocus:function(a){c.focus.call(c,a)},onBlur:function(a){c.blur.call(c,a)},onKeydown:function(a){c.keyDown.call(c,a)},onKeyup:function(a){c.keyUp.call(c,a)},onKeypress:function(a){c.keyPress.call(c,a)}},a(this.el).addClass("w2field").data("w2field",this).on("change",this.tmp.onChange).on("click",this.tmp.onClick).on("focus",this.tmp.onFocus).on("blur",this.tmp.onBlur).on("keydown",this.tmp.onKeydown).on("keyup",this.tmp.onKeyup).on("keypress",this.tmp.onKeypress).css(w2utils.cssPrefix("box-sizing","border-box")),this.change(a.Event("change"))},watchSize:function(){var b=this,c=a(b.el).data("tmp")||{};c.sizeTimer=setInterval(function(){a(b.el).parents("body").length>0?b.resize():clearInterval(c.sizeTimer)},200),a(b.el).data("tmp",c)},get:function(){var b;return b=-1!=["list","enum","file"].indexOf(this.type)?a(this.el).data("selected"):a(this.el).val()},set:function(b){-1!=["list","enum","file"].indexOf(this.type)?(a(this.el).data("selected",b).change(),this.refresh()):a(this.el).val(b)},setIndex:function(b){var c=this.options.items;return c&&c[b]?(a(this.el).data("selected",c[b]).change(),this.refresh(),!0):!1},clear:function(){var b=this.options;-1!=["money","currency"].indexOf(this.type)&&a(this.el).val(a(this.el).val().replace(b.moneyRE,"")),"percent"==this.type&&a(this.el).val(a(this.el).val().replace(/%/g,"")),"color"==this.type&&a(this.el).removeAttr("maxlength"),"list"==this.type&&a(this.el).removeClass("w2ui-select"),this.type="clear";var c=a(this.el).data("tmp");if(this.tmp){null!=c&&(a(this.el).height("auto"),c&&c["old-padding-left"]&&a(this.el).css("padding-left",c["old-padding-left"]),c&&c["old-padding-right"]&&a(this.el).css("padding-right",c["old-padding-right"]),c&&c["old-background-color"]&&a(this.el).css("background-color",c["old-background-color"]),c&&c["old-border-color"]&&a(this.el).css("border-color",c["old-border-color"]),clearInterval(c.sizeTimer)),a(this.el).val(this.clean(a(this.el).val())).removeClass("w2field").removeData().off("change",this.tmp.onChange).off("click",this.tmp.onClick).off("focus",this.tmp.onFocus).off("blur",this.tmp.onBlur).off("keydown",this.tmp.onKeydown).off("keyup",this.tmp.onKeyup).off("keypress",this.tmp.onKeypress);for(var d in this.helpers)a(this.helpers[d]).remove();this.helpers={}}},refresh:function(){var b=this,c=this.options,d=a(this.el).data("selected"),e=(new Date).getTime();if(-1!=["list"].indexOf(this.type)&&(a(b.el).parent().css("white-space","nowrap"),b.helpers.prefix&&b.helpers.prefix.hide(),setTimeout(function(){if(b.helpers.focus){!a.isEmptyObject(d)&&c.icon?(c.prefix='<span class="w2ui-icon '+c.icon+'"style="cursor: pointer; font-size: 14px; display: inline-block; margin-top: -1px; color: #7F98AD;'+c.iconStyle+'"></span>',b.addPrefix()):(c.prefix="",b.addPrefix());var e=b.helpers.focus.find("input");""==a(e).val()?(a(e).css("text-indent","-9999em").prev().css("opacity",0),a(b.el).val(d&&null!=d.text?d.text:"")):(a(e).css("text-indent",0).prev().css("opacity",1),a(b.el).val(""),setTimeout(function(){b.helpers.prefix&&b.helpers.prefix.hide();var d="position: absolute; opacity: 0; margin: 4px 0px 0px 2px; background-position: left !important;";c.icon?(a(e).css("margin-left","17px"),a(b.helpers.focus).find(".icon-search").attr("style",d+"width: 11px !important; opacity: 1")):(a(e).css("margin-left","0px"),a(b.helpers.focus).find(".icon-search").attr("style",d+"width: 0px !important; opacity: 0"))},1)),a(b.el).prop("readonly")||a(b.el).prop("disabled")?setTimeout(function(){a(b.helpers.prefix).css("opacity","0.6"),a(b.helpers.suffix).css("opacity","0.6")},1):setTimeout(function(){a(b.helpers.prefix).css("opacity","1"),a(b.helpers.suffix).css("opacity","1")},1)}},1)),-1!=["enum","file"].indexOf(this.type)){var f="";for(var g in d){var h=d[g],i="";i="function"==typeof c.renderItem?c.renderItem(h,g,'<div class="w2ui-list-remove" title="'+w2utils.lang("Remove")+'" index="'+g+'">  </div>'):'<div class="w2ui-list-remove" title="'+w2utils.lang("Remove")+'" index="'+g+'">  </div>'+("enum"==b.type?h.text:h.name+'<span class="file-size"> - '+w2utils.formatSize(h.size)+"</span>"),f+='<li index="'+g+'" style="max-width: '+parseInt(c.maxWidth)+"px; "+(h.style?h.style:"")+'">'+i+"</li>"}var j=b.helpers.multi,k=j.find("ul");if(j.attr("style",j.attr("style")+";"+c.style),a(b.el).css("z-index","-1"),a(b.el).prop("readonly")||a(b.el).prop("disabled")?setTimeout(function(){j[0].scrollTop=0,j.addClass("w2ui-readonly").find("li").css("opacity","0.9").parent().find("li.nomouse").hide().find("input").prop("readonly",!0).parents("ul").find(".w2ui-list-remove").hide()},1):setTimeout(function(){j.removeClass("w2ui-readonly").find("li").css("opacity","1").parent().find("li.nomouse").show().find("input").prop("readonly",!1).parents("ul").find(".w2ui-list-remove").show()},1),j.find(".w2ui-enum-placeholder").remove(),k.find("li").not("li.nomouse").remove(),""!=f)k.prepend(f);else if(null!=a(b.el).attr("placeholder")&&""==j.find("input").val()){var l="padding-top: "+a(this.el).css("padding-top")+";padding-left: "+a(this.el).css("padding-left")+"; box-sizing: "+a(this.el).css("box-sizing")+"; line-height: "+a(this.el).css("line-height")+"; font-size: "+a(this.el).css("font-size")+"; font-family: "+a(this.el).css("font-family")+"; ";j.prepend('<div class="w2ui-enum-placeholder" style="'+l+'">'+a(b.el).attr("placeholder")+"</div>")}j.off("scroll.w2field").on("scroll.w2field",function(c){var d=b.trigger({phase:"before",type:"scroll",target:b.el,originalEvent:c});d.isCancelled!==!0&&b.trigger(a.extend(d,{phase:"after"}))}).find("li").data("mouse","out").on("click",function(c){var e="LI"==c.target.tagName.toUpperCase()?c.target:a(c.target).parents("LI"),f=d[a(e).attr("index")];if(!a(e).hasClass("nomouse")){c.stopPropagation();var g=b.trigger({phase:"before",type:"click",target:b.el,originalEvent:c.originalEvent,item:f});if(g.isCancelled!==!0){if(a(c.target).hasClass("w2ui-list-remove")){if(a(b.el).attr("readonly")||a(b.el).attr("disabled"))return;var g=b.trigger({phase:"before",type:"remove",target:b.el,originalEvent:c.originalEvent,item:f});if(g.isCancelled===!0)return;a().w2overlay(),d.splice(a(c.target).attr("index"),1),a(b.el).trigger("change"),a(c.target).parent().fadeOut("fast"),setTimeout(function(){b.refresh(),b.trigger(a.extend(g,{phase:"after"}))},300)}if("file"==b.type&&!a(c.target).hasClass("w2ui-list-remove")){var h="";/image/i.test(f.type)&&(h='<div style="padding: 3px;"> <img src="'+(f.content?"data:"+f.type+";base64,"+f.content:"")+'" style="max-width: 300px;" onload="var w = $(this).width(); var h = $(this).height(); if (w < 300 & h < 300) return; if (w >= h && w > 300) $(this).width(300); if (w < h && h > 300) $(this).height(300);" onerror="this.style.display = \'none\'" ></div>');var i='style="padding: 3px; text-align: right; color: #777;"',j='style="padding: 3px"';h+='<div style="padding: 8px;"> <table cellpadding="2"><tbody> <tr><td '+i+">"+w2utils.lang("Name")+":</td><td "+j+">"+f.name+"</td></tr> <tr><td "+i+">"+w2utils.lang("Size")+":</td><td "+j+">"+w2utils.formatSize(f.size)+"</td></tr> <tr><td "+i+">"+w2utils.lang("Type")+":</td><td "+j+'> <span style="width: 200px; display: block-inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap="nowrap";">'+f.type+"</span> </td></tr> <tr><td "+i+">"+w2utils.lang("Modified")+":</td><td "+j+">"+w2utils.date(f.modified)+"</td></tr> </tbody></table></div>",a("#w2ui-overlay").remove(),a(e).w2overlay(h)}b.trigger(a.extend(g,{phase:"after"}))}}}).on("mouseover",function(c){var e="LI"==c.target.tagName.toUpperCase()?c.target:a(c.target).parents("LI");if(!a(e).hasClass("nomouse")){if("out"==a(e).data("mouse")){var f=d[a(c.target).attr("index")],g=b.trigger({phase:"before",type:"mouseOver",target:b.el,originalEvent:c.originalEvent,item:f});if(g.isCancelled===!0)return;b.trigger(a.extend(g,{phase:"after"}))}a(e).data("mouse","over")}}).on("mouseout",function(c){var e="LI"==c.target.tagName.toUpperCase()?c.target:a(c.target).parents("LI");a(e).hasClass("nomouse")||(a(e).data("mouse","leaving"),setTimeout(function(){if("leaving"==a(e).data("mouse")){a(e).data("mouse","out");var f=d[a(c.target).attr("index")],g=b.trigger({phase:"before",type:"mouseOut",target:b.el,originalEvent:c.originalEvent,item:f});if(g.isCancelled===!0)return;b.trigger(a.extend(g,{phase:"after"}))}},0))}),a(this.el).height("auto");var m=a(j).find("> div.w2ui-multi-items").height()+2*w2utils.getSize(j,"+height");26>m&&(m=26),m>c.maxHeight&&(m=c.maxHeight),j.length>0&&(j[0].scrollTop=1e3);var n=w2utils.getSize(a(this.el),"height")-2;if(n>m&&(m=n),a(j).css({height:m+"px",overflow:m==c.maxHeight?"auto":"hidden"}),m<c.maxHeight&&a(j).prop("scrollTop",0),a(this.el).css({height:m+2+"px"}),"enum"==b.type){var o=b.helpers.multi.find("input");o.width(8*(o.val().length+2)+"px")}}return(new Date).getTime()-e},reset:function(){var a=this.type;this.clear(),this.type=a,this.init()},resize:function(){var b=this,c=a(b.el).width(),d=a(b.el).height();if(!(b.tmp.current_width==c&&d>0)){var e=this.helpers.focus,f=this.helpers.multi,g=this.helpers.suffix,h=this.helpers.prefix;if(e&&e.width(a(b.el).width()),f){var i=w2utils.getSize(b.el,"width")-parseInt(a(b.el).css("margin-left"),10)-parseInt(a(b.el).css("margin-right"),10);a(f).width(i)}g&&(b.options.suffix='<div class="arrow-down" style="margin-top: '+(parseInt(a(b.el).height())-6)/2+'px;"></div>',b.addSuffix()),h&&b.addPrefix(),b.tmp.current_width=c}},clean:function(b){if("number"==typeof b)return b;var c=this.options;return b=String(b).trim(),-1!=["int","float","money","currency","percent"].indexOf(this.type)&&("string"==typeof b&&(c.autoFormat&&-1!=["money","currency"].indexOf(this.type)&&(b=String(b).replace(c.moneyRE,"")),c.autoFormat&&"percent"==this.type&&(b=String(b).replace(c.percentRE,"")),c.autoFormat&&-1!=["int","float"].indexOf(this.type)&&(b=String(b).replace(c.numberRE,"")),b=b.replace(/\s+/g,"").replace(w2utils.settings.groupSymbol,"").replace(w2utils.settings.decimalSymbol,".")),parseFloat(b)==b&&(null!=c.min&&b<c.min&&(b=c.min,a(this.el).val(c.min)),null!=c.max&&b>c.max&&(b=c.max,a(this.el).val(c.max))),b=""!==b&&w2utils.isFloat(b)?Number(b):""),b},format:function(a){var b=this.options;if(b.autoFormat&&""!=a)switch(this.type){case"money":case"currency":a=w2utils.formatNumber(a,b.currencyPrecision,b.groupSymbol),""!=a&&(a=b.currencyPrefix+a+b.currencySuffix);break;case"percent":a=w2utils.formatNumber(a,b.precision,b.groupSymbol),""!=a&&(a+="%");break;case"float":a=w2utils.formatNumber(a,b.precision,b.groupSymbol);break;case"int":a=w2utils.formatNumber(a,0,b.groupSymbol)}return a},change:function(b){var c=this,d=c.options;if(-1!=["int","float","money","currency","percent"].indexOf(this.type)){var e=a(this.el).val(),f=this.format(this.clean(a(this.el).val()));if(""!=e&&e!=f)return a(this.el).val(f).change(),b.stopPropagation(),b.preventDefault(),!1}if("color"==this.type){var g="#"+a(this.el).val();6!=a(this.el).val().length&&3!=a(this.el).val().length&&(g=""),a(this.el).next().find("div").css("background-color",g),a(c.el).is(":focus")&&this.updateOverlay()}if(-1!=["list","enum","file"].indexOf(this.type)&&(c.refresh(),setTimeout(function(){c.refresh()},5)),-1!=["date","time","datetime"].indexOf(this.type)){var h=parseInt(c.el.value);w2utils.isInt(c.el.value)&&h>3e3&&("time"==this.type&&a(c.el).val(w2utils.formatTime(new Date(h),d.format)).change(),"date"==this.type&&a(c.el).val(w2utils.formatDate(new Date(h),d.format)).change(),"datetime"==this.type&&a(c.el).val(w2utils.formatDateTime(new Date(h),d.format)).change())}},click:function(b){b.stopPropagation(),-1!=["list","combo","enum"].indexOf(this.type)&&(a(this.el).is(":focus")||this.focus(b)),-1!=["date","time","color","datetime"].indexOf(this.type)&&this.updateOverlay()},focus:function(){{var b=this;this.options}if(-1!==["color","date","time","datetime"].indexOf(b.type)){if(a(b.el).attr("readonly")||a(b.el).attr("disabled"))return;a("#w2ui-overlay").length>0&&a("#w2ui-overlay")[0].hide(),setTimeout(function(){b.updateOverlay()},150)}if(-1!=["list","combo","enum"].indexOf(b.type)){if(a(b.el).attr("readonly")||a(b.el).attr("disabled"))return;a("#w2ui-overlay").length>0&&a("#w2ui-overlay")[0].hide(),b.resize(),setTimeout(function(){return"list"==b.type&&a(b.el).is(":focus")?void a(b.helpers.focus).find("input").focus():(b.search(),void setTimeout(function(){b.updateOverlay()},1))},1)}"file"==b.type&&a(b.helpers.multi).css({outline:"auto 5px #7DB4F3","outline-offset":"-2px"})},blur:function(){var b=this,c=b.options,d=a(b.el).val().trim();-1!=["color","date","time","list","combo","enum","datetime"].indexOf(b.type)&&a("#w2ui-overlay").length>0&&a("#w2ui-overlay")[0].hide(),-1!=["int","float","money","currency","percent"].indexOf(b.type)&&(""===d||b.checkType(d)||(a(b.el).val("").change(),c.silent===!1&&(a(b.el).w2tag("Not a valid number"),setTimeout(function(){a(b.el).w2tag("")},3e3)))),-1!=["date","time","datetime"].indexOf(b.type)&&(""===d||b.inRange(b.el.value)?"date"!=b.type||""===d||w2utils.isDate(b.el.value,c.format)?"time"!=b.type||""===d||w2utils.isTime(b.el.value)?"datetime"!=b.type||""===d||(c.use_moment_js?w2utils.isDateTime(b.el.value,c.format_mjs):w2utils.isDateTime(b.el.value,c.format))||(a(b.el).val("").removeData("selected").change(),c.silent===!1&&(a(b.el).w2tag("Not a valid date"),setTimeout(function(){a(b.el).w2tag("")},3e3))):(a(b.el).val("").removeData("selected").change(),c.silent===!1&&(a(b.el).w2tag("Not a valid time"),setTimeout(function(){a(b.el).w2tag("")},3e3))):(a(b.el).val("").removeData("selected").change(),c.silent===!1&&(a(b.el).w2tag("Not a valid date"),setTimeout(function(){a(b.el).w2tag("")},3e3))):(a(b.el).val("").removeData("selected").change(),c.silent===!1&&(a(b.el).w2tag("Not in range"),setTimeout(function(){a(b.el).w2tag("")},3e3)))),"enum"==b.type&&a(b.helpers.multi).find("input").val("").width(20),"file"==b.type&&a(b.helpers.multi).css({outline:"none"})},keyPress:function(a){{var b=this;b.options}if(-1!=["int","float","money","currency","percent","hex","bin","color","alphanumeric"].indexOf(b.type)){if(a.metaKey||a.ctrlKey||a.altKey||a.charCode!=a.keyCode&&a.keyCode>0)return;var c=String.fromCharCode(a.charCode);if(!b.checkType(c,!0)&&13!=a.keyCode)return a.preventDefault(),a.stopPropagation?a.stopPropagation():a.cancelBubble=!0,!1}-1!=["date","time","datetime"].indexOf(b.type)&&setTimeout(function(){b.updateOverlay()},1)},keyDown:function(b,c){var d=this,e=d.options,f=b.keyCode||c&&c.keyCode;if(-1!=["int","float","money","currency","percent"].indexOf(d.type)){if(!e.keyboard||a(d.el).attr("readonly"))return;var g=!1,h=parseFloat(a(d.el).val().replace(e.moneyRE,""))||0,i=e.step;switch((b.ctrlKey||b.metaKey)&&(i=10),f){case 38:if(b.shiftKey)break;a(d.el).val(h+i<=e.max||null==e.max?Number((h+i).toFixed(12)):e.max).change(),g=!0;break;case 40:if(b.shiftKey)break;a(d.el).val(h-i>=e.min||null==e.min?Number((h-i).toFixed(12)):e.min).change(),g=!0}g&&(b.preventDefault(),setTimeout(function(){d.el.setSelectionRange(d.el.value.length,d.el.value.length)},0))}if("date"==d.type){if(!e.keyboard||a(d.el).attr("readonly"))return;var g=!1,j=864e5,i=1;(b.ctrlKey||b.metaKey)&&(i=10);var k=w2utils.isDate(a(d.el).val(),e.format,!0);
switch(k||(k=new Date,j=0),f){case 38:if(b.shiftKey)break;var l=w2utils.formatDate(k.getTime()+j,e.format);10==i&&(l=w2utils.formatDate(new Date(k.getFullYear(),k.getMonth()+1,k.getDate()),e.format)),a(d.el).val(l).change(),g=!0;break;case 40:if(b.shiftKey)break;var l=w2utils.formatDate(k.getTime()-j,e.format);10==i&&(l=w2utils.formatDate(new Date(k.getFullYear(),k.getMonth()-1,k.getDate()),e.format)),a(d.el).val(l).change(),g=!0}g&&(b.preventDefault(),setTimeout(function(){d.el.setSelectionRange(d.el.value.length,d.el.value.length),d.updateOverlay()},0))}if("time"==d.type){if(!e.keyboard||a(d.el).attr("readonly"))return;var g=!1,i=b.ctrlKey||b.metaKey?60:1,h=a(d.el).val(),m=d.toMin(h)||d.toMin((new Date).getHours()+":"+((new Date).getMinutes()-1));switch(f){case 38:if(b.shiftKey)break;m+=i,g=!0;break;case 40:if(b.shiftKey)break;m-=i,g=!0}g&&(a(d.el).val(d.fromMin(m)).change(),b.preventDefault(),setTimeout(function(){d.el.setSelectionRange(d.el.value.length,d.el.value.length)},0))}if("datetime"==d.type){if(!e.keyboard||a(d.el).attr("readonly"))return;var g=!1,j=864e5,i=1;(b.ctrlKey||b.metaKey)&&(i=10);var n=a(d.el).val(),k=w2utils.use_momentjs?w2utils.isDateTime(n,this.options.format_mjs,!0):w2utils.isDateTime(n,this.options.format,!0);switch(k||(k=new Date,j=0),f){case 38:if(b.shiftKey)break;var l=w2utils.formatDateTime(k.getTime()+j,e.format);10==i&&(l=w2utils.formatDateTime(new Date(k.getFullYear(),k.getMonth()+1,k.getDate()),e.format)),a(d.el).val(l).change(),g=!0;break;case 40:if(b.shiftKey)break;var l=w2utils.formatDateTime(k.getTime()-j,e.format);10==i&&(l=w2utils.formatDateTime(new Date(k.getFullYear(),k.getMonth()-1,k.getDate()),e.format)),a(d.el).val(l).change(),g=!0}g&&(b.preventDefault(),setTimeout(function(){d.el.setSelectionRange(d.el.value.length,d.el.value.length),d.updateOverlay()},0))}if("color"==d.type){if(a(d.el).attr("readonly"))return;if(86==b.keyCode&&(b.ctrlKey||b.metaKey)&&(a(d.el).prop("maxlength",7),setTimeout(function(){var b=a(d).val();"#"==b.substr(0,1)&&(b=b.substr(1)),w2utils.isHex(b)||(b=""),a(d).val(b).prop("maxlength",6).change()},20)),(b.ctrlKey||b.metaKey)&&!b.shiftKey){var o=null,p=null;switch(f){case 38:o="up";break;case 40:o="down";break;case 39:o="right";break;case 37:o="left"}d.el.nav&&null!=o&&(p=d.el.nav(o),a(d.el).val(p).change(),b.preventDefault())}}if(-1!=["list","combo","enum"].indexOf(d.type)){if(a(d.el).attr("readonly"))return;var q=a(d.el).data("selected"),r=a(d.el),s=!1;switch(-1!=["list","enum"].indexOf(d.type)&&("list"==d.type&&(r=a(d.helpers.focus).find("input")),"enum"==d.type&&(r=a(d.helpers.multi).find("input")),-1==[37,38,39,40].indexOf(f)&&setTimeout(function(){d.refresh()},1),86==b.keyCode&&(b.ctrlKey||b.metaKey)&&setTimeout(function(){d.refresh(),d.search(),d.request()},50)),f){case 27:"list"==d.type&&(""!=r.val()&&r.val(""),b.stopPropagation());break;case 37:case 39:break;case 13:if(0==a("#w2ui-overlay").length)break;var t=e.items[e.index];if("enum"==d.type)if(null!=t){var u=d.trigger({phase:"before",type:"add",target:d.el,originalEvent:b.originalEvent,item:t});if(u.isCancelled===!0)return;t=u.item,q.length>=e.max&&e.max>0&&q.pop(),delete t.hidden,delete d.tmp.force_open,q.push(t),a(d.el).change(),r.val("").width(20),d.refresh(),d.trigger(a.extend(u,{phase:"after"}))}else{t={id:r.val(),text:r.val()};var u=d.trigger({phase:"before",type:"new",target:d.el,originalEvent:b.originalEvent,item:t});if(u.isCancelled===!0)return;t=u.item,"function"==typeof d.onNew&&(q.length>=e.max&&e.max>0&&q.pop(),delete d.tmp.force_open,q.push(t),a(d.el).change(),r.val("").width(20),d.refresh()),d.trigger(a.extend(u,{phase:"after"}))}else t&&a(d.el).data("selected",t).val(t.text).change(),""==a(d.el).val()&&a(d.el).data("selected")&&a(d.el).removeData("selected").val("").change(),"list"==d.type&&(r.val(""),d.refresh()),d.tmp.force_hide=!0;break;case 8:case 46:if("enum"==d.type&&8==f&&""==r.val()&&q.length>0){var t=q[q.length-1],u=d.trigger({phase:"before",type:"remove",target:d.el,originalEvent:b.originalEvent,item:t});if(u.isCancelled===!0)return;q.pop(),a(d.el).trigger("change"),d.refresh(),d.trigger(a.extend(u,{phase:"after"}))}"list"==d.type&&""==r.val()&&(a(d.el).data("selected",{}).change(),d.refresh());break;case 38:for(e.index=w2utils.isInt(e.index)?parseInt(e.index):0,e.index--;e.index>0&&e.items[e.index].hidden;)e.index--;if(0==e.index&&e.items[e.index].hidden)for(;e.items[e.index]&&e.items[e.index].hidden;)e.index++;s=!0;break;case 40:for(e.index=w2utils.isInt(e.index)?parseInt(e.index):-1,e.index++;e.index<e.items.length-1&&e.items[e.index].hidden;)e.index++;if(e.index==e.items.length-1&&e.items[e.index].hidden)for(;e.items[e.index]&&e.items[e.index].hidden;)e.index--;""==r.val()&&0==a("#w2ui-overlay").length?d.tmp.force_open=!0:s=!0}if(s)return e.index<0&&(e.index=0),e.index>=e.items.length&&(e.index=e.items.length-1),d.updateOverlay(s),b.preventDefault(),void setTimeout(function(){if("enum"==d.type){var a=r.get(0);a.setSelectionRange(a.value.length,a.value.length)}else if("list"==d.type){var a=r.get(0);a.setSelectionRange(a.value.length,a.value.length)}else d.el.setSelectionRange(d.el.value.length,d.el.value.length)},0);"enum"==d.type&&r.width(8*(r.val().length+2)+"px"),-1==[16,17,18,20,37,39,91].indexOf(f)&&setTimeout(function(){var c=d.trigger({phase:"before",type:"search",originalEvent:b,target:r,search:r.val()});c.isCancelled!==!0&&(d.tmp.force_hide||d.request(),d.search(),d.trigger(a.extend(c,{phase:"after"})))},1)}},keyUp:function(b){"color"==this.type&&86==b.keyCode&&(b.ctrlKey||b.metaKey)&&a(this).prop("maxlength",6)},clearCache:function(){var a=this.options;a.items=[],this.tmp.xhr_loading=!1,this.tmp.xhr_search="",this.tmp.xhr_total=-1},request:function(b){var c=this,d=this.options,e=a(c.el).val()||"";if(d.url){if("enum"==c.type){var f=a(c.helpers.multi).find("input");e=0==f.length?"":f.val()}if("list"==c.type){var f=a(c.helpers.focus).find("input");e=0==f.length?"":f.val()}if(0!=d.minLength&&e.length<d.minLength)return d.items=[],void this.updateOverlay();null==b&&(b=d.interval),null==c.tmp.xhr_search&&(c.tmp.xhr_search=""),null==c.tmp.xhr_total&&(c.tmp.xhr_total=-1),d.url&&1!=a(c.el).prop("readonly")&&(0===d.items.length&&0!==c.tmp.xhr_total||c.tmp.xhr_total==d.cacheMax&&e.length>c.tmp.xhr_search.length||e.length>=c.tmp.xhr_search.length&&e.substr(0,c.tmp.xhr_search.length)!=c.tmp.xhr_search||e.length<c.tmp.xhr_search.length)&&(c.tmp.xhr&&c.tmp.xhr.abort(),c.tmp.xhr_loading=!0,c.search(),clearTimeout(c.tmp.timeout),c.tmp.timeout=setTimeout(function(){var b=d.url,f={search:e,max:d.cacheMax};a.extend(f,d.postData);var g=c.trigger({phase:"before",type:"request",target:c.el,url:b,postData:f});if(g.isCancelled!==!0){b=g.url,f=g.postData;var h={type:"GET",url:b,data:f,dataType:"JSON"};d.method&&(h.type=d.method),"JSON"==w2utils.settings.dataType&&(h.type="POST",h.data=JSON.stringify(h.data),h.contentType="application/json"),null!=d.method&&(h.type=d.method),c.tmp.xhr=a.ajax(h).done(function(b,g,h){var i=c.trigger({phase:"before",type:"load",target:c.el,search:f.search,data:b,xhr:h});if(i.isCancelled!==!0){if(b=i.data,"string"==typeof b&&(b=JSON.parse(b)),"success"!=b.status)return void console.log("ERROR: server did not return proper structure. It should return",{status:"success",items:[{id:1,text:"item"}]});b.items.length>d.cacheMax&&b.items.splice(d.cacheMax,1e5),c.tmp.xhr_loading=!1,c.tmp.xhr_search=e,c.tmp.xhr_total=b.items.length,d.items=c.normMenu(b.items),c.tmp.emptySet=""==e&&0==b.items.length?!0:!1,c.search(),c.trigger(a.extend(i,{phase:"after"}))}}).fail(function(b,d,f){var g={status:d,error:f,rawResponseText:b.responseText},h=c.trigger({phase:"before",type:"error",target:c.el,search:e,error:g,xhr:b});if(h.isCancelled!==!0){if("abort"!=d){var i;try{i=a.parseJSON(b.responseText)}catch(j){}console.log("ERROR: Server communication failed.","\n EXPECTED:",{status:"success",items:[{id:1,text:"item"}]},"\n OR:",{status:"error",message:"error message"},"\n RECEIVED:","object"==typeof i?i:b.responseText)}c.clearCache(),c.search(),c.trigger(a.extend(h,{phase:"after"}))}}),c.trigger(a.extend(g,{phase:"after"}))}},b))}},search:function(){var b=this,c=this.options,d=a(b.el).val(),e=b.el,f=[],g=a(b.el).data("selected");if("enum"==b.type){e=a(b.helpers.multi).find("input"),d=e.val();for(var h in g)g[h]&&f.push(g[h].id)}if("list"==b.type){e=a(b.helpers.focus).find("input"),d=e.val();for(var h in g)g[h]&&f.push(g[h].id)}if(b.tmp.xhr_loading!==!0){for(var i=0,j=0;j<c.items.length;j++){var k=c.items[j];if(null!=c.compare)"function"==typeof c.compare&&(k.hidden=c.compare.call(this,k,d)===!1?!0:!1);else{var l="",m="";-1!=["is","begins"].indexOf(c.match)&&(l="^"),-1!=["is","ends"].indexOf(c.match)&&(m="$");try{var n=new RegExp(l+d+m,"i");k.hidden=n.test(k.text)||"..."==k.text?!1:!0}catch(o){}}c.filter===!1&&(k.hidden=!1),"enum"==b.type&&-1!=a.inArray(k.id,f)&&(k.hidden=!0),k.hidden!==!0&&(i++,delete k.hidden)}for(c.index=0;c.items[c.index]&&c.items[c.index].hidden;)c.index++;0>=i&&(c.index=-1),c.spinner=!1,b.updateOverlay(),setTimeout(function(){var b=a("#w2ui-overlay").html()||"";c.markSearch&&-1!=b.indexOf("$.fn.w2menuHandler")&&a("#w2ui-overlay").w2marker(d)},1)}else c.items.splice(0,c.cacheMax),c.spinner=!0,b.updateOverlay()},updateOverlay:function(b){var c=this,d=this.options;if("color"==this.type){if(a(c.el).attr("readonly"))return;a(this.el).w2color(a(this.el).val(),function(b){null!=b&&a(c.el).val(b).change()})}if("date"==this.type){if(a(c.el).attr("readonly"))return;0==a("#w2ui-overlay").length&&a(c.el).w2overlay('<div class="w2ui-reset w2ui-calendar" onclick="event.stopPropagation();"></div>',{css:{"background-color":"#f5f5f5"}});var e,f,g=w2utils.isDate(a(c.el).val(),c.options.format,!0);g&&(e=g.getMonth()+1,f=g.getFullYear()),function m(b,d){a("#w2ui-overlay > div > div").html(c.getMonthHTML(b,d,a(c.el).val())),a("#w2ui-overlay .w2ui-calendar-title").on("mousedown",function(){if(a(this).next().hasClass("w2ui-calendar-jump"))a(this).next().remove();else{var b,d;a(this).after('<div class="w2ui-calendar-jump" style=""></div>'),a(this).next().hide().html(c.getYearHTML()).fadeIn(200),setTimeout(function(){a("#w2ui-overlay .w2ui-calendar-jump").find(".w2ui-jump-month, .w2ui-jump-year").on("click",function(){a(this).hasClass("w2ui-jump-month")&&(a(this).parent().find(".w2ui-jump-month").removeClass("selected"),a(this).addClass("selected"),d=a(this).attr("name")),a(this).hasClass("w2ui-jump-year")&&(a(this).parent().find(".w2ui-jump-year").removeClass("selected"),a(this).addClass("selected"),b=a(this).attr("name")),null!=b&&null!=d&&(a("#w2ui-overlay .w2ui-calendar-jump").fadeOut(100),setTimeout(function(){m(parseInt(d)+1,b)},100))}),a("#w2ui-overlay .w2ui-calendar-jump >:last-child").prop("scrollTop",2e3)},1)}}),a("#w2ui-overlay .w2ui-date").on("mousedown",function(){var b=a(this).attr("date");a(c.el).val(b).change(),a(this).css({"background-color":"#B6D5FB","border-color":"#aaa"})}).on("mouseup",function(){setTimeout(function(){a("#w2ui-overlay").length>0&&a("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)}),a("#w2ui-overlay .previous").on("mousedown",function(){var a=c.options.current.split("/");a[0]=parseInt(a[0])-1,m(a[0],a[1])}),a("#w2ui-overlay .next").on("mousedown",function(){var a=c.options.current.split("/");a[0]=parseInt(a[0])+1,m(a[0],a[1])})}(e,f)}if("time"==this.type){if(a(c.el).attr("readonly"))return;0==a("#w2ui-overlay").length&&a(c.el).w2overlay('<div class="w2ui-reset w2ui-calendar-time" onclick="event.stopPropagation();"></div>',{css:{"background-color":"#fff"}});var h="h24"==this.options.format;a("#w2ui-overlay > div").html(c.getHourHTML()),a("#w2ui-overlay .w2ui-time").on("mousedown",function(){a(this).css({"background-color":"#B6D5FB","border-color":"#aaa"});var b=a(this).attr("hour");a(c.el).val((b>12&&!h?b-12:b)+":00"+(h?"":12>b?" am":" pm")).change()}).on("mouseup",function(){var b=a(this).attr("hour");a("#w2ui-overlay").length>0&&a("#w2ui-overlay")[0].hide(),a(c.el).w2overlay('<div class="w2ui-reset w2ui-calendar-time"></div>',{css:{"background-color":"#fff"}}),a("#w2ui-overlay > div").html(c.getMinHTML(b)),a("#w2ui-overlay .w2ui-time").on("mousedown",function(){a(this).css({"background-color":"#B6D5FB","border-color":"#aaa"});var d=a(this).attr("min");a(c.el).val((b>12&&!h?b-12:b)+":"+(10>d?0:"")+d+(h?"":12>b?" am":" pm")).change()}).on("mouseup",function(){setTimeout(function(){a("#w2ui-overlay").length>0&&a("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)})})}if("datetime"==this.type){if(a(c.el).attr("readonly"))return;a("#w2ui-overlay .w2ui-time").length>0&&a("#w2ui-overlay")[0].hide(),0==a("#w2ui-overlay").length&&a(c.el).w2overlay('<div class="w2ui-reset w2ui-calendar" onclick="event.stopPropagation();"></div>',{css:{"background-color":"#f5f5f5"}});var e,f,g=w2utils.isDate(a(c.el).val(),c.options.format,!0);g&&(e=g.getMonth()+1,f=g.getFullYear());var i=null;!function n(b,d){if(a("#w2ui-overlay > div > div").html(c.getMonthHTML(b,d,a(c.el).val())),c.options.btn_now){a("#w2ui-overlay > div > div .w2ui-calendar-previous.previous").after('<div class="w2ui-calendar-previous now"></div>');var e="url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAJiS0dEAP+Hj8y/AAAACXBIWXMAAAsTAAALEwEAmpwYAAABDUlEQVQoz23QzyuDARgH8E+0hsSi6aWGklrz42CUiJVcFuXCmDZZKYZyQEocnDnt6B9xWXJ4/4CVUsp/4uLwbkX2fG/P93N4emg3I6aN62zbGXTkxqq8U5P/627nAs+G0ONYKlrHxZtgVc6AvCpIKkXrgt0mKCmriHkVA2c8CtXUhEKhL8+ehL692IzAu4Q9RYlmtlQkvEnJCRRooEuvwKCkMb1G9asL9KkajgBJd0rKHky7llNXUTVOC8QtSEvLGjAjUJfVEd3dsObWonv7DtyY8mBTXdB6TUPGnkkFK5ZtSNkx9xdkFWWUbMk7M6Fs6S+Yd2LWhV3bLqWdWP8NPl21yYe+Fsg6bJOlVv0DQzw+zwokgrkAAAAASUVORK5CYII=)";a("#w2ui-overlay div div.w2ui-calendar-previous.now").css({width:"20px","text-align":"center","vertical-align":"middle","background-repeat":"no-repeat","background-position":"center","background-image":e})}a("#w2ui-overlay .w2ui-calendar-title").on("mousedown",function(){if(a(this).next().hasClass("w2ui-calendar-jump"))a(this).next().remove();else{var b,d;a(this).after('<div class="w2ui-calendar-jump" style=""></div>'),a(this).next().hide().html(c.getYearHTML()).fadeIn(200),setTimeout(function(){a("#w2ui-overlay .w2ui-calendar-jump").find(".w2ui-jump-month, .w2ui-jump-year").on("click",function(){a(this).hasClass("w2ui-jump-month")&&(a(this).parent().find(".w2ui-jump-month").removeClass("selected"),a(this).addClass("selected"),d=a(this).attr("name")),a(this).hasClass("w2ui-jump-year")&&(a(this).parent().find(".w2ui-jump-year").removeClass("selected"),a(this).addClass("selected"),b=a(this).attr("name")),null!=b&&null!=d&&(a("#w2ui-overlay .w2ui-calendar-jump").fadeOut(100),setTimeout(function(){n(parseInt(d)+1,b)},100))}),a("#w2ui-overlay .w2ui-calendar-jump >:last-child").prop("scrollTop",2e3)},1)}}),a("#w2ui-overlay .w2ui-date").on("mousedown",function(){var b=a(this).attr("date");a(c.el).val(b).change(),a(this).css({"background-color":"#B6D5FB","border-color":"#aaa"}),i=new Date(a(this).attr("data-date"))}).on("mouseup",function(){var b,d;a("#w2ui-overlay").length>0&&a("#w2ui-overlay")[0].hide(),a(c.el).w2overlay('<div class="w2ui-reset w2ui-calendar-time"></div>',{css:{"background-color":"#fff"}});"h24"==c.options.format;a("#w2ui-overlay > div").html(c.getHourHTML()),a("#w2ui-overlay .w2ui-time").on("mousedown",function(){a(this).css({"background-color":"#B6D5FB","border-color":"#aaa"}),b=a(this).attr("hour"),i.setHours(b);var d=w2utils.formatDateTime(i,c.options.format);a(c.el).val(d).change()}).on("mouseup",function(){var e=a(this).attr("hour");a("#w2ui-overlay").length>0&&a("#w2ui-overlay")[0].hide(),a(c.el).w2overlay('<div class="w2ui-reset w2ui-calendar-time"></div>',{css:{"background-color":"#fff"}}),a("#w2ui-overlay > div").html(c.getMinHTML(e)),a("#w2ui-overlay .w2ui-time").on("mousedown",function(){a(this).css({"background-color":"#B6D5FB","border-color":"#aaa"}),d=a(this).attr("min"),i.setHours(b,d);var e=w2utils.formatDateTime(i,c.options.format);a(c.el).val(e).change()}).on("mouseup",function(){setTimeout(function(){a("#w2ui-overlay").length>0&&a("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)})})}),a("#w2ui-overlay .previous").on("mousedown",function(){var a=c.options.current.split("/");a[0]=parseInt(a[0])-1,n(a[0],a[1])}),a("#w2ui-overlay .next").on("mousedown",function(){var a=c.options.current.split("/");a[0]=parseInt(a[0])+1,n(a[0],a[1])}),a("#w2ui-overlay .now").on("mousedown",function(){var b=w2utils.formatDateTime(new Date,c.options.format);return a(c.el).val(b).change(),!1}).on("mouseup",function(){setTimeout(function(){a("#w2ui-overlay").length>0&&a("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)})}(e,f)}if(-1!=["list","combo","enum"].indexOf(this.type)){var j=this.el,k=this.el;if("enum"==this.type&&(j=a(this.helpers.multi),k=a(j).find("input")),"list"==this.type&&(k=a(this.helpers.focus).find("input")),a(k).is(":focus")){if(d.openOnFocus===!1&&""==a(k).val()&&c.tmp.force_open!==!0)return void a().w2overlay();if(c.tmp.force_hide)return a().w2overlay(),void setTimeout(function(){delete c.tmp.force_hide},1);""!=a(k).val()&&delete c.tmp.force_open;var l=w2utils.lang("No matches");null!=d.url&&a(k).val().length<d.minLength&&c.tmp.emptySet!==!0&&(l=d.minLength+" "+w2utils.lang("letters or more...")),null!=d.url&&""==a(k).val()&&c.tmp.emptySet!==!0&&(l=w2utils.lang("Type to search...")),a(j).w2menu(b?"refresh-index":"refresh",a.extend(!0,{},d,{search:!1,render:d.renderDrop,maxHeight:d.maxDropHeight,maxWidth:d.maxDropWidth,msgNoItems:l,onSelect:function(b){if("enum"==c.type){var e=a(c.el).data("selected");if(b.item){var f=c.trigger({phase:"before",type:"add",target:c.el,originalEvent:b.originalEvent,item:b.item});if(f.isCancelled===!0)return;e.length>=d.max&&d.max>0&&e.pop(),delete b.item.hidden,e.push(b.item),a(c.el).data("selected",e).change(),a(c.helpers.multi).find("input").val("").width(20),c.refresh(),a("#w2ui-overlay").length>0&&a("#w2ui-overlay")[0].hide(),c.trigger(a.extend(f,{phase:"after"}))}}else a(c.el).data("selected",b.item).val(b.item.text).change(),c.helpers.focus&&c.helpers.focus.find("input").val("")}}))}}},inRange:function(b){var c=!1;if("date"==this.type){var d=w2utils.isDate(b,this.options.format,!0);if(d){if(this.options.start||this.options.end){var e="string"==typeof this.options.start?this.options.start:a(this.options.start).val(),f="string"==typeof this.options.end?this.options.end:a(this.options.end).val(),g=w2utils.isDate(e,this.options.format,!0),h=w2utils.isDate(f,this.options.format,!0),i=new Date(d);g||(g=i),h||(h=i),i>=g&&h>=i&&(c=!0)}else c=!0;this.options.blocked&&-1!=a.inArray(b,this.options.blocked)&&(c=!1)}}else if("time"==this.type)if(this.options.start||this.options.end){var j=this.toMin(b),k=this.toMin(this.options.start),l=this.toMin(this.options.end);k||(k=j),l||(l=j),j>=k&&l>=j&&(c=!0)}else c=!0;else if("datetime"==this.type){var d=w2utils.use_momentjs?w2utils.isDateTime(b,this.options.format_mjs,!0):w2utils.isDateTime(b,this.options.format,!0);if(d){if(this.options.start||this.options.end){var g,h;if("object"==typeof this.options.start&&this.options.start instanceof Date)g=this.options.start;else{var e="string"==typeof this.options.start?this.options.start:a(this.options.start).val();g=w2utils.use_momentjs?w2utils.isDateTime(e,this.options.format_mjs,!0):w2utils.isDateTime(e,this.options.format,!0)}if("object"==typeof this.options.end&&this.options.end instanceof Date)h=this.options.end;else{var f="string"==typeof this.options.end?this.options.end:a(this.options.end).val();h=w2utils.use_momentjs?w2utils.isDateTime(f,this.options.format_mjs,!0):w2utils.isDateTime(f,this.options.format,!0)}var i=d;g||(g=i),h||(h=i),i>=g&&h>=i&&(c=!0)}else c=!0;if(c&&this.options.blocked)for(var m=0;m<this.options.blocked.length;m++){var n=this.options.blocked[m];if("string"==typeof n&&(n=w2utils.use_momentjs?w2utils.isDateTime(n,this.options.format_mjs,!0):w2utils.isDateTime(n,this.options.format,!0)),"object"==typeof n&&n instanceof Date&&n.getFullYear()==d.getFullYear()&&n.getMonth()==d.getMonth()&&n.getDate()==d.getDate()){c=!1;break}}}}return c},checkType:function(a,b){var c=this;switch(c.type){case"int":return b&&-1!=["-",c.options.groupSymbol].indexOf(a)?!0:w2utils.isInt(a.replace(c.options.numberRE,""));case"percent":a=a.replace(/%/g,"");case"float":return b&&-1!=["-",w2utils.settings.decimalSymbol,c.options.groupSymbol].indexOf(a)?!0:w2utils.isFloat(a.replace(c.options.numberRE,""));case"money":case"currency":return b&&-1!=["-",c.options.decimalSymbol,c.options.groupSymbol,c.options.currencyPrefix,c.options.currencySuffix].indexOf(a)?!0:w2utils.isFloat(a.replace(c.options.moneyRE,""));case"bin":return w2utils.isBin(a);case"hex":case"color":return w2utils.isHex(a);case"alphanumeric":return w2utils.isAlphaNumeric(a)}return!0},addPrefix:function(){var b=this;setTimeout(function(){if("clear"!==b.type){var c,d=a(b.el).data("tmp")||{};d["old-padding-left"]&&a(b.el).css("padding-left",d["old-padding-left"]),d["old-padding-left"]=a(b.el).css("padding-left"),a(b.el).data("tmp",d),b.helpers.prefix&&a(b.helpers.prefix).remove(),""!==b.options.prefix&&(a(b.el).before('<div class="w2ui-field-helper">'+b.options.prefix+"</div>"),c=a(b.el).prev(),c.css({color:a(b.el).css("color"),"font-family":a(b.el).css("font-family"),"font-size":a(b.el).css("font-size"),"padding-top":a(b.el).css("padding-top"),"padding-bottom":a(b.el).css("padding-bottom"),"padding-left":a(b.el).css("padding-left"),"padding-right":0,"margin-top":parseInt(a(b.el).css("margin-top"),10)+2+"px","margin-bottom":parseInt(a(b.el).css("margin-bottom"),10)+1+"px","margin-left":a(b.el).css("margin-left"),"margin-right":0}).on("click",function(){if(b.options.icon&&"function"==typeof b.onIconClick){var c=b.trigger({phase:"before",type:"iconClick",target:b.el,el:a(this).find("span.w2ui-icon")[0]});if(c.isCancelled===!0)return;b.trigger(a.extend(c,{phase:"after"}))}else"list"==b.type?a(b.helpers.focus).find("input").focus():a(b.el).focus()}),a(b.el).css("padding-left",c.width()+parseInt(a(b.el).css("padding-left"),10)+"px"),b.helpers.prefix=c)}},1)},addSuffix:function(){var b,c,d=this;setTimeout(function(){if("clear"!==d.type){var e=a(d.el).data("tmp")||{};if(e["old-padding-right"]&&a(d.el).css("padding-right",e["old-padding-right"]),e["old-padding-right"]=a(d.el).css("padding-right"),a(d.el).data("tmp",e),c=parseInt(a(d.el).css("padding-right"),10),d.options.arrows){d.helpers.arrows&&a(d.helpers.arrows).remove(),a(d.el).after('<div class="w2ui-field-helper" style="border: 1px solid transparent">  <div class="w2ui-field-up" type="up"> <div class="arrow-up" type="up"></div> </div> <div class="w2ui-field-down" type="down"> <div class="arrow-down" type="down"></div> </div></div>');{w2utils.getSize(d.el,"height")}b=a(d.el).next(),b.css({color:a(d.el).css("color"),"font-family":a(d.el).css("font-family"),"font-size":a(d.el).css("font-size"),height:a(d.el).height()+parseInt(a(d.el).css("padding-top"),10)+parseInt(a(d.el).css("padding-bottom"),10)+"px",padding:0,"margin-top":parseInt(a(d.el).css("margin-top"),10)+1+"px","margin-bottom":0,"border-left":"1px solid silver"}).css("margin-left","-"+(b.width()+parseInt(a(d.el).css("margin-right"),10)+12)+"px").on("mousedown",function(b){function c(){clearTimeout(f.data("_field_update_timer")),f.off("mouseup",c)}function e(c){a(d.el).focus(),d.keyDown(a.Event("keydown"),{keyCode:"up"==a(b.target).attr("type")?38:40}),c!==!1&&a("body").data("_field_update_timer",setTimeout(e,60))}var f=a("body");f.on("mouseup",c),f.data("_field_update_timer",setTimeout(e,700)),e(!1)}),c+=b.width()+12,a(d.el).css("padding-right",c+"px"),d.helpers.arrows=b}""!==d.options.suffix&&(d.helpers.suffix&&a(d.helpers.suffix).remove(),a(d.el).after('<div class="w2ui-field-helper">'+d.options.suffix+"</div>"),b=a(d.el).next(),b.css({color:a(d.el).css("color"),"font-family":a(d.el).css("font-family"),"font-size":a(d.el).css("font-size"),"padding-top":a(d.el).css("padding-top"),"padding-bottom":a(d.el).css("padding-bottom"),"padding-left":"3px","padding-right":a(d.el).css("padding-right"),"margin-top":parseInt(a(d.el).css("margin-top"),10)+2+"px","margin-bottom":parseInt(a(d.el).css("margin-bottom"),10)+1+"px"}).on("click",function(){"list"==d.type?a(d.helpers.focus).find("input").focus():a(d.el).focus()}),b.css("margin-left","-"+(w2utils.getSize(b,"width")+parseInt(a(d.el).css("margin-right"),10)+2)+"px"),c+=b.width()+3,a(d.el).css("padding-right",c+"px"),d.helpers.suffix=b)}},1)},addFocus:function(){var b,c=this,d=(this.options,0);a(c.helpers.focus).remove();var e=a(c.el).attr("tabIndex");e&&-1!=e&&(c.el._tabIndex=e),c.el._tabIndex&&(e=c.el._tabIndex);var f='<div class="w2ui-field-helper"> <div class="w2ui-icon icon-search" style="opacity: 0"></div> <input type="text" autocomplete="off" tabIndex="'+e+'"/></div>';a(c.el).attr("tabindex",-1).before(f);var g=a(c.el).prev();c.helpers.focus=g,g.css({width:a(c.el).width(),"margin-top":a(c.el).css("margin-top"),"margin-left":parseInt(a(c.el).css("margin-left"))+parseInt(a(c.el).css("padding-left"))+"px","margin-bottom":a(c.el).css("margin-bottom"),"margin-right":a(c.el).css("margin-right")}).find("input").css({cursor:"default",width:"100%",outline:"none",opacity:1,margin:0,border:"1px solid transparent",padding:a(c.el).css("padding-top"),"padding-left":0,"margin-left":d>0?d+6:0,"background-color":"transparent"}),g.find("input").on("click",function(b){0==a("#w2ui-overlay").length&&c.focus(b),b.stopPropagation()}).on("focus",function(d){b=a(c.el).attr("placeholder"),a(c.el).css({outline:"auto 5px #7DB4F3","outline-offset":"-2px"}),a(this).val(""),a(c.el).triggerHandler("focus"),d.stopPropagation?d.stopPropagation():d.cancelBubble=!0}).on("blur",function(d){a(c.el).css("outline","none"),a(this).val(""),c.refresh(),a(c.el).triggerHandler("blur"),d.stopPropagation?d.stopPropagation():d.cancelBubble=!0,null!=b&&a(c.el).attr("placeholder",b)}).on("keydown",function(d){var e=this;c.keyDown(d),setTimeout(function(){""==e.value?a(c.el).attr("placeholder",b):a(c.el).attr("placeholder","")},10)}).on("keyup",function(a){c.keyUp(a)}).on("keypress",function(a){c.keyPress(a)}),g.on("click",function(){a(this).find("input").focus()}),c.refresh()},addMulti:function(){{var b=this;this.options}a(b.helpers.multi).remove();var c="",d="margin-top : 0px; margin-bottom : 0px; margin-left : "+a(b.el).css("margin-left")+"; margin-right : "+a(b.el).css("margin-right")+"; width : "+(w2utils.getSize(b.el,"width")-parseInt(a(b.el).css("margin-left"),10)-parseInt(a(b.el).css("margin-right"),10))+"px;";"enum"==b.type&&(c='<div class="w2ui-field-helper w2ui-list" style="'+d+'; box-sizing: border-box"> <div style="padding: 0px; margin: 0px; display: inline-block" class="w2ui-multi-items"> <ul> <li style="padding-left: 0px; padding-right: 0px" class="nomouse"> <input type="text" style="width: 20px; margin: -3px 0 0; padding: 2px 0; border-color: white" autocomplete="off" '+(a(b.el).attr("readonly")?"readonly":"")+"/> </li> </ul> </div></div>"),"file"==b.type&&(c='<div class="w2ui-field-helper w2ui-list" style="'+d+'; box-sizing: border-box"> <div style="position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px;"> <input class="file-input" type="file" style="width: 100%; height: 100%; opacity: 0;" name="attachment" multiple tabindex="-1"/> </div> <div style="position: absolute; padding: 0px; margin: 0px; display: inline-block" class="w2ui-multi-items"> <ul><li style="padding-left: 0px; padding-right: 0px" class="nomouse"></li></ul> </div></div>');var e=a(b.el).data("tmp")||{};e["old-background-color"]=a(b.el).css("background-color"),e["old-border-color"]=a(b.el).css("border-color"),a(b.el).data("tmp",e),a(b.el).before(c).css({"background-color":"transparent","border-color":"transparent"});var f=a(b.el).prev();b.helpers.multi=f,"enum"==b.type&&(a(b.el).attr("tabindex",-1),f.find("input").on("click",function(c){0==a("#w2ui-overlay").length&&b.focus(c),a(b.el).triggerHandler("click")}).on("focus",function(c){a(f).css({outline:"auto 5px #7DB4F3","outline-offset":"-2px"}),a(b.el).triggerHandler("focus"),c.stopPropagation?c.stopPropagation():c.cancelBubble=!0}).on("blur",function(c){a(f).css("outline","none"),a(b.el).triggerHandler("blur"),c.stopPropagation?c.stopPropagation():c.cancelBubble=!0}).on("keyup",function(a){b.keyUp(a)}).on("keydown",function(a){b.keyDown(a)}).on("keypress",function(a){b.keyPress(a)}),f.on("click",function(){a(this).find("input").focus()})),"file"==b.type&&(a(b.el).css("outline","none"),f.on("click",function(c){a(b.el).focus(),a(b.el).attr("readonly")||(b.blur(c),b.resize(),setTimeout(function(){f.find("input").click()},10))}).on("dragenter",function(){a(b.el).attr("readonly")||a(f).addClass("w2ui-file-dragover")}).on("dragleave",function(c){if(!a(b.el).attr("readonly")){var d=a(c.target).parents(".w2ui-field-helper");0==d.length&&a(f).removeClass("w2ui-file-dragover")}}).on("drop",function(c){if(!a(b.el).attr("readonly")){a(f).removeClass("w2ui-file-dragover");for(var d=c.originalEvent.dataTransfer.files,e=0,g=d.length;g>e;e++)b.addFile.call(b,d[e]);c.preventDefault(),c.stopPropagation()}}).on("dragover",function(a){a.preventDefault(),a.stopPropagation()}),f.find("input").on("click",function(a){a.stopPropagation()}).on("change",function(){if("undefined"!=typeof this.files)for(var a=0,c=this.files.length;c>a;a++)b.addFile.call(b,this.files[a])})),b.refresh()},addFile:function(b){var c,d=this,e=this.options,f=a(d.el).data("selected"),g={name:b.name,type:b.type,modified:b.lastModifiedDate,size:b.size,content:null,file:b},h=0,i=0;for(var j in f){if(f[j].name==b.name&&f[j].size==b.size)return;h+=f[j].size,i++}var k=d.trigger({phase:"before",type:"add",target:d.el,file:g,total:i,totalSize:h});if(k.isCancelled!==!0){if(0!==e.maxFileSize&&g.size>e.maxFileSize)return c="Maximum file size is "+w2utils.formatSize(e.maxFileSize),e.silent===!1&&a(d.el).w2tag(c),void console.log("ERROR: "+c);if(0!==e.maxSize&&h+g.size>e.maxSize)return c="Maximum total size is "+w2utils.formatSize(e.maxSize),e.silent===!1&&a(d.el).w2tag(c),void console.log("ERROR: "+c);if(0!==e.max&&i>=e.max)return c="Maximum number of files is "+e.max,e.silent===!1&&a(d.el).w2tag(c),void console.log("ERROR: "+c);if(f.push(g),"undefined"!=typeof FileReader){var l=new FileReader;l.onload=function(){return function(b){var c=b.target.result,e=c.indexOf(",");g.content=c.substr(e+1),d.refresh(),a(d.el).trigger("change"),d.trigger(a.extend(k,{phase:"after"}))}}(),l.readAsDataURL(b)}else d.refresh(),a(d.el).trigger("change")}},normMenu:function(b){if(a.isArray(b)){for(var c=0;c<b.length;c++)"string"==typeof b[c]?b[c]={id:b[c],text:b[c]}:(null!=b[c].text&&null==b[c].id&&(b[c].id=b[c].text),null==b[c].text&&null!=b[c].id&&(b[c].text=b[c].id),null!=b[c].caption&&(b[c].text=b[c].caption));return b}if("function"==typeof b)return this.normMenu(b());if("object"==typeof b){var d=[];for(var c in b)d.push({id:c,text:b[c]});return d}},getMonthHTML:function(a,b,c){var d=new Date,e=w2utils.settings.fullmonths,f=["31","28","31","30","31","30","31","31","30","31","30","31"],g=d.getFullYear()+"/"+(Number(d.getMonth())+1)+"/"+d.getDate(),h=w2utils.settings.fulldays.slice(),i=w2utils.settings.shortdays.slice();"M"!=w2utils.settings.weekStarts&&(h.unshift(h.pop()),i.unshift(i.pop()));var j=this.options;null==j&&(j={}),b=w2utils.isInt(b)?parseInt(b):d.getFullYear(),a=w2utils.isInt(a)?parseInt(a):d.getMonth()+1,a>12&&(a-=12,b++),(1>a||0===a)&&(a+=12,b--),f[1]=b/4==Math.floor(b/4)?"29":"28",j.current=a+"/"+b,d=new Date(b,a-1,1);for(var k=d.getDay(),l="",m=0;m<i.length;m++)l+='<td title="'+h[m]+'">'+i[m]+"</td>";var n='<div class="w2ui-calendar-title title"> <div class="w2ui-calendar-previous previous"> <div></div> </div> <div class="w2ui-calendar-next next"> <div></div> </div> '+e[a-1]+", "+b+'</div><table class="w2ui-calendar-days" cellspacing="0"><tbody> <tr class="w2ui-day-title">'+l+"</tr> <tr>",o=1;
if("M"!=w2utils.settings.weekStarts&&k++,"datetime"===this.type){var p=w2utils.use_momentjs?w2utils.isDateTime(c,j.format_mjs,!0):w2utils.isDateTime(c,j.format,!0);c=w2utils.formatDate(p,w2utils.settings.date_format)}for(var q=1;43>q;q++){if(0===k&&1==q){for(var r=0;6>r;r++)n+='<td class="w2ui-day-empty"> </td>';q+=6}else if(k>q||o>f[a-1]){n+='<td class="w2ui-day-empty"> </td>',q%7===0&&(n+="</tr><tr>");continue}var s=b+"/"+a+"/"+o,t=new Date(s),u="";6==t.getDay()&&(u=" w2ui-saturday"),0==t.getDay()&&(u=" w2ui-sunday"),s==g&&(u+=" w2ui-today");var v,w,x=o,y="",z="";if("datetime"===this.type?(v=w2utils.formatDateTime(s,j.format),w=w2utils.formatDate(s,w2utils.settings.date_format)):(v=w2utils.formatDate(s,j.format),w=v),j.colored&&void 0!==j.colored[w]){var A=j.colored[w].split(":");z="background-color: "+A[0]+";",y="color: "+A[1]+";"}n+='<td class="'+(this.inRange(v)?"w2ui-date "+(w==c?"w2ui-date-selected":""):"w2ui-blocked")+u+'" style="'+y+z+'" date="'+v+'" data-date="'+t+'">'+x+"</td>",(q%7===0||0===k&&1==q)&&(n+="</tr><tr>"),o++}return n+="</tr></tbody></table>"},getYearHTML:function(){for(var a=w2utils.settings.shortmonths,b=w2utils.settings.dateStartYear,c=w2utils.settings.dateEndYear,d="",e="",f=0;f<a.length;f++)d+='<div class="w2ui-jump-month" name="'+f+'">'+a[f]+"</div>";for(var g=b;c>=g;g++)e+='<div class="w2ui-jump-year" name="'+g+'">'+g+"</div>";return"<div>"+d+"</div><div>"+e+"</div>"},getHourHTML:function(){var a=[],b=this.options;null==b&&(b={format:w2utils.settings.time_format});for(var c=b.format.indexOf("h24")>-1,d=0;24>d;d++){var e=(d>=12&&!c?d-12:d)+":00"+(c?"":12>d?" am":" pm");12!=d||c||(e="12:00 pm"),a[Math.floor(d/8)]||(a[Math.floor(d/8)]="");var f=this.fromMin(this.toMin(e)),g=this.fromMin(this.toMin(e)+59);a[Math.floor(d/8)]+='<div class="'+("datetime"===this.type||this.inRange(f)||this.inRange(g)?"w2ui-time ":"w2ui-blocked")+'" hour="'+d+'">'+e+"</div>"}var h='<div class="w2ui-calendar-time"><table><tbody><tr> <td>'+a[0]+"</td> <td>"+a[1]+"</td> <td>"+a[2]+"</td></tr></tbody></table></div>";return h},getMinHTML:function(a){null==a&&(a=0);var b=this.options;null==b&&(b={format:w2utils.settings.time_format});for(var c=b.format.indexOf("h24")>-1,d=[],e=0;60>e;e+=5){var f=(a>12&&!c?a-12:a)+":"+(10>e?0:"")+e+" "+(c?"":12>a?"am":"pm"),g=20>e?0:40>e?1:2;d[g]||(d[g]=""),d[g]+='<div class="'+("datetime"===this.type||this.inRange(f)?"w2ui-time ":"w2ui-blocked")+'" min="'+e+'">'+f+"</div>"}var h='<div class="w2ui-calendar-time"><table><tbody><tr> <td>'+d[0]+"</td> <td>"+d[1]+"</td> <td>"+d[2]+"</td></tr></tbody></table></div>";return h},toMin:function(a){if("string"!=typeof a)return null;var b=a.split(":");return 2!=b.length?null:(b[0]=parseInt(b[0]),b[1]=parseInt(b[1]),-1!=a.indexOf("pm")&&12!=b[0]&&(b[0]+=12),60*b[0]+b[1])},fromMin:function(a){var b="";a>=1440&&(a%=1440),0>a&&(a=1440+a);var c=Math.floor(a/60),d=(10>a%60?"0":"")+a%60,e=this.options;return null==e&&(e={format:w2utils.settings.time_format}),b=-1!=e.format.indexOf("h24")?c+":"+d:(12>=c?c:c-12)+":"+d+" "+(c>=12?"pm":"am")}},a.extend(b.prototype,w2utils.event),w2obj.field=b}(jQuery);