var w2ui=w2ui||{},w2obj=w2obj||{},w2utils=function(g){var e={};return{version:"1.5.RC1",settings:{locale:"en-us",dateFormat:"m/d/yyyy",timeFormat:"hh:mi pm",datetimeFormat:"m/d/yyyy|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:"HTTPJSON",phrases:{},dateStartYear:1950,dateEndYear:2020},isBin:function(e){return/^[0-1]+$/.test(e)},isInt:c,isFloat:function(e){"string"==typeof e&&(e=e.replace(/\s+/g,"").replace(w2utils.settings.groupSymbol,"").replace(w2utils.settings.decimalSymbol,"."));return("number"==typeof e||"string"==typeof e&&""!==e)&&!isNaN(Number(e))},isMoney:function(e){var t=w2utils.settings,i=new RegExp("^"+(t.currencyPrefix?"\\"+t.currencyPrefix+"?":"")+"[-+]?"+(t.currencyPrefix?"\\"+t.currencyPrefix+"?":"")+"[0-9]*[\\"+t.decimalSymbol+"]?[0-9]+"+(t.currencySuffix?"\\"+t.currencySuffix+"?":"")+"$","i");"string"==typeof e&&(e=e.replace(new RegExp(t.groupSymbol,"g"),""));return"object"!=typeof e&&""!==e&&i.test(e)},isHex:function(e){return/^[a-fA-F0-9]+$/.test(e)},isAlphaNumeric:function(e){return/^[a-zA-Z0-9_-]+$/.test(e)},isEmail:function(e){return/^[a-zA-Z0-9._%-+]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/.test(e)},isDate:function(e,t,i){if(!e)return!1;var s,n,a,r="Invalid Date";null==t&&(t=w2utils.settings.dateFormat);if("function"==typeof e.getUTCFullYear)a=e.getUTCFullYear(),s=e.getUTCMonth()+1,n=e.getUTCDate();else if(parseInt(e)==e&&0'+a+""},formatSize:function(e){var t;return w2utils.isFloat(e)&&""!==e?0===(e=parseFloat(e))?0:(t=parseInt(Math.floor(Math.log(e)/Math.log(1024))),(Math.floor(e/Math.pow(1024,t)*10)/10).toFixed(0===t?0:1)+" "+(["Bt","KB","MB","GB","TB","PB","EB","ZB"][t]||"??")):""},formatNumber:function(e,t,i){if(null==e||""===e||"object"==typeof e)return"";i={minimumFractionDigits:t,maximumFractionDigits:t,useGrouping:i};(null==t||t<0)&&(i.minimumFractionDigits=0,i.maximumFractionDigits=20);return parseFloat(e).toLocaleString(w2utils.settings.locale,i)},formatDate:function(e,t){t=t||this.settings.dateFormat;if(""===e||null==e||"object"==typeof e&&!e.getMonth)return"";var i,s=new Date(e);w2utils.isInt(e)&&(s=new Date(Number(e)));return"Invalid Date"==String(s)?"":(e=s.getFullYear(),i=s.getMonth(),s=s.getDate(),t.toLowerCase().replace("month",w2utils.settings.fullmonths[i]).replace("mon",w2utils.settings.shortmonths[i]).replace(/yyyy/g,e).replace(/yyy/g,e).replace(/yy/g,2e3]+)>)/gi,"");break;case"object":if(Array.isArray(e)){e=g.extend(!0,[],e);for(var t=0;t").replace(/</g,"<").replace(/"/g,'"').replace(/&/g,"&");break;case"object":if(Array.isArray(e)){e=g.extend(!0,[],e);for(var t=0;t\|\/? {}\\])/g,"\\$1")},base64encode:function(e){var t,i,s,n,a,r,o="",l=0,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e=function(e){e=String(e).replace(/\r\n/g,"\n");for(var t="",i=0;i>6|192))+String.fromCharCode(63&s|128):(t=(t+=String.fromCharCode(s>>12|224))+String.fromCharCode(s>>6&63|128))+String.fromCharCode(63&s|128)}return t}(e);for(;l>2,n=(3&n)<<4|t>>4,a=(15&t)<<2|i>>6,r=63&i,isNaN(t)?a=r=64:isNaN(i)&&(r=64),o=o+d.charAt(s)+d.charAt(n)+d.charAt(a)+d.charAt(r);return o},base64decode:function(e){var t,i,s,n,a,r="",o=0,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(;o>4,s=(15&s)<<4|n>>2,t=(3&n)<<6|a,r+=String.fromCharCode(i),64!==n&&(r+=String.fromCharCode(s)),64!==a&&(r+=String.fromCharCode(t));return r=function(e){for(var t,i,s,n="",a=0;a>>4&15)+i.charAt(15&t);return s}function s(e){for(var t,i,s="",n=-1;++n>>6&31,128|63&t):t<=65535?s+=String.fromCharCode(224|t>>>12&15,128|t>>>6&63,128|63&t):t<=2097151&&(s+=String.fromCharCode(240|t>>>18&7,128|t>>>12&63,128|t>>>6&63,128|63&t));return s}function n(e){for(var t=Array(e.length>>2),i=0;i>5]|=(255&e.charCodeAt(i/8))<>5]>>>i%32&255);return t}function o(e,t){e[t>>5]|=128<>>9<<4)]=t;for(var i=1732584193,s=-271733879,n=-1732584194,a=271733878,r=0;r>>32-n,i)}function c(e,t,i,s,n,a,r){return l(t&i|~t&s,e,t,n,a,r)}function h(e,t,i,s,n,a,r){return l(t&s|i&~s,e,t,n,a,r)}function p(e,t,i,s,n,a,r){return l(t^i^s,e,t,n,a,r)}function f(e,t,i,s,n,a,r){return l(i^(t|~s),e,t,n,a,r)}function g(e,t){var i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}return function(e){return i(t(s(e)))}(e)},transition:function(e,t,i,s){var n=g(e).width(),a=g(e).height();if(e&&t){switch(e.parentNode.style.cssText+="perspective: 900px; overflow: hidden;",e.style.cssText+="; position: absolute; z-index: 1019; backface-visibility: hidden",t.style.cssText+="; position: absolute; z-index: 1020; backface-visibility: hidden",i){case"slide-left":e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d("+n+"px, 0, 0)",g(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: translate3d(0, 0, 0)",e.style.cssText+="transition: 0.5s; transform: translate3d(-"+n+"px, 0, 0)"},1);break;case"slide-right":e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(-"+n+"px, 0, 0)",g(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: translate3d(0px, 0, 0)",e.style.cssText+="transition: 0.5s; transform: translate3d("+n+"px, 0, 0)"},1);break;case"slide-down":e.style.cssText+="overflow: hidden; z-index: 1; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; z-index: 0; transform: translate3d(0, 0, 0)",g(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: translate3d(0, 0, 0)",e.style.cssText+="transition: 0.5s; transform: translate3d(0, "+a+"px, 0)"},1);break;case"slide-up":e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(0, "+a+"px, 0)",g(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: translate3d(0, 0, 0)",e.style.cssText+="transition: 0.5s; transform: translate3d(0, 0, 0)"},1);break;case"flip-left":e.style.cssText+="overflow: hidden; transform: rotateY(0deg)",t.style.cssText+="overflow: hidden; transform: rotateY(-180deg)",g(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: rotateY(0deg)",e.style.cssText+="transition: 0.5s; transform: rotateY(180deg)"},1);break;case"flip-right":e.style.cssText+="overflow: hidden; transform: rotateY(0deg)",t.style.cssText+="overflow: hidden; transform: rotateY(180deg)",g(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: rotateY(0deg)",e.style.cssText+="transition: 0.5s; transform: rotateY(-180deg)"},1);break;case"flip-down":e.style.cssText+="overflow: hidden; transform: rotateX(0deg)",t.style.cssText+="overflow: hidden; transform: rotateX(180deg)",g(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: rotateX(0deg)",e.style.cssText+="transition: 0.5s; transform: rotateX(-180deg)"},1);break;case"flip-up":e.style.cssText+="overflow: hidden; transform: rotateX(0deg)",t.style.cssText+="overflow: hidden; transform: rotateX(-180deg)",g(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: rotateX(0deg)",e.style.cssText+="transition: 0.5s; transform: rotateX(180deg)"},1);break;case"pop-in":e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(.8); opacity: 0;",g(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: scale(1); opacity: 1;",e.style.cssText+="transition: 0.5s;"},1);break;case"pop-out":e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(1); opacity: 1;",t.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); opacity: 0;",g(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; opacity: 1;",e.style.cssText+="transition: 0.5s; transform: scale(1.7); opacity: 0;"},1);break;default:e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; translate3d(0, 0, 0); opacity: 0;",g(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; opacity: 1;",e.style.cssText+="transition: 0.5s"},1)}setTimeout(function(){"slide-down"===i&&(g(e).css("z-index","1019"),g(t).css("z-index","1020")),t&&g(t).css({opacity:"1"}).css(w2utils.cssPrefix({transition:"",transform:""})),e&&g(e).css({opacity:"1"}).css(w2utils.cssPrefix({transition:"",transform:""})),"function"==typeof s&&s()},500)}else console.log("ERROR: Cannot do transition when one of the divs is null")},lock:function(e,t,i){var s={};"object"==typeof t?s=t:(s.msg=t,s.spinner=i);s.msg||0===s.msg||(s.msg="");w2utils.unlock(e),g(e).prepend('
');t=g(e).find(".w2ui-lock"),i=g(e).find(".w2ui-lock-msg");s.msg||i.css({"background-color":"transparent",border:"0px"});!0===s.spinner&&(s.msg='
"+s.msg);null!=s.opacity&&t.css("opacity",s.opacity);"function"==typeof t.fadeIn?(t.fadeIn(200),i.html(s.msg).fadeIn(200)):(t.show(),i.html(s.msg).show(0))},unlock:function(e,t){c(t)?(g(e).find(".w2ui-lock").fadeOut(t),setTimeout(function(){g(e).find(".w2ui-lock").remove(),g(e).find(".w2ui-lock-msg").remove()},t)):(g(e).find(".w2ui-lock").remove(),g(e).find(".w2ui-lock-msg").remove())},message:function(s,e){var t,n,a=this;g().w2tag(),e=e||{width:200,height:100};null==e.on&&g.extend(e,w2utils.event);null==e.width&&(e.width=200);null==e.height&&(e.height=100);var i=parseInt(g(s.box).width()),r=parseInt(g(s.box).height()),o=parseInt(g(s.box).find(s.title).css("height")||0);e.width>i&&(e.width=i-10);e.height>r-o&&(e.height=r-10-o);e.originalWidth=e.width,e.originalHeight=e.height,parseInt(e.width)<0&&(e.width=i+e.width);parseInt(e.width)<10&&(e.width=10);parseInt(e.height)<0&&(e.height=r+e.height-o);parseInt(e.height)<10&&(e.height=10);null==e.hideOnClick&&(e.hideOnClick=!1);var l=g(s.box).data("options")||{};(null==e.width||e.width>l.width-10)&&(e.width=l.width-10);(null==e.height||e.height>l.height-o-5)&&(e.height=l.height-o-5);e.originalHeight<0&&(e.height=r+e.originalHeight-o);e.originalWidth<0&&(e.width=i+2*e.originalWidth);var d=g(s.box).find(s.title),l=g(s.box).find(".w2ui-message.w2ui-closing");0'+(e.body||"")+'
'+(e.buttons||"")+"
"),g(s.box).find(".w2ui-message").css("z-index",1390),d.data("old-z-index",d.css("z-index")),d.css("z-index",1501),g(s.box).find(s.body).before('"),g(s.box).find("#w2ui-message"+u).data("options",e).data("prev_focus",g(":focus")),h=g(s.box).find("#w2ui-message"+u).css("display"),g(s.box).find("#w2ui-message"+u).css(w2utils.cssPrefix({transform:"none"==h?"translateY(-"+e.height+"px)":"translateY(0px)"})),"none"==h&&(g(s.box).find("#w2ui-message"+u).show().html(e.html),e.box=g(s.box).find("#w2ui-message"+u),!0===(n=e.trigger({phase:"before",type:"open",target:"self"})).isCancelled?(d.css("z-index",d.data("old-z-index")),g(s.box).find("#w2ui-message"+u).remove()):(setTimeout(function(){g(s.box).find("#w2ui-message"+u).css(w2utils.cssPrefix({transform:"none"==h?"translateY(0px)":"translateY(-"+e.height+"px)"}))},1),0===u&&this.lock&&(s.param?this.lock(s.param):this.lock()),setTimeout(function(){g(s.box).find("#w2ui-message"+u).css(w2utils.cssPrefix({transition:"0s"})),e.trigger(g.extend(n,{phase:"after"}))},350))))}function p(e,t){var i;null==n&&!0===(n=t.trigger({phase:"before",type:"open",target:"self"})).isCancelled?(d.css("z-index",d.data("old-z-index")),g(s.box).find("#w2ui-message"+u).remove()):(i=e.data("prev_focus"),e.remove(),i&&0'+i(e)+"";return g("body").append(t),e=g("#_tmp_width").width(),g("#_tmp_width").remove(),e},scrollBarSize:function(){return e.scrollBarSize||(g("body").append('
1
'),e.scrollBarSize=100-g("#_scrollbar_width > div").width(),g("#_scrollbar_width").remove(),0<=String(navigator.userAgent).indexOf("MSIE")&&(e.scrollBarSize=e.scrollBarSize/2)),e.scrollBarSize},checkName:function(e,t){if(e&&null!=e.name)if(null!=w2ui[e.name])console.log('ERROR: The parameter "name" is not unique. There are other objects already created with the same name (obj: '+e.name+").");else{if(w2utils.isAlphaNumeric(e.name))return!0;console.log('ERROR: The parameter "name" has to be alpha-numeric (a-z, 0-9, dash and underscore). ')}else console.log('ERROR: The parameter "name" is required but not supplied in $().'+t+"().");return!1},checkUniqueId:function(e,t,i,s){g.isArray(t)||(t=[t]);for(var n=0;n").replace(/&/g,"&").replace(/"/g,'"').replace(/ /g," ")),t<=o.length){(s=(s=e.childNodes[r]).childNodes&&0s.length&&(t=s.length),n.setStart(s,t),i?n.setEnd(s,i):n.collapse(!0),a.removeAllRanges(),a.addRange(n))}},testLocalStorage:t,hasLocalStorage:t(),isIOS:-1!=navigator.userAgent.toLowerCase().indexOf("iphone")||-1!=navigator.userAgent.toLowerCase().indexOf("ipod")||-1!=navigator.userAgent.toLowerCase().indexOf("ipad"),isIE:-1!=navigator.userAgent.toLowerCase().indexOf("msie")||-1!=navigator.userAgent.toLowerCase().indexOf("trident")};function c(e){return/^[-+]?[0-9]+$/.test(e)}function i(e){if(null!=e)switch(typeof e){case"number":break;case"string":e=String(e).replace(/&/g,"&").replace(/>/g,">").replace(/'+w2utils.formatDate(i,t)+""},datetime:function(e,t){var i;return""===t&&(t=w2utils.settings.datetimeFormat),null==e||0===e||""===e?"":''+w2utils.formatDateTime(i,t)+""},time:function(e,t){var i;return""===t&&(t=w2utils.settings.timeFormat),null==e||0===e||""===e?"":''+w2utils.formatTime(e,t)+""},timestamp:function(e,t){var i;return""===t&&(t=w2utils.settings.datetimeFormat),null!=e&&0!==e&&""!==e&&(i=!1===(i=w2utils.isDateTime(e,t,!0))?w2utils.isDate(e,t,!0):i).toString?i.toString():""},gmt:function(e,t){var i;return""===t&&(t=w2utils.settings.datetimeFormat),null!=e&&0!==e&&""!==e&&(i=!1===(i=w2utils.isDateTime(e,t,!0))?w2utils.isDate(e,t,!0):i).toUTCString?i.toUTCString():""},age:function(e,t){var i;return null==e||0===e||""===e?"":''+w2utils.age(e)+(t?" "+t:"")+""},interval:function(e,t){return null==e||0===e||""===e?"":w2utils.interval(e)+(t?" "+t:"")},toggle:function(e,t){return e?"Yes":""},password:function(e,t){for(var i="",s=0;s/g,"<"),new RegExp(s+"(?!([^<]+)?>)","gi"));t.innerHTML=t.innerHTML.replace(s,n)}function n(e){return''+e+""}}):v(this).each(r);function r(e,t){for(;-1!=t.innerHTML.indexOf('');)t.innerHTML=t.innerHTML.replace(/\((.|\n|\r)*)\<\/span\>/gi,"$1")}},v.fn.w2tag=function(n,w){if(1==arguments.length&&"object"==typeof n&&null!=(w=n).html&&(n=w.html),null!=(w=v.extend({id:null,html:n,position:"right|top",align:"none",left:0,top:0,style:"",css:{},className:"",inputClass:"",onShow:null,onHide:null,hideOnKeyPress:!0,hideOnBlur:!1,hideOnClick:!1},w)).name&&null==w.id&&(w.id=w.name),""!==w.class&&""===w.inputClass&&(w.inputClass=w.class),0!==v(this).length)return v(this).each(function(e,p){var t,i=w.id||p.id,s=w2utils.escapeId(i),f=v("#w2ui-tag-"+s);function g(){(f=v("#w2ui-tag-"+s)).length<=0||(clearInterval(f.data("timer")),f.remove(),v(document).off(".w2tag"),v(p).off(".w2tag",g).removeClass(w.inputClass).removeData("w2tag").removeData("checkIfMoved"),0';g+='"}!0===n.info&&(n.info={}),null!=n.info&&(n.info.icon||(n.info.icon="w2ui-icon-info"),g+=''),null!=n.render?("function"==typeof n.render&&((o=$.trim(n.render.call(this,r,e,t,o))).length<4||"'+g+String(o)+""),"object"==typeof n.render&&(o='
'+g+(n.render[o]||"")+"
"),"string"==typeof n.render&&(m=[],-1==(b=n.render.toLowerCase().indexOf(":"))?(m[0]=n.render.toLowerCase(),m[1]=""):(m[0]=n.render.toLowerCase().substr(0,b),m[1]=n.render.toLowerCase().substr(b+1)),o='
'+g+("function"==typeof(b=w2utils.formatters[m[0]])?b(o,m[1]):"")+"
")):(l&&-1!=["checkbox","check"].indexOf(l.type)&&(d+="text-align: center;",o='',g=""),this.show.recordTitles&&(a=w2utils.stripTags(String(o).replace(/"/g,"''")),null!=n.title&&("function"==typeof n.title&&(a=n.title.call(this,r,e,t)),"string"==typeof n.title&&(a=n.title))),o='
'+g+String(o)+"
"),null==o&&(o=""),"string"==typeof n.render&&(m=n.render.toLowerCase().split(":"),-1!=["number","int","float","money","currency","percent","size"].indexOf(m[0])&&(c+="text-align: right;")),r&&r.w2ui&&("object"==typeof r.w2ui.style&&("string"==typeof r.w2ui.style[t]&&(c+=r.w2ui.style[t]+";"),"string"==typeof r.w2ui.style[n.field]&&(c+=r.w2ui.style[n.field]+";")),"object"==typeof r.w2ui.class&&("string"==typeof r.w2ui.class[t]&&(h+=r.w2ui.class[t]+" "),"string"==typeof r.w2ui.class[n.field]&&(h+=r.w2ui.class[n.field]+" ")));var b=!1;return o='"+o+""},showBubble:function(e,t){var i="",s=this.columns[t].info,n=this.records[e],a=$(this.box).find("#grid_"+this.name+"_data_"+e+"_"+t+" .w2ui-info");if(this.last.bubbleEl&&$(this.last.bubbleEl).w2tag(),this.last.bubbleEl=a,null==s.fields){s.fields=[];for(var r=0;r
':(c=(o=null==(o=this.getColumn(u[0]))?{field:u[0],caption:u[0]}:o)?this.parseField(n,o.field):"",1s.maxLength&&(c=c.substr(0,s.maxLength)+"..."),i+=""+o.caption+""+((0===c?"0":c)||"")+""));i+=""}else if($.isPlainObject(l)){for(var d in i='',l){var u,c,h=l[d];""==h||"-"==h||"--"==h||"---"==h?i+='':(u=String(h).split(":"),c=(o=null==(o=this.getColumn(u[0]))?{field:u[0],caption:u[0]}:o)?this.parseField(n,o.field):"",1"))}i+="
"+d+""+((c=null!=s.maxLength&&"string"==typeof c&&c.length>s.maxLength?c.substr(0,s.maxLength)+"...":c)||"")+"
"}$(a).w2tag($.extend({html:i,left:-4,position:"bottom|top",className:"w2ui-info-bubble",style:"",hideOnClick:!0},s.options||{}))},getCellEditable:function(e,t){var i,s=this.columns[t],n=this.records[e];return!n||!s||!1===(i=n.w2ui?n.w2ui.editable:null)?null:(null!=i&&!0!==i||"function"==typeof(i=s?s.editable:null)&&(s=this.getCellValue(e,t,!1),i=i.call(this,n,e,t,s)),i)},getCellValue:function(e,t,i){t=this.columns[t],i=(!0!==i?this.records:this.summary)[e],e=this.parseField(i,t.field);return i&&i.w2ui&&i.w2ui.changes&&null!=i.w2ui.changes[t.field]&&(e=i.w2ui.changes[t.field]),e=null==(e=$.isPlainObject(e)&&t.editable&&null!=(e=null!=e.text?e.text:e).id?e.id:e)?"":e},getFooterHTML:function(){return'
'},status:function(e){var t,i;null!=e?$("#grid_"+this.name+"_footer").find(".w2ui-footer-left").html(e):(e="",0<(t=this.getSelection()).length&&(this.show.statusSelection&&1=this.columns.length)return null;var n=this.records[e].w2ui,a=(this.columns[t],this.columns[s]),n=n&&n.colspan&&!isNaN(n.colspan[a.field])?parseInt(n.colspan[a.field]):1;if(null==a)return null;if(a&&a.hidden||0===n)return this.nextCell(e,s,i);if(i){a=this.getCellEditable(e,t);if(null==a||-1!=["checkbox","check"].indexOf(a.type))return this.nextCell(e,s,i)}return s},prevCell:function(e,t,i){var s=t-1;if(s<0)return null;var n=this.records[e].w2ui,a=this.columns[s],n=n&&n.colspan&&!isNaN(n.colspan[a.field])?parseInt(n.colspan[a.field]):1;if(null==a)return null;if(a&&a.hidden||0===n)return this.prevCell(e,s,i);if(i){a=this.getCellEditable(e,t);if(null==a||-1!=["checkbox","check"].indexOf(a.type))return this.prevCell(e,s,i)}return s},nextRow:function(e,t){var i=this.last.searchIds,s=null;if(e+1this.records.length)break;e++}var n=this.records[e].w2ui,a=this.columns[t],s=0===(n&&n.colspan&&null!=a&&!isNaN(n.colspan[a.field])?parseInt(n.colspan[a.field]):1)?this.nextRow(e,t):e}return s},prevRow:function(e,t){var i=this.last.searchIds,s=null;if(0i[0]){if(e--,0'+e+"",buttons:'",onOpen:function(e){setTimeout(function(){$(this.box).find(".w2ui-btn").focus()},25)},onClose:function(e){"function"==typeof t&&t()}}),w2utils.message.call(this,{box:this.box,path:"w2ui."+this.name,title:".w2ui-grid-header:visible",body:".w2ui-grid-box"},e)}},$.extend(w2grid.prototype,w2utils.event),w2obj.grid=w2grid}(jQuery),!function(D){function o(e){this.box=null,this.name=null,this.panels=[],this.tmp={},this.padding=1,this.resizer=4,this.style="",D.extend(!0,this,w2obj.layout,e)}var z=["top","left","main","preview","right","bottom"];D.fn.w2layout=function(e){var t;if(!D.isPlainObject(e))return(t=w2ui[D(this).attr("name")])?0"+t+""),!0):null!=u&&(null==t?u.content:!0!==(s=this.trigger({phase:"before",type:"content",target:e,object:u,content:t,transition:i})).isCancelled?t instanceof jQuery?(console.log("ERROR: You can not pass jQuery object to w2layout.content() method"),!1):(n="#layout_"+this.name+"_panel_"+u.type,(r=0)<(a=D(n+"> .w2ui-panel-content")).length&&(D(n).scrollTop(0),r=D(a).position().top),""===u.content?u.content=t:(u.content=t,u.hidden||null!=i&&""!==i&&((o=D(n+"> .w2ui-panel-content")).after('
'),l=D(n+"> .w2ui-panel-content.new-panel"),o.css("top",r),l.css("top",r),"object"==typeof t?(t.box=l[0],t.render()):l.html(t),w2utils.transition(o[0],l[0],i,function(){o.remove(),l.removeClass("new-panel"),l.css("overflow",u.overflow),d.resize(),-1!=window.navigator.userAgent.indexOf("MSIE")&&setTimeout(function(){d.resize()},100)}))),this.refresh(e),d.trigger(D.extend(s,{phase:"after"})),d.resize(),-1!=window.navigator.userAgent.indexOf("MSIE")&&setTimeout(function(){d.resize()},100),!0):void 0)},message:function(e,t){var i,s=this,n=("string"==typeof t&&(t={width:t.length<300?350:550,height:t.length<300?170:250,body:'
'+t+"
",buttons:'",onOpen:function(e){setTimeout(function(){D(this.box).find(".w2ui-btn").focus()},25)}}),this.get(e)),a=D("#layout_"+this.name+"_panel_"+n.type).css("overflow");t&&(t.onClose&&(i=t.onClose),t.onClose=function(e){"function"==typeof i&&i(e),e.done(function(){D("#layout_"+s.name+"_panel_"+n.type).css("overflow",a)})}),D("#layout_"+this.name+"_panel_"+n.type).css("overflow","hidden"),w2utils.message.call(this,{box:D("#layout_"+this.name+"_panel_"+n.type),param:e,path:"w2ui."+this.name,title:".w2ui-panel-title:visible",body:".w2ui-panel-content"},t)},load:function(s,e,n,a){var r=this;return"css"==s?(D.get(e,function(e,t,i){r.content(s,i.responseText),a&&a()}),!0):null!=this.get(s)&&(D.get(e,function(e,t,i){r.content(s,i.responseText,n),a&&a(),r.resize(),-1!=window.navigator.userAgent.indexOf("MSIE")&&setTimeout(function(){r.resize()},100)}),!0)},sizeTo:function(e,t,i){var s=this;return null!=s.get(e)&&(D(s.box).find(" > div > .w2ui-panel").css(w2utils.cssPrefix("transition",!0!==i?".2s":"0s")),setTimeout(function(){s.set(e,{size:t})},1),setTimeout(function(){D(s.box).find(" > div > .w2ui-panel").css(w2utils.cssPrefix("transition","0s")),s.resize()},500),!0)},show:function(e,t){var i,s=this,n=this.trigger({phase:"before",type:"show",target:e,object:this.get(e),immediate:t});if(!0!==n.isCancelled)return null!=(i=s.get(e))&&(!(i.hidden=!1)===t?(D("#layout_"+s.name+"_panel_"+e).css({opacity:"1"}),s.trigger(D.extend(n,{phase:"after"})),s.resize()):(D("#layout_"+s.name+"_panel_"+e).css({opacity:"0"}),D(s.box).find(" > div > .w2ui-panel").css(w2utils.cssPrefix("transition",".2s")),setTimeout(function(){s.resize()},1),setTimeout(function(){D("#layout_"+s.name+"_panel_"+e).css({opacity:"1"})},250),setTimeout(function(){D(s.box).find(" > div > .w2ui-panel").css(w2utils.cssPrefix("transition","0s")),s.trigger(D.extend(n,{phase:"after"})),s.resize()},500)),!0)},hide:function(e,t){var i,s=this,n=this.trigger({phase:"before",type:"hide",target:e,object:this.get(e),immediate:t});if(!0!==n.isCancelled)return null!=(i=s.get(e))&&((i.hidden=!0)===t?(D("#layout_"+s.name+"_panel_"+e).css({opacity:"0"}),s.trigger(D.extend(n,{phase:"after"})),s.resize()):(D(s.box).find(" > div > .w2ui-panel").css(w2utils.cssPrefix("transition",".2s")),D("#layout_"+s.name+"_panel_"+e).css({opacity:"0"}),setTimeout(function(){s.resize()},1),setTimeout(function(){D(s.box).find(" > div > .w2ui-panel").css(w2utils.cssPrefix("transition","0s")),s.trigger(D.extend(n,{phase:"after"})),s.resize()},500)),!0)},toggle:function(e,t){var i=this.get(e);return null!=i&&(i.hidden?this.show(e,t):this.hide(e,t))},set:function(e,t){var i=this.get(e,!0);return null!=i&&(D.extend(this.panels[i],t),null==t.content&&null==t.resizable||this.refresh(e),this.resize(),!0)},get:function(e,t){for(var i=0;i .w2ui-panel-content");return 1!=e.length?null:e[0]},hideToolbar:function(e){var t=this.get(e);t&&(t.show.toolbar=!1,D("#layout_"+this.name+"_panel_"+e+"> .w2ui-panel-toolbar").hide(),this.resize())},showToolbar:function(e){var t=this.get(e);t&&(t.show.toolbar=!0,D("#layout_"+this.name+"_panel_"+e+"> .w2ui-panel-toolbar").show(),this.resize())},toggleToolbar:function(e){var t=this.get(e);t&&(t.show.toolbar?this.hideToolbar(e):this.showToolbar(e))},assignToolbar:function(e,t){"string"==typeof t&&null!=w2ui[t]&&(t=w2ui[t]);var i=this.get(e),t=(i.toolbar=t,D(this.box).find(e+"> .w2ui-panel-toolbar"));null!=i.toolbar?(0===t.find("[name="+i.toolbar.name+"]").length?t.w2render(i.toolbar):null!=i.toolbar&&i.toolbar.refresh(),this.showToolbar(e),this.refresh("main")):(t.html(""),this.hideToolbar(e))},hideTabs:function(e){var t=this.get(e);t&&(t.show.tabs=!1,D("#layout_"+this.name+"_panel_"+e+"> .w2ui-panel-tabs").hide(),this.resize())},showTabs:function(e){var t=this.get(e);t&&(t.show.tabs=!0,D("#layout_"+this.name+"_panel_"+e+"> .w2ui-panel-tabs").show(),this.resize())},toggleTabs:function(e){var t=this.get(e);t&&(t.show.tabs?this.hideTabs(e):this.showTabs(e))},render:function(e){var u=this,t=(new Date).getTime(),i=u.trigger({phase:"before",type:"render",target:u.name,box:e});if(!0!==i.isCancelled){if(null!=e&&(0"),0
';D(u.box).find(" > div").append(n)}return D(u.box).find(" > div").append('
'),u.refresh(),u.trigger(D.extend(i,{phase:"after"})),setTimeout(function(){u.tmp.events={resize:function(e){w2ui[u.name].resize()},resizeStart:a,mouseMove:o,mouseUp:r},D(window).on("resize",u.tmp.events.resize),u.resize()},0),(new Date).getTime()-t}function a(e,t){if(u.box){t=t||window.event,D(document).off("mousemove",u.tmp.events.mouseMove).on("mousemove",u.tmp.events.mouseMove),D(document).off("mouseup",u.tmp.events.mouseUp).on("mouseup",u.tmp.events.mouseUp),u.tmp.resize={type:e,x:t.screenX,y:t.screenY,diff_x:0,diff_y:0,value:0};for(var i=0;it.width&&(a=t.minSize-t.width),t.maxSize&&t.width+a>t.maxSize&&(a=t.maxSize-t.width),o.minSize+a>o.width&&(a=o.width-o.minSize);break;case"right":t.minSize+a>t.width&&(a=t.width-t.minSize),t.maxSize&&t.width-a>t.maxSize&&(a=t.width-t.maxSize),o.minSize-a>o.width&&(a=o.minSize-o.width);break;case"top":t.minSize-r>t.height&&(r=t.minSize-t.height),t.maxSize&&t.height+r>t.maxSize&&(r=t.maxSize-t.height),o.minSize+r>o.height&&(r=o.height-o.minSize);break;case"preview":case"bottom":t.minSize+r>t.height&&(r=t.height-t.minSize),t.maxSize&&t.height-r>t.maxSize&&(r=t.height-t.maxSize),o.minSize-r>o.height&&(r=o.minSize-o.height)}switch(i.diff_x=a,i.diff_y=r,i.type){case"top":case"preview":case"bottom":(i.diff_x=0) .w2ui-panel-content")[0],setTimeout(function(){0 .w2ui-panel-content").length&&(D(a+"> .w2ui-panel-content").removeClass().removeAttr("name").addClass("w2ui-panel-content").css("overflow",n.overflow)[0].style.cssText+=";"+n.style),n.content&&"function"==typeof n.content.render&&n.content.render()},1)):0 .w2ui-panel-content").length&&(D(a+"> .w2ui-panel-content").removeClass().removeAttr("name").addClass("w2ui-panel-content").html(n.content).css("overflow",n.overflow)[0].style.cssText+=";"+n.style),D(t.box).find(a+"> .w2ui-panel-tabs"));n.show.tabs?0===e.find("[name="+n.tabs.name+"]").length&&null!=n.tabs?e.w2render(n.tabs):n.tabs.refresh():e.html("").removeClass("w2ui-tabs").hide(),e=D(t.box).find(a+"> .w2ui-panel-toolbar"),n.show.toolbar?0===e.find("[name="+n.toolbar.name+"]").length&&null!=n.toolbar?e.w2render(n.toolbar):n.toolbar.refresh():e.html("").removeClass("w2ui-toolbar").hide(),e=D(t.box).find(a+"> .w2ui-panel-title"),n.title?e.html(n.title).show():e.html("").hide()}else{if(0===D("#layout_"+t.name+"_panel_main").length)return void t.render();t.resize();for(var r=0;r div").css({width:d+"px",height:u+"px"}),this),h=this.get("main"),p=this.get("preview"),f=this.get("left"),g=this.get("right"),m=this.get("top"),w=this.get("bottom"),v=null!=p&&!0!==p.hidden,y=null!=f&&!0!==f.hidden,b=null!=g&&!0!==g.hidden,x=null!=m&&!0!==m.hidden,_=null!=w&&!0!==w.hidden,k=0;kthis.padding?this.resizer:this.padding,D("#layout_"+this.name+"_resizer_top").show().css({display:"block",left:s+"px",top:n+"px",width:a+"px",height:r+"px",cursor:"ns-resize"}).off("mousedown").on("mousedown",function(e){var t=c.trigger({phase:"before",type:"resizerClick",target:"top",originalEvent:e});if(!0!==t.isCancelled)return w2ui[c.name].tmp.events.resizeStart("top",e),c.trigger(D.extend(t,{phase:"after"})),!1}))):(D("#layout_"+this.name+"_panel_top").hide(),D("#layout_"+this.name+"_resizer_top").hide()),null!=f&&!0!==f.hidden?(n=(s=0)+(x?m.sizeCalculated+this.padding:0),a=f.sizeCalculated,r=u-(x?m.sizeCalculated+this.padding:0)-(_?w.sizeCalculated+this.padding:0),o=D("#layout_"+this.name+"_panel_left"),-1!=window.navigator.userAgent.indexOf("MSIE")&&0this.padding?this.resizer:this.padding,D("#layout_"+this.name+"_resizer_left").show().css({display:"block",left:s+"px",top:n+"px",width:a+"px",height:r+"px",cursor:"ew-resize"}).off("mousedown").on("mousedown",function(e){var t=c.trigger({phase:"before",type:"resizerClick",target:"left",originalEvent:e});if(!0!==t.isCancelled)return w2ui[c.name].tmp.events.resizeStart("left",e),c.trigger(D.extend(t,{phase:"after"})),!1}))):(D("#layout_"+this.name+"_panel_left").hide(),D("#layout_"+this.name+"_resizer_left").hide()),null!=g&&!0!==g.hidden?(s=d-g.sizeCalculated,n=0+(x?m.sizeCalculated+this.padding:0),a=g.sizeCalculated,r=u-(x?m.sizeCalculated+this.padding:0)-(_?w.sizeCalculated+this.padding:0),D("#layout_"+this.name+"_panel_right").css({display:"block",left:s+"px",top:n+"px",width:a+"px",height:r+"px"}).show(),g.width=a,g.height=r,g.resizable&&(s-=this.padding,a=this.resizer>this.padding?this.resizer:this.padding,D("#layout_"+this.name+"_resizer_right").show().css({display:"block",left:s+"px",top:n+"px",width:a+"px",height:r+"px",cursor:"ew-resize"}).off("mousedown").on("mousedown",function(e){var t=c.trigger({phase:"before",type:"resizerClick",target:"right",originalEvent:e});if(!0!==t.isCancelled)return w2ui[c.name].tmp.events.resizeStart("right",e),c.trigger(D.extend(t,{phase:"after"})),!1}))):(D("#layout_"+this.name+"_panel_right").hide(),D("#layout_"+this.name+"_resizer_right").hide()),null!=w&&!0!==w.hidden?(s=0,n=u-w.sizeCalculated,a=d,r=w.sizeCalculated,D("#layout_"+this.name+"_panel_bottom").css({display:"block",left:s+"px",top:n+"px",width:a+"px",height:r+"px"}).show(),w.width=a,w.height=r,w.resizable&&(n-=0===this.padding?0:this.padding,r=this.resizer>this.padding?this.resizer:this.padding,D("#layout_"+this.name+"_resizer_bottom").show().css({display:"block",left:s+"px",top:n+"px",width:a+"px",height:r+"px",cursor:"ns-resize"}).off("mousedown").on("mousedown",function(e){var t=c.trigger({phase:"before",type:"resizerClick",target:"bottom",originalEvent:e});if(!0!==t.isCancelled)return w2ui[c.name].tmp.events.resizeStart("bottom",e),c.trigger(D.extend(t,{phase:"after"})),!1}))):(D("#layout_"+this.name+"_panel_bottom").hide(),D("#layout_"+this.name+"_resizer_bottom").hide()),s=0+(y?f.sizeCalculated+this.padding:0),n=0+(x?m.sizeCalculated+this.padding:0),a=d-(y?f.sizeCalculated+this.padding:0)-(b?g.sizeCalculated+this.padding:0),r=u-(x?m.sizeCalculated+this.padding:0)-(_?w.sizeCalculated+this.padding:0)-(v?p.sizeCalculated+this.padding:0),o=D("#layout_"+this.name+"_panel_main"),-1!=window.navigator.userAgent.indexOf("MSIE")&&0this.padding?this.resizer:this.padding,D("#layout_"+this.name+"_resizer_preview").show().css({display:"block",left:s+"px",top:n+"px",width:a+"px",height:r+"px",cursor:"ns-resize"}).off("mousedown").on("mousedown",function(e){var t=c.trigger({phase:"before",type:"resizerClick",target:"preview",originalEvent:e});if(!0!==t.isCancelled)return w2ui[c.name].tmp.events.resizeStart("preview",e),c.trigger(D.extend(t,{phase:"after"})),!1}))):(D("#layout_"+this.name+"_panel_preview").hide(),D("#layout_"+this.name+"_resizer_preview").hide());for(var C=0;C .w2ui-panel-",S=0;T&&(T.title&&(S+=w2utils.getSize(D($+"title").css({top:S+"px",display:"block"}),"height")),T.show.tabs&&(null!=T.tabs&&w2ui[this.name+"_"+z[C]+"_tabs"]&&w2ui[this.name+"_"+z[C]+"_tabs"].resize(),S+=w2utils.getSize(D($+"tabs").css({top:S+"px",display:"block"}),"height")),T.show.toolbar&&(null!=T.toolbar&&w2ui[this.name+"_"+z[C]+"_toolbar"]&&w2ui[this.name+"_"+z[C]+"_toolbar"].resize(),S+=w2utils.getSize(D($+"toolbar").css({top:S+"px",display:"block"}),"height"))),D($+"content").css({display:"block"}).css({top:S+"px"})}return clearTimeout(this._resize_timer),this._resize_timer=setTimeout(function(){for(var e in w2ui){var t;"function"==typeof w2ui[e].resize&&(null==w2ui[e].panels&&w2ui[e].resize(),0<(t=D(w2ui[e].box).parents(".w2ui-layout")).length&&t.attr("name")==c.name&&w2ui[e].resize())}},100),this.trigger(D.extend(i,{phase:"after"})),(new Date).getTime()-e}},destroy:function(){var e=this.trigger({phase:"before",type:"destroy",target:this.name});if(!0!==e.isCancelled)return null!=w2ui[this.name]&&(0Close'),t.showMax&&(r+='
Max
'),'
'),n=(u("body").append(a),u("#w2ui-popup")),a=(0'+r+'
');u("#w2ui-popup").html(a),t.title&&u("#w2ui-popup .w2ui-popup-title").append(t.title),t.buttons&&u("#w2ui-popup .w2ui-popup-buttons").append(t.buttons),t.body&&u("#w2ui-popup .w2ui-popup-body").append(t.body),setTimeout(function(){u("#w2ui-popup").css("opacity","1").css(w2utils.cssPrefix({transition:t.speed+"s opacity, "+t.speed+"s -webkit-transform",transform:"scale(1)"})),i.focus()},1),setTimeout(function(){u("#w2ui-popup").css(w2utils.cssPrefix("transform","")),w2popup.status="open",setTimeout(function(){i.trigger(u.extend(s,{phase:"after"}))},100)},1e3*t.speed)}else{if(null==w2popup._prev&&null!=w2popup._template&&i.restoreTemplate(),!0===(s=this.trigger({phase:"before",type:"open",target:"popup",options:t,present:!0})).isCancelled)return;w2popup.status="opening",null!=e&&(e.maximized||e.width==t.width&&e.height==t.height||w2popup.resize(t.width,t.height),t.prevSize=t.width+"px:"+t.height+"px",t.maximized=e.maximized);var n=u("#w2ui-popup .w2ui-box").clone(),o=(n.removeClass("w2ui-box").addClass("w2ui-box-temp").find(".w2ui-popup-body").empty().append(t.body),"string"==typeof t.body&&0Close':"")+(t.showMax?'
Max
':"")).append(t.title),u("#w2ui-popup .w2ui-popup-body").removeClass("w2ui-popup-no-title"),u("#w2ui-popup .w2ui-box, #w2ui-popup .w2ui-box-temp").css("top","")):(u("#w2ui-popup .w2ui-popup-title").hide().html(""),u("#w2ui-popup .w2ui-popup-body").addClass("w2ui-popup-no-title"),u("#w2ui-popup .w2ui-box, #w2ui-popup .w2ui-box-temp").css("top","0px")),u("#w2ui-popup .w2ui-box")[0]),l=u("#w2ui-popup .w2ui-box-temp")[0];w2utils.transition(o,l,t.transition,function(){i.restoreTemplate(),u(o).remove(),u(l).removeClass("w2ui-box-temp").addClass("w2ui-box");var e=u(l).find(".w2ui-popup-body");1==e.length&&(e[0].style.cssText=t.style),u("#w2ui-popup").data("prev-size",null),i.focus(),w2popup.status="open",i.trigger(u.extend(s,{phase:"after"}))})}t._last_focus=u(":focus"),t.keyboard&&u(document).on("keydown",this.keydown);var d={resizing:!1,mvMove:function(e){1==d.resizing&&(e=e||window.event,d.div_x=e.screenX-d.x,d.div_y=e.screenY-d.y,u("#w2ui-popup").css(w2utils.cssPrefix({transition:"none",transform:"translate3d("+d.div_x+"px, "+d.div_y+"px, 0px)"})))},mvStop:function(e){1==d.resizing&&(e=e||window.event,w2popup.status="open",d.div_x=e.screenX-d.x,d.div_y=e.screenY-d.y,u("#w2ui-popup").css({left:d.pos_x+d.div_x+"px",top:d.pos_y+d.div_y+"px"}).css(w2utils.cssPrefix({transition:"none",transform:"translate3d(0px, 0px, 0px)"})),d.resizing=!1,u(document).off("mousemove",d.mvMove),u(document).off("mouseup",d.mvStop),d.isLocked||w2popup.unlock())}};return u("#w2ui-popup .w2ui-popup-title").on("mousedown",function(e){w2popup.get().maximized||(e=(e=e)||window.event,w2popup.status="moving",d.resizing=!0,d.isLocked=1==u("#w2ui-popup > .w2ui-lock").length,d.x=e.screenX,d.y=e.screenY,d.pos_x=u("#w2ui-popup").position().left,d.pos_y=u("#w2ui-popup").position().top,d.isLocked||w2popup.lock({opacity:0}),u(document).on("mousemove",d.mvMove),u(document).on("mouseup",d.mvStop),e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,e.preventDefault&&e.preventDefault())}),this}setTimeout(function(){i.open.call(i,t)},100)},keydown:function(e){var t=u("#w2ui-popup").data("options");t&&!t.keyboard||!0!==(t=w2popup.trigger({phase:"before",type:"keydown",target:"popup",options:t,originalEvent:e})).isCancelled&&(27===e.keyCode&&(e.preventDefault(),0
':i.prefix="",r.addPrefix(),t=r.helpers.focus.find("input"),""===v(t).val()?(v(t).css("text-indent","-9999em").prev().css("opacity",0),v(r.el).val(o&&null!=o.text?w2utils.lang(o.text):"")):(v(t).css("text-indent",0).prev().css("opacity",1),v(r.el).val(""),setTimeout(function(){r.helpers.prefix&&r.helpers.prefix.hide();var e="position: absolute; opacity: 0; margin: 4px 0px 0px 2px; background-position: left !important;";i.icon?(v(t).css("margin-left","17px"),v(r.helpers.focus).find(".icon-search").attr("style",e+"width: 11px !important; opacity: 1; display: block")):(v(t).css("margin-left","0px"),v(r.helpers.focus).find(".icon-search").attr("style",e+"width: 0px !important; opacity: 0; display: none"))},1)),v(r.el).prop("readonly")||v(r.el).prop("disabled")?setTimeout(function(){v(r.helpers.prefix).css("opacity","0.6"),v(r.helpers.suffix).css("opacity","0.6")},1):setTimeout(function(){v(r.helpers.prefix).css("opacity","1"),v(r.helpers.suffix).css("opacity","1")},1))},1)),-1!=["enum","file"].indexOf(this.type)){var t="";if(o)for(var s=0;s  '):'
  
'+("enum"==r.type?n.text:n.name+' - '+w2utils.formatSize(n.size)+"");t+='
  • '+a+"
  • "}var l=r.helpers.multi,d=l.find("ul"),d=(l.attr("style",l.attr("style")+";"+i.style),v(r.el).css("z-index","-1"),v(r.el).prop("readonly")||v(r.el).prop("disabled")?setTimeout(function(){l[0].scrollTop=0,l.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(){l.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),l.find(".w2ui-enum-placeholder").remove(),d.find("li").not("li.nomouse").remove(),""!==t?d.prepend(t):null!=v(r.el).attr("placeholder")&&""===l.find("input").val()&&(d="padding-top: "+v(this.el).css("padding-top")+";padding-left: "+v(this.el).css("padding-left")+"; box-sizing: "+v(this.el).css("box-sizing")+"; line-height: "+v(this.el).css("line-height")+"; font-size: "+v(this.el).css("font-size")+"; font-family: "+v(this.el).css("font-family")+"; ",l.prepend('
    '+v(r.el).attr("placeholder")+"
    ")),l.off("scroll.w2field").on("scroll.w2field",function(e){e=r.trigger({phase:"before",type:"scroll",target:r.el,originalEvent:e});!0!==e.isCancelled&&r.trigger(v.extend(e,{phase:"after"}))}).find("li").data("mouse","out").on("click",function(e){var t,i,s,n="LI"==e.target.tagName.toUpperCase()?e.target:v(e.target).parents("LI"),a=o[v(n).attr("index")];v(n).hasClass("nomouse")||(e.stopPropagation(),v(e.target).hasClass("w2ui-list-remove")?v(r.el).prop("readonly")||v(r.el).prop("disabled")||!0!==(t=r.trigger({phase:"before",type:"remove",target:r.el,originalEvent:e.originalEvent,item:a})).isCancelled&&(v().w2overlay(),o.splice(v(e.target).attr("index"),1),v(r.el).trigger("change"),v(e.target).parent().fadeOut("fast"),setTimeout(function(){r.refresh(),r.trigger(v.extend(t,{phase:"after"}))},300)):!0!==(t=r.trigger({phase:"before",type:"click",target:r.el,originalEvent:e.originalEvent,item:a})).isCancelled&&("file"==r.type&&(e="",/image/i.test(a.type)&&(e='
    '),s='style="padding: 3px"',e+='
    "+w2utils.lang("Name")+":"+a.name+"
    "+w2utils.lang("Size")+":"+w2utils.formatSize(a.size)+"
    "+w2utils.lang("Type")+": '+a.type+"
    "+w2utils.lang("Modified")+":"+w2utils.date(a.modified)+"
    ",v("#w2ui-overlay").remove(),v(n).w2overlay(e)),r.trigger(v.extend(t,{phase:"after"}))))}).on("mouseover",function(e){var t="LI"==e.target.tagName.toUpperCase()?e.target:v(e.target).parents("LI");if(!v(t).hasClass("nomouse")){if("out"==v(t).data("mouse")){var i=o[v(e.target).attr("index")],e=r.trigger({phase:"before",type:"mouseOver",target:r.el,originalEvent:e.originalEvent,item:i});if(!0===e.isCancelled)return;r.trigger(v.extend(e,{phase:"after"}))}v(t).data("mouse","over")}}).on("mouseout",function(t){var i="LI"==t.target.tagName.toUpperCase()?t.target:v(t.target).parents("LI");v(i).hasClass("nomouse")||(v(i).data("mouse","leaving"),setTimeout(function(){var e;"leaving"==v(i).data("mouse")&&(v(i).data("mouse","out"),e=o[v(t.target).attr("index")],!0!==(e=r.trigger({phase:"before",type:"mouseOut",target:r.el,originalEvent:t.originalEvent,item:e})).isCancelled&&r.trigger(v.extend(e,{phase:"after"})))},0))}),v(this.el).height("auto"),v(l).find("> div.w2ui-multi-items").height()+2*w2utils.getSize(l,"+height")),u=((d=d<26?26:d)>i.maxHeight&&(d=i.maxHeight),0',s.addSuffix()),i&&s.addPrefix(),s.tmp.current_width=n)},clean:function(e){var t;return"number"!=typeof e&&(t=this.options,e=String(e).trim(),-1!=["int","float","money","currency","percent"].indexOf(this.type)&&("string"==typeof e&&(t.autoFormat&&-1!=["money","currency"].indexOf(this.type)&&(e=String(e).replace(t.moneyRE,"")),t.autoFormat&&"percent"==this.type&&(e=String(e).replace(t.percentRE,"")),e=(e=t.autoFormat&&-1!=["int","float"].indexOf(this.type)?String(e).replace(t.numberRE,""):e).replace(/\s+/g,"").replace(w2utils.settings.groupSymbol,"").replace(w2utils.settings.decimalSymbol,".")),parseFloat(e)==e&&(null!=t.min&&et.max&&(e=t.max,v(this.el).val(t.max))),e=""!==e&&w2utils.isFloat(e)?Number(e):"")),e},format:function(e){var t=this.options;if(t.autoFormat&&""!==e)switch(this.type){case"money":case"currency":""!==(e=w2utils.formatNumber(e,t.currencyPrecision,t.groupSymbol))&&(e=t.currencyPrefix+e+t.currencySuffix);break;case"percent":""!==(e=w2utils.formatNumber(e,t.precision,t.groupSymbol))&&(e+="%");break;case"float":e=w2utils.formatNumber(e,t.precision,t.groupSymbol);break;case"int":e=w2utils.formatNumber(e,0,t.groupSymbol)}return e},change:function(e){var t=this,i=t.options;if(-1!=["int","float","money","currency","percent"].indexOf(this.type)){var s=v(this.el).val(),n=this.format(this.clean(v(this.el).val()));if(""!==s&&s!=n)return v(this.el).val(n).change(),e.stopPropagation(),e.preventDefault(),!1}"color"==this.type&&(s="#"+v(this.el).val(),6!=v(this.el).val().length&&3!=v(this.el).val().length&&(s=""),v(this.el).next().find("div").css("background-color",s),v(t.el).is(":focus")&&this.updateOverlay()),-1!=["list","enum","file"].indexOf(this.type)&&(t.refresh(),setTimeout(function(){t.refresh()},5)),-1!=["date","time","datetime"].indexOf(this.type)&&(n=parseInt(t.el.value),w2utils.isInt(t.el.value)&&3e3=s.min||null==s.min?Number((r-o).toFixed(12)):s.min).change(),a=!0)}a&&(e.preventDefault(),setTimeout(function(){i.el.setSelectionRange(i.el.value.length,i.el.value.length)},0))}if("date"==i.type){if(!s.keyboard||v(i.el).prop("readonly")||v(i.el).prop("disabled"))return;var a=!1,l=864e5,o=1;switch((e.ctrlKey||e.metaKey)&&(o=10),(u=w2utils.isDate(v(i.el).val(),s.format,!0))||(u=new Date,l=0),n){case 38:e.shiftKey||(c=w2utils.formatDate(u.getTime()+l,s.format),10==o&&(c=w2utils.formatDate(new Date(u.getFullYear(),u.getMonth()+1,u.getDate()),s.format)),v(i.el).val(c).change(),a=!0);break;case 40:e.shiftKey||(c=w2utils.formatDate(u.getTime()-l,s.format),10==o&&(c=w2utils.formatDate(new Date(u.getFullYear(),u.getMonth()-1,u.getDate()),s.format)),v(i.el).val(c).change(),a=!0)}a&&(e.preventDefault(),setTimeout(function(){i.el.setSelectionRange(i.el.value.length,i.el.value.length),i.updateOverlay()},0))}if("time"==i.type){if(!s.keyboard||v(i.el).prop("readonly")||v(i.el).prop("disabled"))return;var a=!1,o=e.ctrlKey||e.metaKey?60:1,r=v(i.el).val(),d=i.toMin(r)||i.toMin((new Date).getHours()+":"+((new Date).getMinutes()-1));switch(n){case 38:e.shiftKey||(d+=o,a=!0);break;case 40:e.shiftKey||(d-=o,a=!0)}a&&(v(i.el).val(i.fromMin(d)).change(),e.preventDefault(),setTimeout(function(){i.el.setSelectionRange(i.el.value.length,i.el.value.length)},0))}if("datetime"==i.type){if(!s.keyboard||v(i.el).prop("readonly")||v(i.el).prop("disabled"))return;var u,c,a=!1,l=864e5,o=1,t=((e.ctrlKey||e.metaKey)&&(o=10),v(i.el).val());switch((u=w2utils.isDateTime(t,this.options.format,!0))||(u=new Date,l=0),n){case 38:e.shiftKey||(c=w2utils.formatDateTime(u.getTime()+l,s.format),10==o&&(c=w2utils.formatDateTime(new Date(u.getFullYear(),u.getMonth()+1,u.getDate()),s.format)),v(i.el).val(c).change(),a=!0);break;case 40:e.shiftKey||(c=w2utils.formatDateTime(u.getTime()-l,s.format),10==o&&(c=w2utils.formatDateTime(new Date(u.getFullYear(),u.getMonth()-1,u.getDate()),s.format)),v(i.el).val(c).change(),a=!0)}a&&(e.preventDefault(),setTimeout(function(){i.el.setSelectionRange(i.el.value.length,i.el.value.length),i.updateOverlay()},0))}if("color"==i.type){if(v(i.el).prop("readonly")||v(i.el).prop("disabled"))return;if(86==e.keyCode&&(e.ctrlKey||e.metaKey)&&(v(i.el).prop("maxlength",7),setTimeout(function(){var e=v(i).val();"#"==e.substr(0,1)&&(e=e.substr(1)),w2utils.isHex(e)||(e=""),v(i).val(e).prop("maxlength",6).change()},20)),(e.ctrlKey||e.metaKey)&&!e.shiftKey){var h=null;switch(n){case 38:h="up";break;case 40:h="down";break;case 39:h="right";break;case 37:h="left"}i.el.nav&&null!=h&&(t=i.el.nav(h),v(i.el).val(t).change(),e.preventDefault())}}if(-1!=["list","combo","enum"].indexOf(i.type)&&!v(i.el).prop("readonly")&&!v(i.el).prop("disabled")){var p=v(i.el).data("selected"),f=v(i.el),g=!1;switch(-1!=["list","enum"].indexOf(i.type)&&("list"==i.type&&(f=v(i.helpers.focus).find("input")),"enum"==i.type&&(f=v(i.helpers.multi).find("input")),-1==[37,38,39,40].indexOf(n)&&setTimeout(function(){i.refresh()},1),86==e.keyCode&&(e.ctrlKey||e.metaKey)&&setTimeout(function(){i.refresh(),i.search(),i.request()},50)),n){case 27:"list"==i.type&&(""!==f.val()&&f.val(""),e.stopPropagation());break;case 37:case 39:break;case 13:if(0!==v("#w2ui-overlay").length){var m=s.items[s.index];if("enum"==i.type){if(null!=m){if(!0===(w=i.trigger({phase:"before",type:"add",target:i.el,originalEvent:e.originalEvent,item:m})).isCancelled)return;m=w.item,p.length>=s.max&&0=s.max&&0=s.items.length&&(s.index=s.items.length-1),i.updateOverlay(g),e.preventDefault(),setTimeout(function(){var e;"enum"==i.type||"list"==i.type?(e=f.get(0)).setSelectionRange(e.value.length,e.value.length):i.el.setSelectionRange(i.el.value.length,i.el.value.length)},0)):"enum"==i.type&&f.width(8*(f.val().length+2)+"px")}},keyUp:function(e){var t,i;"color"==this.type&&86==e.keyCode&&(e.ctrlKey||e.metaKey)&&v(this).prop("maxlength",6),-1==["list","combo","enum"].indexOf(this.type)||v(this.el).prop("readonly")||v(this.el).prop("disabled")||-1==[16,17,18,20,37,39,91].indexOf(e.keyCode)&&(0===(t=v(this.helpers.focus).find("input")).length&&(t=v(this.el)),!0!==(i=this.trigger({phase:"before",type:"search",originalEvent:e,target:t,search:t.val()})).isCancelled&&(this.tmp.force_hide||this.request(),1==t.val().length&&this.refresh(),0!==v("#w2ui-overlay").length&&-1!=[38,40].indexOf(e.keyCode)||this.search(),this.trigger(v.extend(i,{phase:"after"}))))},clearCache:function(){this.options.items=[],this.tmp.xhr_loading=!1,this.tmp.xhr_search="",this.tmp.xhr_total=-1},request:function(e){var t,n=this,a=this.options,r=v(n.el).val()||"";a.url&&("enum"==n.type&&(r=0===(t=v(n.helpers.multi).find("input")).length?"":t.val()),"list"==n.type&&(t=v(n.helpers.focus).find("input"),r=0===t.length?"":t.val()),0!==a.minLength&&r.lengthn.tmp.xhr_search.length||r.length>=n.tmp.xhr_search.length&&r.substr(0,n.tmp.xhr_search.length)!=n.tmp.xhr_search||r.lengtha.cacheMax&&e.records.splice(a.cacheMax,1e5),null==a.recId&&null!=a.recid&&(a.recId=a.recid),(a.recId||a.recText)&&e.records.forEach(function(e){"string"==typeof a.recId&&(e.id=e[a.recId]),"function"==typeof a.recId&&(e.id=a.recId(e)),"string"==typeof a.recText&&(e.text=e[a.recText]),"function"==typeof a.recText&&(e.text=a.recText(e))}),n.tmp.xhr_loading=!1,n.tmp.xhr_search=r,n.tmp.xhr_total=e.records.length,a.items=n.normMenu(e.records),""===r&&0===e.records.length?n.tmp.emptySet=!0:n.tmp.emptySet=!1,n.search(),n.trigger(v.extend(i,{phase:"after"}))):console.log("ERROR: server did not return proper structure. It should return",{status:"success",records:[{id:1,text:"item"}]}))}).fail(function(e,t,i){var s,i={status:t,error:i,rawResponseText:e.responseText},i=n.trigger({phase:"before",type:"error",target:n.el,search:r,error:i,xhr:e});if(!0!==i.isCancelled){if("abort"!=t){try{s=v.parseJSON(e.responseText)}catch(e){}console.log("ERROR: Server communication failed.","\n EXPECTED:",{status:"success",records:[{id:1,text:"item"}]},"\n OR:",{status:"error",message:"error message"},"\n RECEIVED:","object"==typeof s?s:e.responseText)}n.clearCache(),n.search(),n.trigger(v.extend(i,{phase:"after"}))}}),n.trigger(v.extend(t,{phase:"after"})))},e))))},search:function(){var e=this,t=this.options,i=v(e.el).val(),s=e.el,n=[],a=v(e.el).data("selected");if("enum"==e.type)for(var r in s=v(e.helpers.multi).find("input"),i=s.val(),a)a[r]&&n.push(a[r].id);else if("list"==e.type)for(var r in s=v(e.helpers.focus).find("input"),i=s.val(),a)a[r]&&n.push(a[r].id);if(!0!==e.tmp.xhr_loading){for(var o=0,l=0;l',{css:{"background-color":"#f5f5f5"}}),(o=w2utils.isDate(v(n.el).val(),n.options.format,!0))&&(t=o.getMonth()+1,s=o.getFullYear()),!function i(e,t){v("#w2ui-overlay > div > div").html(n.getMonthHTML(e,t,v(n.el).val())),v("#w2ui-overlay .w2ui-calendar-title").on("mousedown",function(){var e,t;v(this).next().hasClass("w2ui-calendar-jump")?v(this).next().remove():(v(this).after('
    '),v(this).next().hide().html(n.getYearHTML()).fadeIn(200),setTimeout(function(){v("#w2ui-overlay .w2ui-calendar-jump").find(".w2ui-jump-month, .w2ui-jump-year").on("click",function(){v(this).hasClass("w2ui-jump-month")&&(v(this).parent().find(".w2ui-jump-month").removeClass("selected"),v(this).addClass("selected"),t=v(this).attr("name")),v(this).hasClass("w2ui-jump-year")&&(v(this).parent().find(".w2ui-jump-year").removeClass("selected"),v(this).addClass("selected"),e=v(this).attr("name")),null!=e&&null!=t&&(v("#w2ui-overlay .w2ui-calendar-jump").fadeOut(100),setTimeout(function(){i(parseInt(t)+1,e)},100))}),v("#w2ui-overlay .w2ui-calendar-jump >:last-child").prop("scrollTop",2e3)},1))}),v("#w2ui-overlay .w2ui-date").on("mousedown",function(){var e=v(this).attr("date");v(n.el).val(e).change(),v(this).css({"background-color":"#B6D5FB","border-color":"#aaa"})}).on("mouseup",function(){setTimeout(function(){0',{css:{"background-color":"#fff"}});var r="h24"==this.options.format;v("#w2ui-overlay > div").html(n.getHourHTML()),v("#w2ui-overlay .w2ui-time").on("mousedown",function(e){v(this).css({"background-color":"#B6D5FB","border-color":"#aaa"});var t=v(this).attr("hour");v(n.el).val((12',{css:{"background-color":"#fff"}}),v("#w2ui-overlay > div").html(n.getMinHTML(t)),v("#w2ui-overlay .w2ui-time").on("mousedown",function(){v(this).css({"background-color":"#B6D5FB","border-color":"#aaa"});var e=v(this).attr("min");v(n.el).val((12',{css:{"background-color":"#f5f5f5"}});(o=w2utils.isDateTime(v(n.el).val(),n.options.format,!0))&&(t=o.getMonth()+1,s=o.getFullYear());var o,l=null;!function i(e,t){v("#w2ui-overlay > div > div").html(n.getMonthHTML(e,t,v(n.el).val())+(a.btn_now?'
    '+w2utils.lang("Current Date & Time")+"
    ":"")),v("#w2ui-overlay .w2ui-calendar-title").on("mousedown",function(){var e,t;v(this).next().hasClass("w2ui-calendar-jump")?v(this).next().remove():(v(this).after('
    '),v(this).next().hide().html(n.getYearHTML()).fadeIn(200),setTimeout(function(){v("#w2ui-overlay .w2ui-calendar-jump").find(".w2ui-jump-month, .w2ui-jump-year").on("click",function(){v(this).hasClass("w2ui-jump-month")&&(v(this).parent().find(".w2ui-jump-month").removeClass("selected"),v(this).addClass("selected"),t=v(this).attr("name")),v(this).hasClass("w2ui-jump-year")&&(v(this).parent().find(".w2ui-jump-year").removeClass("selected"),v(this).addClass("selected"),e=v(this).attr("name")),null!=e&&null!=t&&(v("#w2ui-overlay .w2ui-calendar-jump").fadeOut(100),setTimeout(function(){i(parseInt(t)+1,e)},100))}),v("#w2ui-overlay .w2ui-calendar-jump >:last-child").prop("scrollTop",2e3)},1))}),v("#w2ui-overlay .w2ui-date").on("mousedown",function(){var e=v(this).attr("date");v(n.el).val(e).change(),v(this).css({"background-color":"#B6D5FB","border-color":"#aaa"}),l=new Date(v(this).attr("data-date"))}).on("mouseup",function(){var i,t;0',{css:{"background-color":"#fff"}}),n.options.format;v("#w2ui-overlay > div").html(n.getHourHTML()),v("#w2ui-overlay .w2ui-time").on("mousedown",function(e){v(this).css({"background-color":"#B6D5FB","border-color":"#aaa"}),i=v(this).attr("hour"),l.setHours(i);var t=w2utils.formatDateTime(l,n.options.format);v(n.el).val(t).change()}),null==n.options.noMinutes||!1===n.options.noMinutes?v("#w2ui-overlay .w2ui-time").on("mouseup",function(){var e=v(this).attr("hour");0',{css:{"background-color":"#fff"}}),v("#w2ui-overlay > div").html(n.getMinHTML(e)),v("#w2ui-overlay .w2ui-time").on("mousedown",function(){v(this).css({"background-color":"#B6D5FB","border-color":"#aaa"}),t=v(this).attr("min"),l.setHours(i,t);var e=w2utils.formatDateTime(l,n.options.format);v(n.el).val(e).change()}).on("mouseup",function(){setTimeout(function(){0=a.max&&0'+i.options.prefix+""),(e=v(i.el).prev()).css({color:v(i.el).css("color"),"font-family":v(i.el).css("font-family"),"font-size":v(i.el).css("font-size"),"padding-top":v(i.el).css("padding-top"),"padding-bottom":v(i.el).css("padding-bottom"),"padding-left":v(i.el).css("padding-left"),"padding-right":0,"margin-top":parseInt(v(i.el).css("margin-top"),10)+2+"px","margin-bottom":parseInt(v(i.el).css("margin-bottom"),10)+1+"px","margin-left":v(i.el).css("margin-left"),"margin-right":0}).on("click",function(e){var t;i.options.icon&&"function"==typeof i.onIconClick?!0!==(t=i.trigger({phase:"before",type:"iconClick",target:i.el,el:v(this).find("span.w2ui-icon")[0]})).isCancelled&&i.trigger(v.extend(t,{phase:"after"})):("list"==i.type?v(i.helpers.focus).find("input"):v(i.el)).focus()}),v(i.el).css("padding-left",e.width()+parseInt(v(i.el).css("padding-left"),10)+"px"),i.helpers.prefix=e))},1)},addSuffix:function(){var t,i,n=this;setTimeout(function(){var e;"clear"!==n.type&&((e=v(n.el).data("tmp")||{})["old-padding-right"]&&v(n.el).css("padding-right",e["old-padding-right"]),e["old-padding-right"]=v(n.el).css("padding-right"),v(n.el).data("tmp",e),i=parseInt(v(n.el).css("padding-right"),10),n.options.arrows&&(n.helpers.arrows&&v(n.helpers.arrows).remove(),v(n.el).after('
     
    '),w2utils.getSize(n.el,"height"),(t=v(n.el).next()).css({color:v(n.el).css("color"),"font-family":v(n.el).css("font-family"),"font-size":v(n.el).css("font-size"),height:v(n.el).height()+parseInt(v(n.el).css("padding-top"),10)+parseInt(v(n.el).css("padding-bottom"),10)+"px",padding:0,"margin-top":parseInt(v(n.el).css("margin-top"),10)+1+"px","margin-bottom":0,"border-left":"1px solid silver"}).css("margin-left","-"+(t.width()+parseInt(v(n.el).css("margin-right"),10)+12)+"px").on("mousedown",function(t){var i=v("body");function s(e){v(n.el).focus(),n.keyDown(v.Event("keydown"),{keyCode:"up"==v(t.target).attr("type")?38:40}),!1!==e&&v("body").data("_field_update_timer",setTimeout(s,60))}i.on("mouseup",function e(){clearTimeout(i.data("_field_update_timer"));i.off("mouseup",e)}),i.data("_field_update_timer",setTimeout(s,700)),s(!1)}),i+=t.width()+12,v(n.el).css("padding-right",i+"px"),n.helpers.arrows=t),""!==n.options.suffix&&(n.helpers.suffix&&v(n.helpers.suffix).remove(),v(n.el).after('
    '+n.options.suffix+"
    "),(t=v(n.el).next()).css({color:v(n.el).css("color"),"font-family":v(n.el).css("font-family"),"font-size":v(n.el).css("font-size"),"padding-top":v(n.el).css("padding-top"),"padding-bottom":v(n.el).css("padding-bottom"),"padding-left":"3px","padding-right":v(n.el).css("padding-right"),"margin-top":parseInt(v(n.el).css("margin-top"),10)+2+"px","margin-bottom":parseInt(v(n.el).css("margin-bottom"),10)+1+"px"}).on("click",function(e){("list"==n.type?v(n.helpers.focus).find("input"):v(n.el)).focus()}),t.css("margin-left","-"+(w2utils.getSize(t,"width")+parseInt(v(n.el).css("margin-right"),10)+2)+"px"),i+=t.width()+3,v(n.el).css("padding-right",i+"px"),n.helpers.suffix=t))},1)},addFocus:function(){var i,s=this,e=(this.options,v(s.helpers.focus).remove(),v(s.el).attr("tabIndex")),e=(e&&-1!=e&&(s.el._tabIndex=e),'
    '),e=(v(s.el).attr("tabindex",-1).before(e),v(s.el).prev());(s.helpers.focus=e).css({width:v(s.el).width(),"margin-top":v(s.el).css("margin-top"),"margin-left":parseInt(v(s.el).css("margin-left"))+parseInt(v(s.el).css("padding-left"))+"px","margin-bottom":v(s.el).css("margin-bottom"),"margin-right":v(s.el).css("margin-right")}).find("input").css({cursor:"default",width:"100%",outline:"none",opacity:1,margin:0,border:"1px solid transparent",padding:v(s.el).css("padding-top"),"padding-left":0,"margin-left":0,"background-color":"transparent"}),e.find("input").on("click",function(e){0===v("#w2ui-overlay").length&&s.focus(e),e.stopPropagation()}).on("focus",function(e){i=v(s.el).attr("placeholder"),v(s.el).css({outline:"auto 5px #7DB4F3","outline-offset":"-2px"}),v(this).val(""),v(s.el).triggerHandler("focus"),e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}).on("blur",function(e){v(s.el).css("outline","none"),v(this).val(""),s.refresh(),v(s.el).triggerHandler("blur"),e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,null!=i&&v(s.el).attr("placeholder",i)}).on("keydown",function(e){var t=this;s.keyDown(e),setTimeout(function(){""===t.value?v(s.el).attr("placeholder",i):v(s.el).attr("placeholder","")},10)}).on("keyup",function(e){s.keyUp(e)}).on("keypress",function(e){s.keyPress(e)}),e.on("click",function(e){v(this).find("input").focus()}),s.refresh()},addMulti:function(){var n=this,e=(this.options,v(n.helpers.multi).remove(),""),t="margin-top : 0px; margin-bottom : 0px; margin-left : "+v(n.el).css("margin-left")+"; margin-right : "+v(n.el).css("margin-right")+"; width : "+(w2utils.getSize(n.el,"width")-parseInt(v(n.el).css("margin-left"),10)-parseInt(v(n.el).css("margin-right"),10))+"px;",i=("enum"==n.type&&((i=v(n.el).attr("tabIndex"))&&-1!=i&&(n.el._tabIndex=i),null==(i=n.el._tabIndex?n.el._tabIndex:i)&&(i=-1),e='
    '),"file"==n.type&&(e='
    '),v(n.el).data("tmp")||{}),a=(i["old-background-color"]=v(n.el).css("background-color"),i["old-border-color"]=v(n.el).css("border-color"),v(n.el).data("tmp",i),v(n.el).before(e).css({"background-color":"transparent","border-color":"transparent"}),v(n.el).prev());n.helpers.multi=a,"enum"==n.type&&(v(n.el).attr("tabindex",-1),a.find("input").on("click",function(e){0===v("#w2ui-overlay").length&&n.focus(e),v(n.el).triggerHandler("click")}).on("focus",function(e){v(a).css({outline:"auto 5px #7DB4F3","outline-offset":"-2px"}),v(n.el).triggerHandler("focus"),e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}).on("blur",function(e){v(a).css("outline","none"),v(n.el).triggerHandler("blur"),e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}).on("keyup",function(e){n.keyUp(e)}).on("keydown",function(e){n.keyDown(e)}).on("keypress",function(e){n.keyPress(e)}),a.on("click",function(e){v(this).find("input").focus()})),"file"==n.type&&(v(n.el).css("outline","none"),a.on("click",function(e){v(n.el).focus(),v(n.el).prop("readonly")||v(n.el).prop("disabled")||(n.blur(e),n.resize(),setTimeout(function(){a.find("input").click()},10))}).on("dragenter",function(e){v(n.el).prop("readonly")||v(n.el).prop("disabled")||v(a).addClass("w2ui-file-dragover")}).on("dragleave",function(e){v(n.el).prop("readonly")||v(n.el).prop("disabled")||0===v(e.target).parents(".w2ui-field-helper").length&&v(a).removeClass("w2ui-file-dragover")}).on("drop",function(e){if(!v(n.el).prop("readonly")&&!v(n.el).prop("disabled")){v(a).removeClass("w2ui-file-dragover");for(var t=e.originalEvent.dataTransfer.files,i=0,s=t.length;it.maxFileSize?(l="Maximum file size is "+w2utils.formatSize(t.maxFileSize),!1===t.silent&&v(i.el).w2tag(l),console.log("ERROR: "+l)):0!==t.maxSize&&a+n.size>t.maxSize?(l="Maximum total size is "+w2utils.formatSize(t.maxSize),!1===t.silent&&v(i.el).w2tag(l),console.log("ERROR: "+l)):0!==t.max&&r>=t.max?(l="Maximum number of files is "+t.max,!1===t.silent&&v(i.el).w2tag(l),console.log("ERROR: "+l)):(s.push(n),"undefined"!=typeof FileReader&&!0===t.readContent?((l=new FileReader).onload=function(e){var e=e.target.result,t=e.indexOf(",");n.content=e.substr(t+1),i.refresh(),v(i.el).trigger("change"),i.trigger(v.extend(d,{phase:"after"}))},l.readAsDataURL(e)):(i.refresh(),v(i.el).trigger("change"))))},normMenu:function(e){if(v.isArray(e)){for(var t=0;t'+l[h]+"";var p='
    '+n[e-1]+", "+t+'
    '+c+"",f=1;"M"!=w2utils.settings.weekStarts&&u++,"datetime"===this.type&&(s=w2utils.isDateTime(i,d.format,!0),i=w2utils.formatDate(s,w2utils.settings.dateFormat));for(var g=1;g<43;g++){if(0===u&&1==g){for(var m=0;m<6;m++)p+='';g+=6}else if(g ',g%7==0&&(p+="");continue}var w,v,y=t+"/"+e+"/"+f,b=new Date(y),x="",_=(6===b.getDay()&&(x=" w2ui-saturday"),0===b.getDay()&&(x=" w2ui-sunday"),y==r&&(x+=" w2ui-today"),f),k="",C="",y="datetime"===this.type?(w=w2utils.formatDateTime(y,d.format),w2utils.formatDate(y,w2utils.settings.dateFormat)):w=w2utils.formatDate(y,d.format);d.colored&&void 0!==d.colored[y]&&(C="background-color: "+(v=d.colored[y].split(":"))[0]+";",k="color: "+v[1]+";"),p+='",(g%7==0||0===u&&1==g)&&(p+=""),f++}return p+="
     
    '+_+"
    "},getYearHTML:function(){for(var e=w2utils.settings.shortmonths,t=w2utils.settings.dateStartYear,i=w2utils.settings.dateEndYear,s="",n="",a=0;a'+e[a]+"";for(var r=t;r<=i;r++)n+='
    '+r+"
    ";return"
    "+s+"
    "+n+"
    "},getHourHTML:function(){for(var e=[],t=this.options,i=-1<(t=null==t?{format:w2utils.settings.timeFormat}:t).format.indexOf("h24"),s=0;s<24;s++){var n,a,r=12!=s||i?(12<=s&&!i?s-12:s)+":00"+(i?"":s<12?" am":" pm"):"12:00 pm",o=(e[Math.floor(s/8)]||(e[Math.floor(s/8)]=""),this.fromMin(this.toMin(r))),l=this.fromMin(this.toMin(r)+59);"datetime"===this.type&&(n=w2utils.isDateTime(this.el.value,t.format,!0),a=t.format.split("|")[0].trim(),o=w2utils.formatDate(n,a)+" "+o,l=w2utils.formatDate(n,a)+" "+l),e[Math.floor(s/8)]+='
    '+r+"
    "}return'
    '+w2utils.lang("Select Hour")+'
    '+e[0]+" "+e[1]+" "+e[2]+"
    "},getMinHTML:function(e){null==e&&(e=0);for(var t=this.options,i=-1<(t=null==t?{format:w2utils.settings.timeFormat}:t).format.indexOf("h24"),s=[],n=0;n<60;n+=5){var a,r,o=(12'+o+""}return'
    '+w2utils.lang("Select Minute")+'
    '+s[0]+" "+s[1]+" "+s[2]+"
    "},toMin:function(e){var t;return"string"!=typeof e||2!==(t=e.split(":")).length?null:(t[0]=parseInt(t[0]),t[1]=parseInt(t[1]),-1!=e.indexOf("pm")&&12!=t[0]&&(t[0]+=12),60*t[0]+t[1])},fromMin:function(e){1440<=e&&(e%=1440),e<0&&(e=1440+e);var t=Math.floor(e/60),e=(e%60<10?"0":"")+e%60,i=this.options;return-1!=(i=null==i?{format:w2utils.settings.timeFormat}:i).format.indexOf("h24")?t+":"+e:(t<=12?t:t-12)+":"+e+" "+(12<=t?"pm":"am")}},w2utils.event),w2obj.field=n}(jQuery),!function($){var w2form=function(e){this.name=null,this.header="",this.box=null,this.url="",this.routeData={},this.formURL="",this.formHTML="",this.page=0,this.recid=0,this.fields=[],this.actions={},this.record={},this.original={},this.postData={},this.httpHeaders={},this.method=null,this.toolbar={},this.tabs={},this.style="",this.focus=0,this.isGenerated=!1,this.last={xhr:null},$.extend(!0,this,w2obj.form,e)};$.fn.w2form=function(e){if(!$.isPlainObject(e))return(t=w2ui[$(this).attr("name")])?0'+o.formHTML+""),$(o.box).html(o.formHTML),o.isGenerated=!0,o.render(o.box)),o}},w2form.prototype={onRequest:null,onLoad:null,onValidate:null,onSubmit:null,onProgress:null,onSave:null,onChange:null,onRender:null,onRefresh:null,onResize:null,onDestroy:null,onAction:null,onToolbar:null,onError:null,msgNotJSON:"Returned data is not in valid JSON format.",msgAJAXerror:"AJAX error. See console for more details.",msgRefresh:"Refreshing...",msgSaving:"Saving...",get:function(e,t){if(0===arguments.length){for(var i=[],s=0;s'+e+"",buttons:'",onOpen:function(e){setTimeout(function(){$(e.box).find(".w2ui-btn").focus()},25)}}),w2utils.message.call(this,{box:this.box,path:"w2ui."+this.name,title:".w2ui-form-header:visible",body:".w2ui-form-box"},e)},validate:function(e){null==e&&(e=!0),$().w2tag();for(var t=[],i=0;i'),setTimeout(function(){var params={cmd:"save"},edata=(params.recid=obj.recid,params.name=obj.name,$.extend(params,obj.postData),$.extend(params,postData),obj.fields.forEach(function(e){"file"==e.type&&Array.isArray(obj.record[e.field])&&obj.record[e.field].forEach(function(e){delete e.file})}),params.record=$.extend(!0,{},obj.record),obj.trigger({phase:"before",type:"submit",target:obj.name,url:obj.url,postData:params,httpHeaders:obj.httpHeaders}));if(!0!==edata.isCancelled){var url=edata.url;if("object"==typeof edata.url&&edata.url.save&&(url=edata.url.save),obj.last.xhr)try{obj.last.xhr.abort()}catch(e){}if(!$.isEmptyObject(obj.routeData)){var info=w2utils.parseRoute(url);if(0');switch(r.type){case"pass":case"password":o='';break;case"checkbox":o='';break;case"radio":var o="",l=r.options.items||r.html.items;0<(l=$.isArray(l)?l:[]).length&&(l=w2obj.field.prototype.normMenu(l));for(var d=0;d '+l[d].text+"
    ";break;case"select":o='";break;case"textarea":o='';break;case"toggle":o='
    ';break;case"html":case"custom":case"empty":o=""}""!==s&&(e!=r.html.page||t!=r.html.column||r.html.group&&s!=r.html.group)&&(i[e][t]+="\n ",s=""),r.html.group&&s!=r.html.group&&(a+='\n
    '+r.html.group+'
    \n
    ',s=r.html.group),a+='\n
    \n \n
    "+o+w2utils.lang(r.html.text)+"
    \n
    ",null==i[r.html.page]&&(i[r.html.page]=[]),null==i[r.html.page][r.html.column]&&(i[r.html.page][r.html.column]=""),i[r.html.page][r.html.column]+=a,e=r.html.page,t=r.html.column}if(""!==s&&(i[e][t]+="\n
    "),this.tabs.tabs)for(d=0;d'+w2utils.lang(p.caption)+""}u+="\n"}a="";for(var f=0;f
    ';for(var g=0;g'+(i[f][g]||"")+"\n
    ";a+="\n"}return a+=u},action:function(e,t){var i=this.actions[e],s=i,i=($.isPlainObject(i)&&i.onClick&&(s=i.onClick),this.trigger({phase:"before",target:e,type:"action",click:s,originalEvent:t}));!0!==i.isCancelled&&("function"==typeof s&&s.call(this,t),this.trigger($.extend(i,{phase:"after"})))},resize:function(){var e,t,i,s,n,a,r,o,l=this,d=this.trigger({phase:"before",target:this.name,type:"resize"});function u(){e.width($(l.box).width()).height($(l.box).height()),i.css("top",""!==l.header?w2utils.getSize(t,"height"):0),s.css("top",(""!==l.header?w2utils.getSize(t,"height"):0)+("object"==typeof l.toolbar&&$.isArray(l.toolbar.items)&&0 div.w2ui-form-box"),t=$(this.box).find("> div .w2ui-form-header"),i=$(this.box).find("> div .w2ui-form-toolbar"),s=$(this.box).find("> div .w2ui-form-tabs"),n=$(this.box).find("> div .w2ui-page"),a=$(this.box).find("> div .w2ui-page.page-"+this.page),r=$(this.box).find("> div .w2ui-page.page-"+this.page+" > div"),o=$(this.box).find("> div .w2ui-buttons"),u(),0!==parseInt($(this.box).height())&&!0!==$(this.box).data("auto-size")||($(this.box).height((0'+d[h].text+" *").length&&$(p[u]).wrapInner("
    ");return this.trigger($.extend(n,{phase:"after"})),this.resize(),(new Date).getTime()-t}}},render:function(e){var t=(new Date).getTime(),i=this;if("object"==typeof e&&(0<$(this.box).find("#form_"+this.name+"_tabs").length&&$(this.box).removeAttr("name").removeClass("w2ui-reset w2ui-form").html(""),this.box=e),this.isGenerated&&this.box){var s,e=this.trigger({phase:"before",target:this.name,type:"render",box:null!=e?e:this.box});if(!0!==e.isCancelled)return $.isEmptyObject(this.original)&&!$.isEmptyObject(this.record)&&(this.original=$.extend(!0,{},this.record)),s='
    '+(""!==this.header?'
    '+this.header+"
    ":"")+' '+this.formHTML+"
    ",$(this.box).attr("name",this.name).addClass("w2ui-reset w2ui-form").html(s),0<$(this.box).length&&($(this.box)[0].style.cssText+=this.style),"function"!=typeof this.toolbar.render&&(this.toolbar=$().w2toolbar($.extend({},this.toolbar,{name:this.name+"_toolbar",owner:this})),this.toolbar.on("click",function(e){e=i.trigger({phase:"before",type:"toolbar",target:e.target,originalEvent:e});!0!==e.isCancelled&&i.trigger($.extend(e,{phase:"after"}))})),"object"==typeof this.toolbar&&"function"==typeof this.toolbar.render&&this.toolbar.render($("#form_"+this.name+"_toolbar")[0]),"function"!=typeof this.tabs.render&&(this.tabs=$().w2tabs($.extend({},this.tabs,{name:this.name+"_tabs",owner:this,active:this.tabs.active})),this.tabs.on("click",function(e){i.goto(this.get(e.target,!0))})),"object"==typeof this.tabs&&"function"==typeof this.tabs.render&&(this.tabs.render($("#form_"+this.name+"_tabs")[0]),this.tabs.active&&this.tabs.click(this.tabs.active)),this.trigger($.extend(e,{phase:"after"})),this.resize(),("object"!=typeof this.url?this.url:this.url.get)&&0!==this.recid&&null!=this.recid?this.request():this.refresh(),0===$(".w2ui-layout").length&&(this.tmp_resize=function(e){w2ui[i.name].resize()},$(window).off("resize","body").on("resize","body",this.tmp_resize)),0<=this.focus&&setTimeout(function(){0===$(i.box).find("input, select, textarea").length?setTimeout(n,500):n()},10),(new Date).getTime()-t}function n(){var e=$(i.box).find("div:not(.w2ui-field-helper) > input, select, textarea, div > label:nth-child(1) > :radio").not(".file-input");e.length>i.focus&&e[i.focus].focus()}},destroy:function(){var e=this.trigger({phase:"before",target:this.name,type:"destroy"});!0!==e.isCancelled&&("object"==typeof this.toolbar&&this.toolbar.destroy&&this.toolbar.destroy(),"object"==typeof this.tabs&&this.tabs.destroy&&this.tabs.destroy(),0<$(this.box).find("#form_"+this.name+"_tabs").length&&$(this.box).removeAttr("name").removeClass("w2ui-reset w2ui-form").html(""),delete w2ui[this.name],this.trigger($.extend(e,{phase:"after"})),$(window).off("resize","body"))}},$.extend(w2form.prototype,w2utils.event),w2obj.form=w2form}(jQuery);