/* w2ui-fields 1.0 (part of w2ui 1.4+) (c) http://w2ui.com, vitmalina@gmail.com */ var w2ui=w2ui||{};var w2obj=w2obj||{};var w2utils=function(){var tmp={};var obj={settings:{locale:"en-us",date_format:"m/d/yyyy",date_display:"Mon d, yyyy",time_format:"h12",currency:"^[$€£¥]?[-]?[0-9]*[.]?[0-9]+$",currencyPrefix:"$",currencySuffix:"",groupSymbol:",","float":"^[-]?[0-9]*[.]?[0-9]+$",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"],RESTfull:false,phrases:{}},isInt:isInt,isFloat:isFloat,isMoney:isMoney,isHex:isHex,isAlphaNumeric:isAlphaNumeric,isEmail:isEmail,isDate:isDate,isTime:isTime,age:age,date:date,size:size,formatNumber:formatNumber,formatDate:formatDate,formatTime:formatTime,formatDateTime:formatDateTime,stripTags:stripTags,encodeTags:encodeTags,escapeId:escapeId,base64encode:base64encode,base64decode:base64decode,transition:transition,lock:lock,unlock:unlock,lang:lang,locale:locale,getSize:getSize,scrollBarSize:scrollBarSize};return obj;function isInt(val){var re=/^[-]?[0-9]+$/;return re.test(val)}function isFloat(val){var re=new RegExp(w2utils.settings["float"]);return re.test(val)}function isMoney(val){var re=new RegExp(w2utils.settings.currency);return re.test(val)}function isHex(val){var re=/^[a-fA-F0-9]+$/;return re.test(val)}function isAlphaNumeric(val){var re=/^[a-zA-Z0-9_-]+$/;return re.test(val)}function isEmail(val){var email=/^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return email.test(val)}function isDate(val,format,retDate){if(!val)return false;if(!format)format=w2utils.settings.date_format;var tmp=val.replace(/-/g,"/").replace(/\./g,"/").toLowerCase().split("/");var tmp2=format.replace(/-/g,"/").replace(/\./g,"/").toLowerCase();var dt="Invalid Date";var month,day,year;if(tmp2=="mm/dd/yyyy"){month=tmp[0];day=tmp[1];year=tmp[2]}if(tmp2=="m/d/yyyy"){month=tmp[0];day=tmp[1];year=tmp[2]}if(tmp2=="dd/mm/yyyy"){month=tmp[1];day=tmp[0];year=tmp[2]}if(tmp2=="d/m/yyyy"){month=tmp[1];day=tmp[0];year=tmp[2]}if(tmp2=="yyyy/dd/mm"){month=tmp[2];day=tmp[1];year=tmp[0]}if(tmp2=="yyyy/d/m"){month=tmp[2];day=tmp[1];year=tmp[0]}if(tmp2=="yyyy/mm/dd"){month=tmp[1];day=tmp[2];year=tmp[0]}if(tmp2=="yyyy/m/d"){month=tmp[1];day=tmp[2];year=tmp[0]}if(tmp2=="mm/dd/yy"){month=tmp[0];day=tmp[1];year=tmp[2]}if(tmp2=="m/d/yy"){month=tmp[0];day=tmp[1];year=parseInt(tmp[2])+1900}if(tmp2=="dd/mm/yy"){month=tmp[1];day=tmp[0];year=parseInt(tmp[2])+1900}if(tmp2=="d/m/yy"){month=tmp[1];day=tmp[0];year=parseInt(tmp[2])+1900}if(tmp2=="yy/dd/mm"){month=tmp[2];day=tmp[1];year=parseInt(tmp[0])+1900}if(tmp2=="yy/d/m"){month=tmp[2];day=tmp[1];year=parseInt(tmp[0])+1900}if(tmp2=="yy/mm/dd"){month=tmp[1];day=tmp[2];year=parseInt(tmp[0])+1900}if(tmp2=="yy/m/d"){month=tmp[1];day=tmp[2];year=parseInt(tmp[0])+1900}dt=new Date(month+"/"+day+"/"+year);if(typeof month=="undefined")return false;if(dt=="Invalid Date")return false;if(dt.getMonth()+1!=month||dt.getDate()!=day||dt.getFullYear()!=year)return false;if(retDate===true)return dt;else return true}function isTime(val){if(String(val)=="undefined")return false;var max;val=val.toUpperCase();if(val.indexOf("PM")>=0||val.indexOf("AM")>=0)max=12;else max=23;val=$.trim(val.replace("AM",""));val=$.trim(val.replace("PM",""));var tmp=val.split(":");if(tmp.length!=2){return false}if(tmp[0]==""||parseInt(tmp[0])<0||parseInt(tmp[0])>max||!this.isInt(tmp[0])){return false}if(tmp[1]==""||parseInt(tmp[1])<0||parseInt(tmp[1])>59||!this.isInt(tmp[1])){return false}return true}function age(dateStr){if(dateStr==""||typeof dateStr=="undefined"||dateStr==null)return"";var d1=new Date(dateStr);if(w2utils.isInt(dateStr))d1=new Date(Number(dateStr));if(d1=="Invalid Date")return"";var d2=new Date;var sec=(d2.getTime()-d1.getTime())/1e3;var amount="";var type="";if(sec<60){amount=Math.floor(sec);type="sec";if(sec<0){amount=0;type="sec"}}else if(sec<60*60){amount=Math.floor(sec/60);type="min"}else if(sec<24*60*60){amount=Math.floor(sec/60/60);type="hour"}else if(sec<30*24*60*60){amount=Math.floor(sec/24/60/60);type="day"}else if(sec<12*30*24*60*60){amount=Math.floor(sec/30/24/60/60*10)/10;type="month"}else if(sec>=12*30*24*60*60){amount=Math.floor(sec/12/30/24/60/60*10)/10;type="year"}return amount+" "+type+(amount>1?"s":"")}function date(dateStr){if(dateStr==""||typeof dateStr=="undefined"||dateStr==null)return"";var d1=new Date(dateStr);if(w2utils.isInt(dateStr))d1=new Date(Number(dateStr));if(d1=="Invalid Date")return"";var months=w2utils.settings.shortmonths;var d2=new Date;var d3=new Date;d3.setTime(d3.getTime()-864e5);var dd1=months[d1.getMonth()]+" "+d1.getDate()+", "+d1.getFullYear();var dd2=months[d2.getMonth()]+" "+d2.getDate()+", "+d2.getFullYear();var dd3=months[d3.getMonth()]+" "+d3.getDate()+", "+d3.getFullYear();var time=d1.getHours()-(d1.getHours()>12?12:0)+":"+(d1.getMinutes()<10?"0":"")+d1.getMinutes()+" "+(d1.getHours()>=12?"pm":"am");var time2=d1.getHours()-(d1.getHours()>12?12:0)+":"+(d1.getMinutes()<10?"0":"")+d1.getMinutes()+":"+(d1.getSeconds()<10?"0":"")+d1.getSeconds()+" "+(d1.getHours()>=12?"pm":"am");var dsp=dd1;if(dd1==dd2)dsp=time;if(dd1==dd3)dsp=w2utils.lang("Yesterday");return''+dsp+""}function size(sizeStr){if(!w2utils.isFloat(sizeStr)||sizeStr=="")return"";sizeStr=parseFloat(sizeStr);if(sizeStr==0)return 0;var sizes=["Bt","KB","MB","GB","TB"];var i=parseInt(Math.floor(Math.log(sizeStr)/Math.log(1024)));return(Math.floor(sizeStr/Math.pow(1024,i)*10)/10).toFixed(i==0?0:1)+" "+sizes[i]}function formatNumber(val,groupSymbol){var ret="";if(typeof groupSymbol=="undefined")groupSymbol=w2utils.settings.groupSymbol||",";if(w2utils.isFloat(val)||w2utils.isInt(val)||w2utils.isMoney(val)){tmp=String(val).split(".");ret=String(tmp[0]).replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+groupSymbol);if(typeof tmp[1]!="undefined")ret+="."+tmp[1]}return ret}function formatDate(dateStr,format){var months=w2utils.settings.shortmonths;var fullMonths=w2utils.settings.fullmonths;if(typeof format=="undefined")format=this.settings.date_format;if(typeof dateStr=="undefined"||dateStr==""||dateStr==null)return"";var dt=new Date(dateStr);if(w2utils.isInt(dateStr))dt=new Date(Number(dateStr));if(dt=="Invalid Date")return"";var year=dt.getFullYear();var month=dt.getMonth();var date=dt.getDate();return format.toLowerCase().replace("month",w2utils.settings.fullmonths[month]).replace("mon",w2utils.settings.shortmonths[month]).replace(/yyyy/g,year).replace(/yyy/g,year).replace(/yy/g,year>2e3?100+parseInt(String(year).substr(2)):String(year).substr(2)).replace(/(^|[^a-z$])y/g,"$1"+year).replace(/mm/g,(month+1<10?"0":"")+(month+1)).replace(/dd/g,(date<10?"0":"")+date).replace(/(^|[^a-z$])m/g,"$1"+(month+1)).replace(/(^|[^a-z$])d/g,"$1"+date)}function formatTime(dateStr,format){var months=w2utils.settings.shortmonths;var fullMonths=w2utils.settings.fullmonths;if(typeof format=="undefined")format=this.settings.time_format=="h12"?"hh:mi pm":"h24:mi";if(typeof dateStr=="undefined"||dateStr==""||dateStr==null)return"";var dt=new Date(dateStr);if(w2utils.isInt(dateStr))dt=new Date(Number(dateStr));if(dt=="Invalid Date")return"";var type="am";var hour=dt.getHours();var h24=dt.getHours();var min=dt.getMinutes();var sec=dt.getSeconds();if(min<10)min="0"+min;if(sec<10)sec="0"+sec;if(format.indexOf("am")!=-1||format.indexOf("pm")!=-1){if(hour>=12)type="pm";if(hour>12)hour=hour-12}return format.toLowerCase().replace("am",type).replace("pm",type).replace("hh",hour).replace("h24",h24).replace("mm",min).replace("mi",min).replace("ss",sec).replace(/(^|[^a-z$])h/g,"$1"+hour).replace(/(^|[^a-z$])m/g,"$1"+min).replace(/(^|[^a-z$])s/g,"$1"+sec)}function formatDateTime(dateStr,format){var fmt;if(typeof format!="string"){fmt=[this.settings.date_format,this.settings.time_format]}else{fmt=format.split("|")}return this.formatDate(dateStr,fmt[0])+" "+this.formatTime(dateStr,fmt[1])}function stripTags(html){if(html==null)return html;switch(typeof html){case"number":break;case"string":html=$.trim(String(html).replace(/(<([^>]+)>)/gi,""));break;case"object":for(var a in html)html[a]=this.stripTags(html[a]);break}return html}function encodeTags(html){if(html==null)return html;switch(typeof html){case"number":break;case"string":html=String(html).replace(/&/g,"&").replace(/>/g,">").replace(/\|\/? {}\\])/g,"\\$1")}function base64encode(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";input=utf8_encode(input);while(i>2;enc2=(chr1&3)<<4|chr2>>4;enc3=(chr2&15)<<2|chr3>>6;enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64}else if(isNaN(chr3)){enc4=64}output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4)}function utf8_encode(string){var string=String(string).replace(/\r\n/g,"\n");var utftext="";for(var n=0;n127&&c<2048){utftext+=String.fromCharCode(c>>6|192);utftext+=String.fromCharCode(c&63|128)}else{utftext+=String.fromCharCode(c>>12|224);utftext+=String.fromCharCode(c>>6&63|128);utftext+=String.fromCharCode(c&63|128)}}return utftext}return output}function base64decode(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2)}if(enc4!=64){output=output+String.fromCharCode(chr3)}}output=utf8_decode(output);function utf8_decode(utftext){var string="";var i=0;var c=0,c1=0,c2=0;while(i191&&c<224){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode((c&31)<<6|c2&63);i+=2}else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode((c&15)<<12|(c2&63)<<6|c3&63);i+=3}}return string}return output}function transition(div_old,div_new,type,callBack){var width=$(div_old).width();var height=$(div_old).height();var time=.5;if(!div_old||!div_new){console.log("ERROR: Cannot do transition when one of the divs is null");return}div_old.parentNode.style.cssText+=cross("perspective","700px")+"; overflow: hidden;";div_old.style.cssText+="; position: absolute; z-index: 1019; "+cross("backface-visibility","hidden");div_new.style.cssText+="; position: absolute; z-index: 1020; "+cross("backface-visibility","hidden");switch(type){case"slide-left":div_old.style.cssText+="overflow: hidden; "+cross("transform","translate3d(0, 0, 0)","translate(0, 0)");div_new.style.cssText+="overflow: hidden; "+cross("transform","translate3d("+width+"px, 0, 0)","translate("+width+"px, 0)");$(div_new).show();window.setTimeout(function(){div_new.style.cssText+=cross("transition",time+"s")+";"+cross("transform","translate3d(0, 0, 0)","translate(0, 0)");div_old.style.cssText+=cross("transition",time+"s")+";"+cross("transform","translate3d(-"+width+"px, 0, 0)","translate(-"+width+"px, 0)")},1);break;case"slide-right":div_old.style.cssText+="overflow: hidden; "+cross("transform","translate3d(0, 0, 0)","translate(0, 0)");div_new.style.cssText+="overflow: hidden; "+cross("transform","translate3d(-"+width+"px, 0, 0)","translate(-"+width+"px, 0)");$(div_new).show();window.setTimeout(function(){div_new.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","translate3d(0px, 0, 0)","translate(0px, 0)");div_old.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","translate3d("+width+"px, 0, 0)","translate("+width+"px, 0)")},1);break;case"slide-down":div_old.style.cssText+="overflow: hidden; z-index: 1; "+cross("transform","translate3d(0, 0, 0)","translate(0, 0)");div_new.style.cssText+="overflow: hidden; z-index: 0; "+cross("transform","translate3d(0, 0, 0)","translate(0, 0)");$(div_new).show();window.setTimeout(function(){div_new.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","translate3d(0, 0, 0)","translate(0, 0)");div_old.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","translate3d(0, "+height+"px, 0)","translate(0, "+height+"px)")},1);break;case"slide-up":div_old.style.cssText+="overflow: hidden; "+cross("transform","translate3d(0, 0, 0)","translate(0, 0)");div_new.style.cssText+="overflow: hidden; "+cross("transform","translate3d(0, "+height+"px, 0)","translate(0, "+height+"px)");$(div_new).show();window.setTimeout(function(){div_new.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","translate3d(0, 0, 0)","translate(0, 0)");div_old.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","translate3d(0, 0, 0)","translate(0, 0)")},1);break;case"flip-left":div_old.style.cssText+="overflow: hidden; "+cross("-transform","rotateY(0deg)");div_new.style.cssText+="overflow: hidden; "+cross("transform","rotateY(-180deg)");$(div_new).show();window.setTimeout(function(){div_new.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","rotateY(0deg)");div_old.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","rotateY(180deg)")},1);break;case"flip-right":div_old.style.cssText+="overflow: hidden; "+cross("transform","rotateY(0deg)");div_new.style.cssText+="overflow: hidden; "+cross("transform","rotateY(180deg)");$(div_new).show();window.setTimeout(function(){div_new.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","rotateY(0deg)");div_old.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","rotateY(-180deg)")},1);break;case"flip-down":div_old.style.cssText+="overflow: hidden; "+cross("transform","rotateX(0deg)");div_new.style.cssText+="overflow: hidden; "+cross("transform","rotateX(180deg)");$(div_new).show();window.setTimeout(function(){div_new.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","rotateX(0deg)");div_old.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","rotateX(-180deg)")},1);break;case"flip-up":div_old.style.cssText+="overflow: hidden; "+cross("transform","rotateX(0deg)");div_new.style.cssText+="overflow: hidden; "+cross("transform","rotateX(-180deg)");$(div_new).show();window.setTimeout(function(){div_new.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","rotateX(0deg)");div_old.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","rotateX(180deg)")},1);break;case"pop-in":div_old.style.cssText+="overflow: hidden; "+cross("transform","translate3d(0, 0, 0)","translate(0, 0)");div_new.style.cssText+="overflow: hidden; "+cross("transform","translate3d(0, 0, 0)","translate(0, 0)")+"; "+cross("transform","scale(.8)")+"; opacity: 0;";$(div_new).show();window.setTimeout(function(){div_new.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","scale(1)")+"; opacity: 1;";div_old.style.cssText+=cross("transition",time+"s")+";"},1);break;case"pop-out":div_old.style.cssText+="overflow: hidden; "+cross("transform","translate3d(0, 0, 0)","translate(0, 0)")+"; "+cross("transform","scale(1)")+"; opacity: 1;";div_new.style.cssText+="overflow: hidden; "+cross("transform","translate3d(0, 0, 0)","translate(0, 0)")+"; opacity: 0;";$(div_new).show();window.setTimeout(function(){div_new.style.cssText+=cross("transition",time+"s")+"; opacity: 1;";div_old.style.cssText+=cross("transition",time+"s")+"; "+cross("transform","scale(1.7)")+"; opacity: 0;"},1);break;default:div_old.style.cssText+="overflow: hidden; "+cross("transform","translate3d(0, 0, 0)","translate(0, 0)");div_new.style.cssText+="overflow: hidden; "+cross("transform","translate3d(0, 0, 0)","translate(0, 0)")+"; opacity: 0;";$(div_new).show();window.setTimeout(function(){div_new.style.cssText+=cross("transition",time+"s")+"; opacity: 1;";div_old.style.cssText+=cross("transition",time+"s")},1);break}setTimeout(function(){if(type=="slide-down"){$(div_old).css("z-index","1019");$(div_new).css("z-index","1020")}if(div_new){$(div_new).css({opacity:"1","-webkit-transition":"","-moz-transition":"","-ms-transition":"","-o-transition":"","-webkit-transform":"","-moz-transform":"","-ms-transform":"","-o-transform":"","-webkit-backface-visibility":"","-moz-backface-visibility":"","-ms-backface-visibility":"","-o-backface-visibility":""})}if(div_old){$(div_old).css({opacity:"1","-webkit-transition":"","-moz-transition":"","-ms-transition":"","-o-transition":"","-webkit-transform":"","-moz-transform":"","-ms-transform":"","-o-transform":"","-webkit-backface-visibility":"","-moz-backface-visibility":"","-ms-backface-visibility":"","-o-backface-visibility":""});if(div_old.parentNode)$(div_old.parentNode).css({"-webkit-perspective":"","-moz-perspective":"","-ms-perspective":"","-o-perspective":""})}if(typeof callBack=="function")callBack()},time*1e3);function cross(property,value,none_webkit_value){var isWebkit=!!window.webkitURL;if(!isWebkit&&typeof none_webkit_value!="undefined")value=none_webkit_value;return";"+property+": "+value+"; -webkit-"+property+": "+value+"; -moz-"+property+": "+value+"; "+"-ms-"+property+": "+value+"; -o-"+property+": "+value+";"}}function lock(box,msg,spinner){var options={};if(typeof msg=="object"){options=msg}else{options.msg=msg;options.spinner=spinner}if(!options.msg&&options.msg!=0)options.msg="";w2utils.unlock(box);$(box).find(">:first-child").before('
'+'
');setTimeout(function(){var lock=$(box).find(".w2ui-lock");var mess=$(box).find(".w2ui-lock-msg");lock.data("old_opacity",lock.css("opacity")).css("opacity","0").show();mess.data("old_opacity",mess.css("opacity")).css("opacity","0").show();setTimeout(function(){var lock=$(box).find(".w2ui-lock");var mess=$(box).find(".w2ui-lock-msg");var left=($(box).width()-w2utils.getSize(mess,"width"))/2;var top=($(box).height()*.9-w2utils.getSize(mess,"height"))/2;lock.css({opacity:options.opacity!=undefined?options.opacity:lock.data("old_opacity"),left:"0px",top:"0px",width:"100%",height:"100%"});if(!options.msg)mess.css({"background-color":"transparent",border:"0px"});if(options.spinner===true)options.msg='
"+options.msg;mess.html(options.msg).css({opacity:mess.data("old_opacity"),left:left+"px",top:top+"px"})},10)},10);$().w2tag()}function unlock(box){$(box).find(".w2ui-lock").remove();$(box).find(".w2ui-lock-msg").remove()}function getSize(el,type){var bwidth={left:parseInt($(el).css("border-left-width"))||0,right:parseInt($(el).css("border-right-width"))||0,top:parseInt($(el).css("border-top-width"))||0,bottom:parseInt($(el).css("border-bottom-width"))||0};var mwidth={left:parseInt($(el).css("margin-left"))||0,right:parseInt($(el).css("margin-right"))||0,top:parseInt($(el).css("margin-top"))||0,bottom:parseInt($(el).css("margin-bottom"))||0};var pwidth={left:parseInt($(el).css("padding-left"))||0,right:parseInt($(el).css("padding-right"))||0,top:parseInt($(el).css("padding-top"))||0,bottom:parseInt($(el).css("padding-bottom"))||0};switch(type){case"top":return bwidth.top+mwidth.top+pwidth.top;case"bottom":return bwidth.bottom+mwidth.bottom+pwidth.bottom;case"left":return bwidth.left+mwidth.left+pwidth.left;case"right":return bwidth.right+mwidth.right+pwidth.right;case"width":return bwidth.left+bwidth.right+mwidth.left+mwidth.right+pwidth.left+pwidth.right+parseInt($(el).width());case"height":return bwidth.top+bwidth.bottom+mwidth.top+mwidth.bottom+pwidth.top+pwidth.bottom+parseInt($(el).height());case"+width":return bwidth.left+bwidth.right+mwidth.left+mwidth.right+pwidth.left+pwidth.right;case"+height":return bwidth.top+bwidth.bottom+mwidth.top+mwidth.bottom+pwidth.top+pwidth.bottom}return 0}function lang(phrase){var translation=this.settings.phrases[phrase];if(typeof translation=="undefined")return phrase;else return translation}function locale(locale){if(!locale)locale="en-us";if(locale.length==5)locale="locale/"+locale+".json";$.ajax({url:locale,type:"GET",dataType:"JSON",async:false,cache:false,success:function(data,status,xhr){w2utils.settings=$.extend(true,w2utils.settings,data);var p=w2obj.grid.prototype;for(var b in p.buttons){p.buttons[b].caption=w2utils.lang(p.buttons[b].caption);p.buttons[b].hint=w2utils.lang(p.buttons[b].hint)}p.msgDelete=w2utils.lang(p.msgDelete);p.msgNotJSON=w2utils.lang(p.msgNotJSON);p.msgRefresh=w2utils.lang(p.msgRefresh)},error:function(xhr,status,msg){console.log("ERROR: Cannot load locale "+locale)}})}function scrollBarSize(){if(tmp.scrollBarSize)return tmp.scrollBarSize;var html='
'+'
1
'+"
";$("body").append(html);tmp.scrollBarSize=100-$("#_scrollbar_width > div").width();$("#_scrollbar_width").remove();if(String(navigator.userAgent).indexOf("MSIE")>=0)tmp.scrollBarSize=tmp.scrollBarSize/2;return tmp.scrollBarSize}}();w2utils.event={on:function(eventData,handler){if(!$.isPlainObject(eventData))eventData={type:eventData};eventData=$.extend({type:null,execute:"before",target:null,onComplete:null},eventData);if(typeof eventData.type=="undefined"){console.log("ERROR: You must specify event type when calling .on() method of "+this.name);return}if(typeof handler=="undefined"){console.log("ERROR: You must specify event handler function when calling .on() method of "+this.name);return}this.handlers.push({event:eventData,handler:handler})},off:function(eventData,handler){if(!$.isPlainObject(eventData))eventData={type:eventData};eventData=$.extend({},{type:null,execute:"before",target:null,onComplete:null},eventData);if(typeof eventData.type=="undefined"){console.log("ERROR: You must specify event type when calling .off() method of "+this.name);return}if(typeof handler=="undefined"){handler=null}var newHandlers=[];for(var h in this.handlers){var t=this.handlers[h];if((t.event.type==eventData.type||eventData.type=="*")&&(t.event.target==eventData.target||eventData.target==null)&&(t.handler==handler||handler==null)){}else{newHandlers.push(t)}}this.handlers=newHandlers},trigger:function(eventData){var eventData=$.extend({type:null,phase:"before",target:null,isStopped:false,isCancelled:false},eventData,{preventDefault:function(){this.isCancelled=true},stopPropagation:function(){this.isStopped=true}});if(typeof eventData.target=="undefined")eventData.target=null;for(var h=this.handlers.length-1;h>=0;h--){var item=this.handlers[h];if((item.event.type==eventData.type||item.event.type=="*")&&(item.event.target==eventData.target||item.event.target==null)&&(item.event.execute==eventData.phase||item.event.execute=="*"||item.event.phase=="*")){eventData=$.extend({},item.event,eventData);var args=[];var tmp=RegExp(/\((.*?)\)/).exec(item.handler);if(tmp)args=tmp[1].split(/\s*,\s*/);if(args.length==2){item.handler.call(this,eventData.target,eventData)}else{item.handler.call(this,eventData)}if(eventData.isStopped===true||eventData.stop===true)return eventData}}var funName="on"+eventData.type.substr(0,1).toUpperCase()+eventData.type.substr(1);if(eventData.phase=="before"&&typeof this[funName]=="function"){var fun=this[funName];var args=[];var tmp=RegExp(/\((.*?)\)/).exec(fun);if(tmp)args=tmp[1].split(/\s*,\s*/);if(args.length==2){fun.call(this,eventData.target,eventData)}else{fun.call(this,eventData)}if(eventData.isStopped===true||eventData.stop===true)return eventData}if(typeof eventData.object!="undefined"&&eventData.object!=null&&eventData.phase=="before"&&typeof eventData.object[funName]=="function"){var fun=eventData.object[funName];var args=[];var tmp=RegExp(/\((.*?)\)/).exec(fun);if(tmp)args=tmp[1].split(/\s*,\s*/);if(args.length==2){fun.call(this,eventData.target,eventData)}else{fun.call(this,eventData)}if(eventData.isStopped===true||eventData.stop===true)return eventData}if(eventData.phase=="after"&&eventData.onComplete!=null)eventData.onComplete.call(this,eventData);return eventData}};w2utils.keyboard=function(obj){var w2ui_name=null;obj.active=active;obj.clear=clear;obj.register=register;init();return obj;function init(){$(document).on("keydown",keydown);$(document).on("mousedown",mousedown)}function keydown(event){var tag=event.target.tagName;if($.inArray(tag,["INPUT","SELECT","TEXTAREA"])!=-1)return;if($(event.target).prop("contenteditable")=="true")return;if(!w2ui_name)return;if(w2ui[w2ui_name]&&typeof w2ui[w2ui_name].keydown=="function"){w2ui[w2ui_name].keydown.call(w2ui[w2ui_name],event)}}function mousedown(event){var tag=event.target.tagName;var obj=$(event.target).parents(".w2ui-reset");if(obj.length>0){w2ui_name=obj.attr("name")}}function active(new_w2ui_name){if(typeof new_w2ui_name=="undefined")return w2ui_name;w2ui_name=new_w2ui_name}function clear(){w2ui_name=null}function register(){}}({});(function(){$.fn.w2render=function(name){if($(this).length>0){if(typeof name=="string"&&w2ui[name])w2ui[name].render($(this)[0]);if(typeof name=="object")name.render($(this)[0])}};$.fn.w2destroy=function(name){if(!name&&this.length>0)name=this.attr("name");if(typeof name=="string"&&w2ui[name])w2ui[name].destroy();if(typeof name=="object")name.destroy()};$.fn.w2checkNameParam=function(params,component){if(!params||typeof params.name=="undefined"){console.log('ERROR: The parameter "name" is required but not supplied in $().'+component+"().");return false}if(typeof w2ui[params.name]!="undefined"){console.log('ERROR: The parameter "name" is not unique. There are other objects already created with the same name (obj: '+params.name+").");return false}if(!w2utils.isAlphaNumeric(params.name)){console.log('ERROR: The parameter "name" has to be alpha-numeric (a-z, 0-9, dash and underscore). ');return false}return true};$.fn.w2marker=function(str){if(str==""||typeof str=="undefined"){return $(this).each(function(index,el){el.innerHTML=el.innerHTML.replace(/\(.*)\<\/span\>/gi,"$1")})}else{return $(this).each(function(index,el){if(typeof str=="string")str=[str];el.innerHTML=el.innerHTML.replace(/\(.*)\<\/span\>/gi,"$1");for(var s in str){var tmp=str[s];if(typeof tmp!="string")tmp=String(tmp);tmp=tmp.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&").replace(/&/g,"&").replace(//g,"<");var regex=new RegExp(tmp+"(?!([^<]+)?>)","gi");el.innerHTML=el.innerHTML.replace(regex,function(matched){return''+matched+""})}})}};$.fn.w2tag=function(text,options){if(!$.isPlainObject(options))options={};if(!$.isPlainObject(options.css))options.css={};if(typeof options["class"]=="undefined")options["class"]="";if($(this).length==0){$(".w2ui-tag").each(function(index,elem){var opt=$(elem).data("options");if(typeof opt=="undefined")opt={};$($(elem).data("taged-el")).removeClass(opt["class"]);clearInterval($(elem).data("timer"));$(elem).remove()});return}return $(this).each(function(index,el){var tagOrigID=el.id;var tagID=w2utils.escapeId(el.id);if(text==""||text==null||typeof text=="undefined"){$("#w2ui-tag-"+tagID).css("opacity",0);setTimeout(function(){clearInterval($("#w2ui-tag-"+tagID).data("timer"));$("#w2ui-tag-"+tagID).remove()},300)}else{clearInterval($("#w2ui-tag-"+tagID).data("timer"));$("#w2ui-tag-"+tagID).remove();$("body").append('
0?"w2ui-tag-popup":"")+'" '+' style="">
');var timer=setInterval(function(){if($(el).length==0||$(el).offset().left==0&&$(el).offset().top==0){clearInterval($("#w2ui-tag-"+tagID).data("timer"));tmp_hide();return}if($("#w2ui-tag-"+tagID).data("position")!=$(el).offset().left+el.offsetWidth+"x"+$(el).offset().top){$("#w2ui-tag-"+tagID).css({"-webkit-transition":".2s","-moz-transition":".2s","-ms-transition":".2s","-o-transition":".2s",left:$(el).offset().left+el.offsetWidth+"px",top:$(el).offset().top+"px"}).data("position",$(el).offset().left+el.offsetWidth+"x"+$(el).offset().top)}},100);setTimeout(function(){if(!$(el).offset())return;$("#w2ui-tag-"+tagID).css({opacity:"1",left:$(el).offset().left+el.offsetWidth+"px",top:$(el).offset().top+"px"}).html('
'+text+"
").data("text",text).data("taged-el",el).data("options",options).data("position",$(el).offset().left+el.offsetWidth+"x"+$(el).offset().top).data("timer",timer);$(el).off("keypress",tmp_hide).on("keypress",tmp_hide).off("change",tmp_hide).on("change",tmp_hide).css(options.css).addClass(options["class"]);if(typeof options.onShow=="function")options.onShow()},1);var originalCSS="";if($(el).length>0)originalCSS=$(el)[0].style.cssText;function tmp_hide(){if($("#w2ui-tag-"+tagID).length<=0)return;clearInterval($("#w2ui-tag-"+tagID).data("timer"));$("#w2ui-tag-"+tagID).remove();$(el).off("keypress",tmp_hide).removeClass(options["class"]);if($(el).length>0)$(el)[0].style.cssText=originalCSS;if(typeof options.onHide=="function")options.onHide()}}})};$.fn.w2overlay=function(html,options){var obj=this;var name="";var defaults={name:null,align:"none",left:0,top:0,tipLeft:30,width:0,height:0,maxWidth:null,maxHeight:null,style:"","class":"",onShow:null,onHide:null};if(!$.isPlainObject(options))options={};options=$.extend(true,{},defaults,options);if(options.name)name="-"+options.name;if(this.length==0||html==""||typeof html=="undefined"){$(document).click();return $(this)}if($("#w2ui-overlay").length>0)$(document).click();$("body").append('");var div1=$("#w2ui-overlay"+name);var div2=div1.find(" > div");div2.html(html);var bc=div2.css("background-color");if(typeof bc!="undefined"&&bc!="rgba(0, 0, 0, 0)"&&bc!="transparent")div1.css("background-color",bc);div1.data("obj",obj).data("fixSize",fixSize).fadeIn("fast").on("mousedown",function(event){$("#w2ui-overlay"+name).data("keepOpen",true);if(["INPUT","TEXTAREA","SELECT"].indexOf(event.target.tagName)===-1)event.preventDefault()});fixSize();setTimeout(function(){fixSize();if(typeof options.onShow=="function")options.onShow()},10);return $(this);function hide(){var div1=$("#w2ui-overlay"+name);if(div1.data("keepOpen")===true){div1.removeData("keepOpen");return}var result;if(typeof options.onHide=="function")result=options.onHide();if(result===false)return;div1.remove();$(document).off("click",hide);clearInterval(div1.data("timer"))}function fixSize(){$(document).off("click",hide).on("click",hide);var div1=$("#w2ui-overlay"+name);var div2=div1.find(" > div");if(div1.length>0){div2.height("auto").width("auto");var overflowX=false;var overflowY=false;var h=div2.height();var w=div2.width();switch(options.align){case"both":options.left=17;options.width=w2utils.getSize($(obj),"width");break;case"left":options.left=17;break;case"right":options.tipLeft=w-45;options.left=w2utils.getSize($(obj),"width")-w+10;break}div1.css({top:$(obj).offset().top+w2utils.getSize($(obj),"height")+options.top+5+"px",left:$(obj).offset().left+options.left+"px","min-width":options.width?options.width:"auto","min-height":options.height?options.height:"auto"}); var maxHeight=window.innerHeight+$(document).scrollTop()-div2.offset().top-7;var maxWidth=window.innerWidth+$(document).scrollLeft()-div2.offset().left-7;if(maxHeight>-30&&maxHeight<210){maxHeight=div2.offset().top-$(document).scrollTop()-7;if(options.maxHeight&&maxHeight>options.maxHeight)maxHeight=options.maxHeight;if(h>maxHeight){overflowY=true;div2.height(maxHeight).width(w).css({"overflow-y":"auto"});h=maxHeight}div1.css("top",$(obj).offset().top-h-24+options.top+"px");div1.find(">style").html("#w2ui-overlay"+name+":before { display: none; margin-left: "+parseInt(options.tipLeft)+"px; }"+"#w2ui-overlay"+name+":after { display: block; margin-left: "+parseInt(options.tipLeft)+"px; }")}else{if(options.maxHeight&&maxHeight>options.maxHeight)maxHeight=options.maxHeight;if(h>maxHeight){overflowY=true;div2.height(maxHeight).width(w).css({"overflow-y":"auto"})}div1.find(">style").html("#w2ui-overlay"+name+":before { display: block; margin-left: "+parseInt(options.tipLeft)+"px; }"+"#w2ui-overlay"+name+":after { display: none; margin-left: "+parseInt(options.tipLeft)+"px; }")}w=div2.width();maxWidth=window.innerWidth+$(document).scrollLeft()-div2.offset().left-7;if(options.maxWidth&&maxWidth>options.maxWidth)maxWidth=options.maxWidth;if(w>maxWidth&&options.align!="both"){options.align="right";setTimeout(function(){fixSize()},1)}if(overflowY&&overflowX)div2.width(w+w2utils.scrollBarSize()+2)}}};$.fn.w2menu=function(menu,options){var defaults={index:null,items:[],render:null,onSelect:null};if(menu=="refresh"){var name="";if(options.name)name="-"+options.name;if($("#w2ui-overlay"+name).length>0){$("#w2ui-overlay"+name+" > div").html(getMenuHTML(),options);var fun=$("#w2ui-overlay"+name).data("fixSize");if(typeof fun=="function")fun()}else{$(this).w2menu(options)}}else{if(arguments.length==1)options=menu;else options.items=menu;if(typeof options!="object")options={};options=$.extend({},defaults,options);if(typeof options.select=="function"&&typeof options.onSelect!="function")options.onSelect=options.select;if(typeof options.onRender=="function"&&typeof options.render!="function")options.render=options.onRender;$.fn.w2menuHandler=function(event,index){if(typeof options.onSelect=="function"){options.onSelect({index:index,item:options.items[index],originalEvent:event})}};return $(this).w2overlay(getMenuHTML(),options)}function getMenuHTML(){var count=0;var menu_html='';for(var f=0;f
';if(icon)imgd='
';if(txt||txt===0){var bg=count%2==0?"w2ui-item-even":"w2ui-item-odd";if(options.altRows!==true)bg="";menu_html+='"+imgd+" "+"";count++}}options.items[f]=mitem}if(count==0){menu_html+=''}menu_html+="
"+txt+"
No items
";return menu_html}}})();(function($){var w2field=function(options){this.el=null;this.helpers={};this.type=options.type||"text";this.type=String(this.type).toLowerCase();this.options=$.extend(true,{},options);this.onSearch=options.onSearch||null;this.onRequest=options.onRequest||null;this.onLoad=options.onLoad||null;this.onClick=options.onClick||null;this.onAdd=options.onAdd||null;this.onRemove=options.onRemove||null;this.onMouseOver=options.onMouseOver||null;this.onMouseOut=options.onMouseOut||null;this.tmp={};delete this.options.type;delete this.options.onSearch;delete this.options.onRequest;delete this.options.onLoad;delete this.options.onClick;delete this.options.onMouseOver;delete this.options.onMouseOut;$.extend(true,this,w2obj.field)};$.fn.w2field=function(method,options){if(this.length==0){var pr=w2field.prototype;if(pr[method]){return pr[method].apply(pr,Array.prototype.slice.call(arguments,1))}}else{if(typeof method=="string"&&typeof options=="object"){method=$.extend(true,{},options,{type:method})}if(typeof method=="string"&&typeof options=="undefined"){method={type:method}}return this.each(function(index,el){var obj=$(el).data("w2field");if(typeof obj=="undefined"){var obj=new w2field(method);$.extend(obj,{handlers:[]});if(el)obj.el=$(el)[0];obj.init();$(el).data("w2field",obj);return obj}else{obj.clear();var obj=new w2field(method);$.extend(obj,{handlers:[]});if(el)obj.el=$(el)[0];obj.init();$(el).data("w2field",obj);return obj}return null})}};w2field.prototype={custom:{},addType:function(type,handler){this.custom[String(type).toLowerCase()]=handler;return true},removeType:function(type){if(!this.custom[String(type).toLowerCase()])return false;delete this.custom[String(type).toLowerCase()];return true},init:function(){var obj=this;var options=this.options;var defaults;if(typeof this.custom[this.type.toLowerCase()]=="function"){this.custom[this.type.toLowerCase()].call(this,options);return}if(["INPUT","TEXTAREA"].indexOf(this.el.tagName)==-1){console.log("ERROR: w2field could only be applied to INPUT or TEXTAREA.",this.el);return}switch(this.type){case"text":case"int":case"float":case"money":case"currency":case"percent":case"alphanumeric":case"hex":defaults={min:null,max:null,placeholder:"",autoFormat:true,currencyPrefix:w2utils.settings.currencyPrefix,currencySuffix:w2utils.settings.currencySuffix,groupSymbol:w2utils.settings.groupSymbol,arrows:false,keyboard:true,precision:null,silent:true,prefix:"",suffix:""};this.options=$.extend(true,{},defaults,options);options=this.options;options.numberRE=new RegExp("["+options.groupSymbol+"]","g");options.moneyRE=new RegExp("["+options.currencyPrefix+options.currencySuffix+options.groupSymbol+"]","g");options.percentRE=new RegExp("["+options.groupSymbol+"%]","g");if(["text","alphanumeric","hex"].indexOf(this.type)!=-1){options.arrows=false;options.keyboard=false}this.addPrefix();this.addSuffix();$(this.el).attr("placeholder",options.placeholder);break;case"color":defaults={prefix:"#",suffix:'
 
',placeholder:"",arrows:false,keyboard:false};$.extend(options,defaults);this.addPrefix();this.addSuffix();$(this.el).attr("maxlength",6);if($(this.el).val()!="")setTimeout(function(){$(obj.el).change()},1);$(this.el).attr("placeholder",options.placeholder);break;case"date":defaults={format:w2utils.settings.date_format,placeholder:"",keyboard:true,silent:true,start:"",end:"",blocked:{},colored:{}};this.options=$.extend(true,{},defaults,options);options=this.options;$(this.el).attr("placeholder",options.placeholder?options.placeholder:options.format);break;case"time":defaults={format:w2utils.settings.time_format,placeholder:"",keyboard:true,silent:true,start:"",end:""};this.options=$.extend(true,{},defaults,options);options=this.options;$(this.el).attr("placeholder",options.placeholder?options.placeholder:options.format=="h12"?"hh:mi pm":"hh:mi");break;case"list":case"combo":defaults={items:[],selected:{},placeholder:"",url:null,cacheMax:500,maxWidth:null,maxHeight:350,match:"contains",silent:true,onSearch:null,onRequest:null,onLoad:null,render:null,showAll:false,markSearch:true};options=$.extend({},defaults,options,{align:"both",suffix:'
',altRows:true});this.options=options;if(!$.isPlainObject(options.selected))options.selected={};$(this.el).data("selected",options.selected);if(options.url)this.request(0);this.addSuffix();$(this.el).attr("placeholder",options.placeholder);if(typeof options.selected.text!="undefined")$(this.el).val(options.selected.text);break;case"enum":defaults={items:[],selected:[],placeholder:"",max:0,url:null,cacheMax:500,maxWidth:null,maxHeight:350,match:"contains",silent:true,showAll:false,markSearch:true,render:null,itemRender:null,itemsHeight:350,itemMaxWidth:250,onSearch:null,onRequest:null,onLoad:null,onClick:null,onAdd:null,onRemove:null,onMouseOver:null,onMouseOut:null};options=$.extend({},defaults,options,{align:"both",suffix:'
',altRows:true});this.options=options;if(!$.isArray(options.selected))options.selected=[];$(this.el).data("selected",options.selected);if(options.url)this.request(0);this.addSuffix();this.addMulti();break;case"file":defaults={selected:[],placeholder:w2utils.lang("Attach files by dragging and dropping or Click to Select"),max:0,maxSize:0,maxFileSize:0,maxWidth:null,maxHeight:350,silent:true,itemRender:null,itemMaxWidth:250,itemsHeight:350,onClick:null,onAdd:null,onRemove:null,onMouseOver:null,onMouseOut:null};options=$.extend({},defaults,options,{align:"both",altRows:true});this.options=options;if(!$.isArray(options.selected))options.selected=[];$(this.el).data("selected",options.selected);if(options.url)this.request(0);this.addMulti();break}this.tmp={onChange:function(event){obj.change.call(obj,event)},onClick:function(event){event.stopPropagation()},onFocus:function(event){obj.focus.call(obj,event)},onBlur:function(event){obj.blur.call(obj,event)},onKeydown:function(event){obj.keyDown.call(obj,event)},onKeyup:function(event){obj.keyUp.call(obj,event)},onKeypress:function(event){obj.keyPress.call(obj,event)}};$(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({"box-sizing":"border-box","-webkit-box-sizing":"border-box","-moz-box-sizing":"border-box","-ms-box-sizing":"border-box","-o-box-sizing":"border-box"});this.change($.Event("change"))},clear:function(){var obj=this;var options=this.options;var tmp=$(this.el).data("tmp");if(tmp&&tmp["old-padding-left"])$(this.el).css("padding-left",tmp["old-padding-left"]);if(tmp&&tmp["old-padding-right"])$(this.el).css("padding-right",tmp["old-padding-right"]);if(["money","currency"].indexOf(this.type)!=-1){$(this.el).val($(this.el).val().replace(options.moneyRE,""))}if(this.type=="percent"){$(this.el).val($(this.el).val().replace(/%/g,""))}if(this.type=="color"){$(this.el).removeAttr("maxlength")}$(this.el).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 h in this.helpers)$(this.helpers[h]).remove();this.helpers={}},refresh:function(){var obj=this;var options=this.options;var selected=$(this.el).data("selected");if(["enum","file"].indexOf(this.type)!=-1){var html="";for(var s in selected){var item='
  • '+'
      
    '+(obj.type=="enum"?selected[s].text:selected[s].name+' - '+w2utils.size(selected[s].size)+"")+"
  • ";if(typeof options.itemRender=="function"){item=options.itemRender(selected[s],s,'
      
    ')}if(item.indexOf("'+item+"";html+=item}var div=obj.helpers["multi"];var ul=div.find("ul");div.find(".w2ui-enum-placeholder").remove();ul.find("li").not("li.nomouse").remove();if(html!=""){ul.prepend(html)}else if(typeof options.placeholder!="undefined"){var style="padding-top: "+$(this.el).css("padding-top")+";"+"padding-left: "+$(this.el).css("padding-left")+"; "+"box-sizing: "+$(this.el).css("box-sizing")+"; "+"line-height: "+$(this.el).css("line-height")+"; "+"font-size: "+$(this.el).css("font-size")+"; "+"font-family: "+$(this.el).css("font-family")+"; ";div.prepend('
    '+options.placeholder+"
    ")}div.find("li").data("mouse","out").on("click",function(event){var item=selected[$(event.target).attr("index")];if($(event.target).hasClass("nomouse"))return;event.stopPropagation();if($(event.target).hasClass("w2ui-list-remove")){var eventData=obj.trigger({phase:"before",type:"remove",target:obj.el,originalEvent:event.originalEvent,item:item});if(eventData.isCancelled===true)return;$().w2overlay();selected.splice($(event.target).attr("index"),1);$(obj.el).trigger("change");$(event.target).parent().fadeOut("fast");setTimeout(function(){obj.refresh();obj.trigger($.extend(eventData,{phase:"after"}))},300)}if(obj.type=="file"&&!$(event.target).hasClass("w2ui-list-remove")){var preview="";if(/image/i.test(item.type)){preview='
    '+' = h && w > 300) $(this).width(300);"+' if (w < h && h > 300) $(this).height(300);"'+" onerror=\"this.style.display = 'none'\""+" >"+"
    "}var td1='style="padding: 3px; text-align: right; color: #777;"';var td2='style="padding: 3px"';preview+='
    '+' '+" "+" "+" "+" "+"
    Name:"+item.name+"
    Size:"+w2utils.size(item.size)+"
    Type:"+' '+item.type+""+"
    Modified:"+w2utils.date(item.modified)+"
    "+"
    ";$(event.target).w2overlay(preview)}var eventData=obj.trigger({phase:"before",type:"click",target:obj.el,originalEvent:event.originalEvent,item:item});if(eventData.isCancelled===true)return;obj.trigger($.extend(eventData,{phase:"after"}))}).on("mouseover",function(event){var tmp=event.target;if(tmp.tagName!="LI")tmp=tmp.parentNode;if($(tmp).hasClass("nomouse"))return;if($(tmp).data("mouse")=="out"){var item=selected[$(tmp).attr("index")];var eventData=obj.trigger({phase:"before",type:"mouseOver",target:obj.el,originalEvent:event.originalEvent,item:item});if(eventData.isCancelled===true)return;obj.trigger($.extend(eventData,{phase:"after"}))}$(tmp).data("mouse","over")}).on("mouseout",function(event){var tmp=event.target;if(tmp.tagName!="LI")tmp=tmp.parentNode;if($(tmp).hasClass("nomouse"))return;$(tmp).data("mouse","leaving");setTimeout(function(){if($(tmp).data("mouse")=="leaving"){$(tmp).data("mouse","out");var item=selected[$(tmp).attr("index")];var eventData=obj.trigger({phase:"before",type:"f",target:obj.el,originalEvent:event.originalEvent,item:item});if(eventData.isCancelled===true)return;obj.trigger($.extend(eventData,{phase:"after"}))}},0)});$(this.el).height("auto");var cntHeight=$(div).find("> div").height()+w2utils.getSize(div,"+height")*2;if(cntHeight<23)cntHeight=23;if(cntHeight>options.itemsHeight)cntHeight=options.itemsHeight;if(div.length>0)div[0].scrollTop=1e3;var inpHeight=w2utils.getSize($(this.el),"height")-2;if(inpHeight>cntHeight)cntHeight=inpHeight;$(div).css({height:cntHeight+"px",overflow:cntHeight==options.itemsHeight?"auto":"hidden"});if(cntHeightoptions.max){val=options.max;$(this.el).val(options.max)}}val=Number(val)}return val},format:function(val){var options=this.options;if(options.autoFormat&&val!=""){switch(this.type){case"money":case"currency":val=w2utils.formatNumber(Number(val).toFixed(2),options.groupSymbol);if(val!="")val=options.currencyPrefix+val+options.currencySuffix;break;case"percent":val=w2utils.formatNumber(options.precision?Number(val).toFixed(options.precision):val,options.groupSymbol);if(val!="")val+="%";break;case"float":val=w2utils.formatNumber(options.precision?Number(val).toFixed(options.precision):val,options.groupSymbol);break;case"int":val=w2utils.formatNumber(val,options.groupSymbol);break}}return val},change:function(event){var obj=this;var options=obj.options;if(["int","float","money","currency","percent"].indexOf(this.type)!=-1){var val=$(this.el).val();var new_val=this.format(this.clean($(this.el).val()));if(val!=""&&val!=new_val){$(this.el).val(new_val).change();event.stopPropagation();event.preventDefault();return false}}if(this.type=="color"){var color="#"+$(this.el).val();if($(this.el).val().length!=6&&$(this.el).val().length!=3)color="";$(this.el).next().find("div").css("background-color",color)}},focus:function(event){var obj=this;var options=this.options;if(this.type=="color"){$("#w2ui-overlay").remove();$(obj.el).w2overlay(obj.getColorHTML());$("#w2ui-overlay .color").on("mousedown",function(event){var color=$(event.originalEvent.target).attr("name");$(obj.el).val(color).change().blur();$("#w2ui-overlay").remove()})}if(this.type=="date"){$("#w2ui-overlay").remove();setTimeout(function(){$(obj.el).w2overlay('
    ',{css:{"background-color":"#f5f5f5"}});setTimeout(function(){obj.updateOverlay()},1)},1)}if(this.type=="time"){$("#w2ui-overlay").remove();setTimeout(function(){$(obj.el).w2overlay('
    ',{css:{"background-color":"#fff"}});setTimeout(function(){obj.updateOverlay()},1)},1)}if(["list","combo","enum"].indexOf(this.type)!=-1){$("#w2ui-overlay").remove();setTimeout(function(){if(options.showAll!==true)obj.search();$(obj.el).w2menu($.extend(true,{},options,{onSelect:function(event){if(obj.type=="enum"){var selected=$(obj.el).data("selected");if(event.item){var eventData=obj.trigger({phase:"before",type:"add",target:obj.el,originalEvent:event.originalEvent,item:event.item});if(eventData.isCancelled===true)return;if(selected.length>=options.max&&options.max>0)selected.pop();delete event.item.hidden;selected.push(event.item);$(obj.el).data("selected",selected).change();$(obj.helpers["multi"]).find("input").val("");obj.refresh();$("#w2ui-overlay").remove();obj.trigger($.extend(eventData,{phase:"after"}))}}else{$(obj.el).data("selected",event.item).val(event.item.text).change().blur()}}}))},1)}if(this.type=="file"){$(this.helpers["multi"]).css({outline:"auto 5px -webkit-focus-ring-color","outline-offset":"-2px"})}},blur:function(event){var obj=this;var options=obj.options;var val=$(this.el).val().trim();if(["color","date","time","list","combo","enum"].indexOf(this.type)!=-1){$("#w2ui-overlay").remove()}if(["int","float","money","currency","percent"].indexOf(this.type)!=-1){if(val!==""&&!this.checkType(val)){$(this.el).val("").change();if(options.silent===false){$(this.el).w2tag("Not a valid number");setTimeout(function(){$(this.el).w2tag("")},3e3)}}}if(["date","time"].indexOf(this.type)!=-1){if(val!==""&&!this.inRange(this.el.value)){$(this.el).val("").removeData("selected").change();if(options.silent===false){$(this.el).w2tag("Not in range");setTimeout(function(){$(this.el).w2tag("")},3e3)}}else{if(this.type=="date"&&val!==""&&!w2utils.isDate(this.el.value,options.format)){$(this.el).val("").removeData("selected").change();if(options.silent===false){$(this.el).w2tag("Not a valid date");setTimeout(function(){$(this.el).w2tag("")},3e3)}}if(this.type=="time"&&val!==""&&!w2utils.isTime(this.el.value)){$(this.el).val("").removeData("selected").change();if(options.silent===false){$(this.el).w2tag("Not a valid time");setTimeout(function(){$(this.el).w2tag("")},3e3)}}}}if(["list"].indexOf(this.type)!=-1){if(typeof val=="undefined")return;var flag=false;for(var i in options.items){var it=options.items[i];if(typeof it=="object"&&it.text==val)flag=true;if(typeof it=="string"&&it==val)flag=true}if(!flag&&val!==""){$(this.el).val("").removeData("selected").change();if(options.silent===false){$(this.el).w2tag("Not in list");setTimeout(function(){$(this.el).w2tag("")},3e3)}for(var i in options.items)delete options.items.hidden}}if(["enum"].indexOf(this.type)!=-1){$(this.helpers["multi"]).find("input").val("")}if(this.type=="file"){$(this.helpers["multi"]).css({outline:"none"})}},keyPress:function(event){var obj=this;var options=obj.options;if(["int","float","money","currency","percent","hex","color","alphanumeric"].indexOf(this.type)!=-1){if(event.metaKey||event.ctrlKey||event.altKey||event.charCode!=event.keyCode&&event.keyCode>0)return;var ch=String.fromCharCode(event.charCode);if(!this.checkType(ch,true)&&event.keyCode!=13){event.preventDefault();if(event.stopPropagation)event.stopPropagation();else event.cancelBubble=true;return false}}if(["date","time"].indexOf(this.type)!=-1){setTimeout(function(){obj.updateOverlay()},1)}if(["list"].indexOf(this.type)!=-1){if(event.keyCode==13){var val=$(this.el).val();if(typeof val=="undefined")return;var item=null;for(var i in options.items){if(options.items[i].text==val){item=options.items[i];break}}var current=$(this.el).data("selected");if(!item){$(this.el).val("").removeData("selected")}else if(!current||current.id!=item.id){$(this.el).data("selected",item)}}}},keyDown:function(event,extra){var obj=this;var options=obj.options;var key=event.keyCode||extra.keyCode;if(["int","float","money","currency","percent"].indexOf(this.type)!=-1){if(!options.keyboard)return;var cancel=false;var val=parseFloat($(obj.el).val().replace(options.moneyRE,""))||0;var inc=1;if(event.ctrlKey||event.metaKey)inc=10;switch(key){case 38:$(obj.el).val(val+inc<=options.max||options.max===null?val+inc:options.max).change();cancel=true;break;case 40:$(obj.el).val(val-inc>=options.min||options.min===null?val-inc:options.min).change();cancel=true;break}if(cancel){event.preventDefault();setTimeout(function(){obj.el.setSelectionRange(obj.el.value.length,obj.el.value.length)},0)}}if(this.type=="date"){if(!options.keyboard)return;var cancel=false;var daymil=24*60*60*1e3;var inc=1;if(event.ctrlKey||event.metaKey)inc=10;var dt=w2utils.isDate($(this.el).val(),options.format,true);if(!dt){dt=new Date;daymil=0}switch(key){case 38:var newDT=w2utils.formatDate(dt.getTime()+daymil,options.format);if(inc==10)newDT=w2utils.formatDate(new Date(dt.getFullYear(),dt.getMonth()+1,dt.getDate()),options.format);$(obj.el).val(newDT).change();cancel=true;break;case 40:var newDT=w2utils.formatDate(dt.getTime()-daymil,options.format);if(inc==10)newDT=w2utils.formatDate(new Date(dt.getFullYear(),dt.getMonth()-1,dt.getDate()),options.format);$(obj.el).val(newDT).change();cancel=true;break}if(cancel){event.preventDefault();setTimeout(function(){obj.el.setSelectionRange(obj.el.value.length,obj.el.value.length);obj.updateOverlay()},0)}}if(this.type=="time"){if(!options.keyboard)return;var cancel=false;var inc=1;if(event.ctrlKey||event.metaKey)inc=60;var val=$(this.el).val();var time=this.toMin(val)||this.toMin((new Date).getHours()+":"+((new Date).getMinutes()-1));switch(key){case 38:time+=inc;cancel=true;break;case 40:time-=inc;cancel=true;break}if(cancel){$(obj.el).val(this.fromMin(time)).change();event.preventDefault();setTimeout(function(){obj.el.setSelectionRange(obj.el.value.length,obj.el.value.length)},0)}}if(this.type=="color"){if(event.keyCode==86&&(event.ctrlKey||event.metaKey)){var obj=this;$(this).prop("maxlength",7);setTimeout(function(){var val=$(obj).val();if(val.substr(0,1)=="#")val=val.substr(1);if(!w2utils.isHex(val))val="";$(obj).val(val).prop("maxlength",6).change()},20)}}if(["list","combo","enum"].indexOf(this.type)!=-1){var cancel=false;var selected=$(this.el).data("selected");switch(key){case 13:var item=options.items[options.index];if(["enum"].indexOf(this.type)!=-1){if(item){var eventData=obj.trigger({phase:"before",type:"add",target:obj.el,originalEvent:event.originalEvent,item:item});if(eventData.isCancelled===true)return;if(selected.length>=options.max&&options.max>0)selected.pop();delete item.hidden;selected.push(item);$(this.el).change();$(this.helpers["multi"]).find("input").val("");this.refresh();obj.trigger($.extend(eventData,{phase:"after"}))}}else{if(item)$(this.el).data("selected",item).val(item.text).change();if($(this.el).val()==""&&$(this.el).data("selected"))$(this.el).removeData("selected").val("").change()}break;case 8:if(["enum"].indexOf(this.type)!=-1){if($(this.helpers["multi"]).find("input").val()==""&&selected.length>0){var item=selected[selected.length-1];var eventData=obj.trigger({phase:"before",type:"remove",target:obj.el,originalEvent:event.originalEvent,item:item});if(eventData.isCancelled===true)return;selected.pop();$(this.el).trigger("change");this.refresh();obj.trigger($.extend(eventData,{phase:"after"}))}}break;case 38:options.index=w2utils.isInt(options.index)?parseInt(options.index):0;options.index--;while(options.index>0&&options.items[options.index].hidden)options.index--;if(options.index==0&&options.items[options.index].hidden){while(options.items[options.index]&&options.items[options.index].hidden)options.index++}cancel=true;break;case 40:options.index=w2utils.isInt(options.index)?parseInt(options.index):-1;options.index++;while(options.index=options.items.length)options.index=options.items.length-1;this.updateOverlay();event.preventDefault();setTimeout(function(){if(["enum"].indexOf(obj.type)!=-1){var tmp=obj.helpers["multi"].find("input").get(0);tmp.setSelectionRange(tmp.value.length,tmp.value.length)}else{obj.el.setSelectionRange(obj.el.value.length,obj.el.value.length)}},0);return}if(["enum"].indexOf(this.type)!=-1){var input=this.helpers["multi"].find("input");var search=input.val();input.width((search.length+2)*6+"px")}setTimeout(function(){obj.request();if(options.showAll!==true)obj.search()},1)}},keyUp:function(event){if(this.type=="color"){if(event.keyCode==86&&(event.ctrlKey||event.metaKey))$(this).prop("maxlength",6)}},request:function(interval){var obj=this;var options=this.options;var search=$(obj.el).val()||"";if(typeof interval=="undefined")interval=350;if(typeof obj.tmp.xhr_total=="undefined")obj.tmp.xhr_total=-1;if(typeof obj.tmp.xhr_len=="undefined")obj.tmp.xhr_len=-1;if(typeof obj.tmp.xhr_match=="undefined")obj.tmp.xhr_match=-1;clearTimeout(obj.tmp.timeout);obj.tmp.timeout=setTimeout(function(){if(options.url&&(options.items.length===0&&obj.tmp.xhr_total!==0||search.length>obj.tmp.xhr_len&&obj.tmp.xhr_total>options.cacheMax||search.length div > div").html(obj.getMonthHTML(month,year));$("#w2ui-overlay .w2ui-date").on("mousedown",function(){var day=$(this).attr("date");$(obj.el).val(day).change().blur();$("#w2ui-overlay").remove()});$("#w2ui-overlay .previous").on("mousedown",function(){var tmp=obj.options.current.split("/");tmp[0]=parseInt(tmp[0])-1;refreshCalendar(tmp[0],tmp[1])});$("#w2ui-overlay .next").on("mousedown",function(){var tmp=obj.options.current.split("/");tmp[0]=parseInt(tmp[0])+1;refreshCalendar(tmp[0],tmp[1])})})(month,year)}if(this.type=="time"){var h24=this.options.format=="h24"?true:false;$("#w2ui-overlay > div").html(obj.getHourHTML());$("#w2ui-overlay .w2ui-time").on("mousedown",function(){var hour=$(this).attr("hour");$(obj.el).val((hour>12&&!h24?hour-12:hour)+":00"+(!h24?hour<12?" am":" pm":"")).change();$("#w2ui-overlay > div").html(obj.getMinHTML(hour));var fun=$("#w2ui-overlay"+name).data("fixSize");if(typeof fun=="function")fun();if(typeof fun=="function")fun();$("#w2ui-overlay .w2ui-time").on("mousedown",function(){var min=$(this).attr("min");$(obj.el).val((hour>12&&!h24?hour-12:hour)+":"+(min<10?0:"")+min+(!h24?hour<12?" am":" pm":"")).change().blur();$("#w2ui-overlay").remove()})})}if(["list","combo","enum"].indexOf(this.type)!=-1){var el=this.el;var input=this.el;if(this.type=="enum"){el=$(this.helpers["multi"]);input=$(el).find("input")}if($(input).is(":focus"))$(el).w2menu("refresh",options);var el=$("#w2ui-overlay > div");var cur=el.find("tr[index="+options.index+"]"); el.find("tr.w2ui-selected").removeClass("w2ui-selected");cur.addClass("w2ui-selected");if(cur.length>0){var top=cur[0].offsetTop-5;var scrTop=el.scrollTop();var height=el.height();if(topscrTop+height){$("#w2ui-overlay > div").animate({scrollTop:top-(height-cur.height()*2)/2},250,"linear")}}}},inRange:function(str){var inRange=false;if(this.type=="date"){var dt=w2utils.isDate(str,this.options.format,true);if(dt){if(this.options.start||this.options.end){var st=typeof this.options.start=="string"?this.options.start:$(this.options.start).val();var en=typeof this.options.end=="string"?this.options.end:$(this.options.end).val();var start=w2utils.isDate(st,this.options.format,true);var end=w2utils.isDate(en,this.options.format,true);var current=new Date(dt);if(!start)start=current;if(!end)end=current;if(current>=start&¤t<=end)inRange=true}else{inRange=true}if(this.options.blocked&&$.inArray(str,this.options.blocked)!=-1)inRange=false}}if(this.type=="time"){if(this.options.start||this.options.end){var tm=this.toMin(str);var tm1=this.toMin(this.options.start);var tm2=this.toMin(this.options.end);if(!tm1)tm1=tm;if(!tm2)tm2=tm;if(tm>=tm1&&tm<=tm2)inRange=true}else{inRange=true}}return inRange},checkType:function(ch,loose){var obj=this;switch(obj.type){case"int":if(loose&&["-"].indexOf(ch)!=-1)return true;return w2utils.isInt(ch.replace(obj.options.numberRE,""));case"percent":ch=ch.replace(/%/g,"");case"float":if(loose&&["-","."].indexOf(ch)!=-1)return true;return w2utils.isFloat(ch.replace(obj.options.numberRE,""));case"money":case"currency":if(loose&&["-",".",obj.options.groupSymbol,obj.options.currencyPrefix,obj.options.currencySuffix].indexOf(ch)!=-1)return true;return w2utils.isFloat(ch.replace(obj.options.moneyRE,""));case"hex":case"color":return w2utils.isHex(ch);case"alphanumeric":return w2utils.isAlphaNumeric(ch)}return true},addPrefix:function(){var obj=this;setTimeout(function(){var helper;var tmp=$(obj.el).data("tmp")||{};tmp["old-padding-left"]=$(obj.el).css("padding-left");$(obj.el).data("tmp",tmp);if(obj.options.prefix!==""){$(obj.el).before('
    '+obj.options.prefix+"
    ");helper=$(obj.el).prev();helper.css({color:$(obj.el).css("color"),"font-family":$(obj.el).css("font-family"),"font-size":$(obj.el).css("font-size"),"padding-top":$(obj.el).css("padding-top"),"padding-bottom":$(obj.el).css("padding-bottom"),"padding-left":$(obj.el).css("padding-left"),"padding-right":0,"margin-top":parseInt($(obj.el).css("margin-top"),10)+1+"px","margin-bottom":parseInt($(obj.el).css("margin-bottom"),10)+1+"px","margin-left":$(obj.el).css("margin-left"),"margin-right":0}).on("click",function(){$(obj).next().focus()});$(obj.el).css("padding-left",helper.width()+parseInt($(obj.el).css("padding-left"),10)+"px");obj.helpers["prefix"]=helper}},1)},addSuffix:function(){var obj=this;var helper,pr;setTimeout(function(){var tmp=$(obj.el).data("tmp")||{};tmp["old-padding-right"]=$(obj.el).css("padding-right");$(obj.el).data("tmp",tmp);pr=parseInt($(obj.el).css("padding-right"),10);if(obj.options.arrows){$(obj.el).after('
     '+'
    '+'
    '+"
    "+'
    '+'
    '+"
    "+"
    ");var height=w2utils.getSize(obj.el,"height");helper=$(obj.el).next();helper.css({color:$(obj.el).css("color"),"font-family":$(obj.el).css("font-family"),"font-size":$(obj.el).css("font-size"),height:$(obj.el).height()+parseInt($(obj.el).css("padding-top"),10)+parseInt($(obj.el).css("padding-bottom"),10)+"px",padding:0,"margin-top":parseInt($(obj.el).css("margin-top"),10)+1+"px","margin-bottom":0,"border-left":"1px solid silver"}).css("margin-left","-"+(helper.width()+parseInt($(obj.el).css("margin-right"),10)+12)+"px").on("mousedown",function(event){$("body").on("mouseup",tmp);$("body").data("_field_update_timer",setTimeout(update,700));update(false);function tmp(){clearTimeout($("body").data("_field_update_timer"));$("body").off("mouseup",tmp)}function update(notimer){$(obj.el).focus();obj.keyDown($.Event("keydown"),{keyCode:$(event.target).attr("type")=="up"?38:40});if(notimer!==false)$("body").data("_field_update_timer",setTimeout(update,60))}});pr+=helper.width()+12;$(obj.el).css("padding-right",pr+"px");obj.helpers["arrows"]=helper}if(obj.options.suffix!==""){$(obj.el).after('
    '+obj.options.suffix+"
    ");helper=$(obj.el).next();helper.css({color:$(obj.el).css("color"),"font-family":$(obj.el).css("font-family"),"font-size":$(obj.el).css("font-size"),"padding-top":$(obj.el).css("padding-top"),"padding-bottom":$(obj.el).css("padding-bottom"),"padding-left":"3px","padding-right":$(obj.el).css("padding-right"),"margin-top":parseInt($(obj.el).css("margin-top"),10)+1+"px","margin-bottom":parseInt($(obj.el).css("margin-bottom"),10)+1+"px"}).on("click",function(){$(obj).prev().focus()});helper.css("margin-left","-"+(w2utils.getSize(helper,"width")+parseInt($(obj.el).css("margin-right"),10)+2)+"px");pr+=helper.width()+3;$(obj.el).css("padding-right",pr+"px");obj.helpers["suffix"]=helper}},1)},addMulti:function(){var obj=this;var options=this.options;$(obj.helpers["multi"]).remove();var html="";var margin="margin-top : 0px; "+"margin-bottom : 0px; "+"margin-left : "+$(obj.el).css("margin-left")+"; "+"margin-right : "+$(obj.el).css("margin-right")+"; "+"width : "+(w2utils.getSize(obj.el,"width")-parseInt($(obj.el).css("margin-left"),10)-parseInt($(obj.el).css("margin-right"),10))+"px;";if(obj.type=="enum"){html='
    '+'
    '+"
      "+'
    • '+' "+"
    • ";"
    "+"
    "+"
    "}if(obj.type=="file"){html='
    '+'
    '+'
    '+' ';"
    "+"
    "}$(obj.el).before(html).css({"background-color":"transparent","border-color":"transparent"});var div=$(obj.el).prev();obj.helpers["multi"]=div;if(obj.type=="enum"){$(obj.el).attr("tabindex",-1);div.find("input").on("click",function(event){if($("#w2ui-overlay").length==0)obj.focus(event)}).on("focus",function(event){$(div).css({outline:"auto 5px -webkit-focus-ring-color","outline-offset":"-2px"});obj.focus(event);if(event.stopPropagation)event.stopPropagation();else event.cancelBubble=true}).on("blur",function(event){$(div).css("outline","none");obj.blur(event);if(event.stopPropagation)event.stopPropagation();else event.cancelBubble=true}).on("keyup",function(event){obj.keyUp(event)}).on("keydown",function(event){obj.keyDown(event)}).on("keypress",function(event){div.find(".w2ui-enum-placeholder").remove();obj.keyPress(event)});div.on("click",function(event){$(this).find("input").focus()})}if(obj.type=="file"){$(obj.el).css("outline","none");div.on("click",function(event){obj.blur(event);div.find("input").click()}).on("dragenter",function(event){$(div).addClass("w2ui-file-dragover")}).on("dragleave",function(event){var tmp=$(event.target).parents(".w2ui-field-helper");if(tmp.length==0)$(div).removeClass("w2ui-file-dragover")}).on("drop",function(event){$(div).removeClass("w2ui-file-dragover");var files=event.originalEvent.dataTransfer.files;for(var i=0,l=files.length;ioptions.maxFileSize){err="Maximum file size is "+w2utils.size(options.maxFileSize);if(options.silent===false)$(obj.el).w2tag(err);console.log("ERROR: "+err);return}if(options.maxSize!==0&&size+newItem.size>options.maxSize){err="Maximum total size is "+w2utils.size(options.maxSize);if(options.silent===false)$(obj.el).w2tag(err);console.log("ERROR: "+err);return}if(options.max!==0&&cnt>=options.max){err="Maximum number of files is "+options.max;if(options.silent===false)$(obj.el).w2tag(err);console.log("ERROR: "+err);return}selected.push(newItem);if(typeof FileReader!=="undefined"){var reader=new FileReader;reader.onload=function(){return function(event){var fl=event.target.result;var ind=fl.indexOf(",");newItem.content=fl.substr(ind+1);obj.refresh();$(obj.el).trigger("change");obj.trigger($.extend(eventData,{phase:"after"}))}}();reader.readAsDataURL(file)}else{obj.refresh();$(obj.el).trigger("change")}},getColorHTML:function(){var html='
    '+'';var colors=[["000000","444444","666666","999999","CCCCCC","EEEEEE","F3F3F3","FFFFFF"],["FF011B","FF9838","FFFD59","01FD55","00FFFE","0424F3","9B24F4","FF21F5"],["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"],["660205","783F0B","7F6011","274E12","0C343D","063762","20124D","4C1030"]];for(var i=0;i<8;i++){html+="";for(var j=0;j<8;j++){html+=""}html+="";if(i<2)html+=''}html+="
    "+'
    '+" "+($(this.el).val()==colors[i][j]?"•":" ")+"
    "+"
    ";return html},getMonthHTML:function(month,year){var td=new Date;var months=w2utils.settings.fullmonths;var days=w2utils.settings.fulldays;var daysCount=["31","28","31","30","31","30","31","31","30","31","30","31"];var today=td.getFullYear()+"/"+(Number(td.getMonth())+1)+"/"+td.getDate();year=w2utils.isInt(year)?parseInt(year):td.getFullYear();month=w2utils.isInt(month)?parseInt(month):td.getMonth()+1;if(month>12){month-=12;year++}if(month<1||month===0){month+=12;year--}if(year/4==Math.floor(year/4)){daysCount[1]="29"}else{daysCount[1]="28"}this.options.current=month+"/"+year;td=new Date(year,month-1,1);var weekDay=td.getDay();var tabDays=w2utils.settings.shortdays;var dayTitle="";for(var i=0,len=tabDays.length;i"+tabDays[i]+""}var html='
    '+' '+' '+months[month-1]+", "+year+"
    "+''+' '+dayTitle+""+" ";var day=1;for(var ci=1;ci<43;ci++){if(weekDay===0&&ci==1){for(var ti=0;ti<6;ti++)html+='';ci+=6}else{if(cidaysCount[month-1]){html+='';if(ci%7===0)html+="";continue}}var dt=year+"/"+month+"/"+day;var className="";if(ci%7==6)className=" w2ui-saturday";if(ci%7===0)className=" w2ui-sunday";if(dt==today)className+=" w2ui-today";var dspDay=day;var col="";var bgcol="";var tmp_dt=w2utils.formatDate(dt,this.options.format);if(this.options.colored&&this.options.colored[tmp_dt]!==undefined){tmp=this.options.colored[tmp_dt].split(":");bgcol="background-color: "+tmp[0]+";";col="color: "+tmp[1]+";"}html+='";if(ci%7===0||weekDay===0&&ci==1)html+="";day++}html+="
      
    '+dspDay+"
    ";return html},getHourHTML:function(){var tmp=[];var h24=this.options.format=="h24"?true:false;for(var a=0;a<24;a++){var time=(a>=12&&!h24?a-12:a)+":00"+(!h24?a<12?" am":" pm":"");if(a==12&&!h24)time="12:00 pm";if(!tmp[Math.floor(a/8)])tmp[Math.floor(a/8)]="";var tm1=this.fromMin(this.toMin(time));var tm2=this.fromMin(this.toMin(time)+59);tmp[Math.floor(a/8)]+='
    '+time+"
    "}var html='
    '+" "+" "+" "+"
    "+tmp[0]+""+tmp[1]+""+tmp[2]+"
    ";return html},getMinHTML:function(hour){if(typeof hour=="undefined")hour=0;var h24=this.options.format=="h24"?true:false;var tmp=[];for(var a=0;a<60;a+=5){var time=(hour>12&&!h24?hour-12:hour)+":"+(a<10?0:"")+a+" "+(!h24?hour<12?"am":"pm":"");var ind=a<20?0:a<40?1:2;if(!tmp[ind])tmp[ind]="";tmp[ind]+='
    '+time+"
    "}var html='
    '+" "+" "+" "+"
    "+tmp[0]+""+tmp[1]+""+tmp[2]+"
    ";return html},toMin:function(str){if(typeof str!="string")return null;var tmp=str.split(":");if(tmp.length==2){tmp[0]=parseInt(tmp[0]);tmp[1]=parseInt(tmp[1]);if(str.indexOf("pm")!=-1&&tmp[0]!=12)tmp[0]+=12}else{return null}return tmp[0]*60+tmp[1]},fromMin:function(time){var ret="";if(time>=24*60)time=time%(24*60);if(time<0)time=24*60+time;var hour=Math.floor(time/60);var min=(time%60<10?"0":"")+time%60;if(this.options.format.indexOf("h24")!=-1){ret=hour+":"+min}else{ret=(hour<=12?hour:hour-12)+":"+min+" "+(hour>=12?"pm":"am")}return ret}};$.extend(w2field.prototype,w2utils.event);w2obj.field=w2field})(jQuery);