function clearCalender(n){$(n).val("")}var RallyPeople,dateFormat;(function(){"use strict";function n(n){function s(s,h){var rt,ut,p=s==window,l=h&&h.message!==undefined?h.message:undefined,g,k,d,tt,nt,w,b,it,ft,et,at;if(h=n.extend({},n.blockUI.defaults,h||{}),!h.ignoreIfBlocked||!n(s).data("blockUI.isBlocked")){if(h.overlayCSS=n.extend({},n.blockUI.defaults.overlayCSS,h.overlayCSS||{}),rt=n.extend({},n.blockUI.defaults.css,h.css||{}),h.onOverlayClick&&(h.overlayCSS.cursor="pointer"),ut=n.extend({},n.blockUI.defaults.themedCSS,h.themedCSS||{}),l=l===undefined?h.message:l,p&&t&&e(window,{fadeOut:0}),l&&typeof l!="string"&&(l.parentNode||l.jquery)&&(g=l.jquery?l[0]:l,k={},n(s).data("blockUI.history",k),k.el=g,k.parent=g.parentNode,k.display=g.style.display,k.position=g.style.position,k.parent&&k.parent.removeChild(g)),n(s).data("blockUI.onUnblock",h.onUnblock),d=h.baseZ,tt=f||h.forceIframe?n('<iframe class="blockUI" style="z-index:'+d+++';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+h.iframeSrc+'"><\/iframe>'):n('<div class="blockUI" style="display:none"><\/div>'),nt=h.theme?n('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+d+++';display:none"><\/div>'):n('<div class="blockUI blockOverlay" style="z-index:'+d+++';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"><\/div>'),h.theme&&p?(b='<div class="blockUI '+h.blockMsgClass+' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(d+10)+';display:none;position:fixed">',h.title&&(b+='<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(h.title||"&nbsp;")+"<\/div>"),b+='<div class="ui-widget-content ui-dialog-content"><\/div>',b+="<\/div>"):h.theme?(b='<div class="blockUI '+h.blockMsgClass+' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(d+10)+';display:none;position:absolute">',h.title&&(b+='<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(h.title||"&nbsp;")+"<\/div>"),b+='<div class="ui-widget-content ui-dialog-content"><\/div>',b+="<\/div>"):b=p?'<div class="blockUI '+h.blockMsgClass+' blockPage" style="z-index:'+(d+10)+';display:none;position:fixed"><\/div>':'<div class="blockUI '+h.blockMsgClass+' blockElement" style="z-index:'+(d+10)+';display:none;position:absolute"><\/div>',w=n(b),l&&(h.theme?(w.css(ut),w.addClass("ui-widget-content")):w.css(rt)),h.theme||nt.css(h.overlayCSS),nt.css("position",p?"fixed":"absolute"),(f||h.forceIframe)&&tt.css("opacity",0),it=[tt,nt,w],ft=p?n("body"):n(s),n.each(it,function(){this.appendTo(ft)}),h.theme&&h.draggable&&n.fn.draggable&&w.draggable({handle:".ui-dialog-titlebar",cancel:"li"}),et=v&&(!n.support.boxModel||n("object,embed",p?null:s).length>0),o||et){if(p&&h.allowBodyStretch&&n.support.boxModel&&n("html,body").css("height","100%"),(o||!n.support.boxModel)&&!p)var ot=r(s,"borderTopWidth"),st=r(s,"borderLeftWidth"),ht=ot?"(0 - "+ot+")":0,ct=st?"(0 - "+st+")":0;n.each(it,function(n,t){var i=t[0].style,r,u;i.position="absolute";n<2?(p?i.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:"+h.quirksmodeOffsetHack+') + "px"'):i.setExpression("height",'this.parentNode.offsetHeight + "px"'),p?i.setExpression("width",'jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):i.setExpression("width",'this.parentNode.offsetWidth + "px"'),ct&&i.setExpression("left",ct),ht&&i.setExpression("top",ht)):h.centerY?(p&&i.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'),i.marginTop=0):!h.centerY&&p&&(r=h.css&&h.css.top?parseInt(h.css.top,10):0,u="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+r+') + "px"',i.setExpression("top",u))})}if(l&&(h.theme?w.find(".ui-widget-content").append(l):w.append(l),(l.jquery||l.nodeType)&&n(l).show()),(f||h.forceIframe)&&h.showOverlay&&tt.show(),h.fadeIn){var lt=h.onBlock?h.onBlock:u,vt=h.showOverlay&&!l?lt:u,yt=l?lt:u;h.showOverlay&&nt._fadeIn(h.fadeIn,vt);l&&w._fadeIn(h.fadeIn,yt)}else h.showOverlay&&nt.show(),l&&w.show(),h.onBlock&&h.onBlock.bind(w)();c(1,s,h);p?(t=w[0],i=n(h.focusableElements,t),h.focusInput&&setTimeout(a,20)):y(w[0],h.centerX,h.centerY);h.timeout&&(at=setTimeout(function(){p?n.unblockUI(h):n(s).unblock(h)},h.timeout),n(s).data("blockUI.timeout",at))}}function e(r,u){var o,s=r==window,e=n(r),l=e.data("blockUI.history"),a=e.data("blockUI.timeout"),f;a&&(clearTimeout(a),e.removeData("blockUI.timeout"));u=n.extend({},n.blockUI.defaults,u||{});c(0,r,u);u.onUnblock===null&&(u.onUnblock=e.data("blockUI.onUnblock"),e.removeData("blockUI.onUnblock"));f=s?n("body").children().filter(".blockUI").add("body > .blockUI"):e.find(">.blockUI");u.cursorReset&&(f.length>1&&(f[1].style.cursor=u.cursorReset),f.length>2&&(f[2].style.cursor=u.cursorReset));s&&(t=i=null);u.fadeOut?(o=f.length,f.stop().fadeOut(u.fadeOut,function(){--o==0&&h(f,l,u,r)})):h(f,l,u,r)}function h(t,i,r,u){var f=n(u);if(!f.data("blockUI.isBlocked")){if(t.each(function(){this.parentNode&&this.parentNode.removeChild(this)}),i&&i.el&&(i.el.style.display=i.display,i.el.style.position=i.position,i.el.style.cursor="default",i.parent&&i.parent.appendChild(i.el),f.removeData("blockUI.history")),f.data("blockUI.static")&&f.css("position","static"),typeof r.onUnblock=="function")r.onUnblock(u,r);var e=n(document.body),o=e.width(),s=e[0].style.width;e.width(o-1).width(o);e[0].style.width=s}}function c(i,r,u){var f=r==window,o=n(r),e;(i||(!f||t)&&(f||o.data("blockUI.isBlocked")))&&(o.data("blockUI.isBlocked",i),f&&u.bindEvents&&(!i||u.showOverlay))&&(e="mousedown mouseup keydown keypress keyup touchstart touchend touchmove",i?n(document).bind(e,u,l):n(document).unbind(e,l))}function l(r){var u,f;if(r.type==="keydown"&&r.keyCode&&r.keyCode==9&&t&&r.data.constrainTabKey){var e=i,s=!r.shiftKey&&r.target===e[e.length-1],o=r.shiftKey&&r.target===e[0];if(s||o)return setTimeout(function(){a(o)},10),!1}if(u=r.data,f=n(r.target),f.hasClass("blockOverlay")&&u.onOverlayClick)u.onOverlayClick(r);return f.parents("div."+u.blockMsgClass).length>0?!0:f.parents().children().filter("div.blockUI").length===0}function a(n){if(i){var t=i[n===!0?i.length-1:0];t&&t.focus()}}function y(n,t,i){var u=n.parentNode,f=n.style,e=(u.offsetWidth-n.offsetWidth)/2-r(u,"borderLeftWidth"),o=(u.offsetHeight-n.offsetHeight)/2-r(u,"borderTopWidth");t&&(f.left=e>0?e+"px":"0");i&&(f.top=o>0?o+"px":"0")}function r(t,i){return parseInt(n.css(t,i),10)||0}var t,i;n.fn._fadeIn=n.fn.fadeIn;var u=n.noop||function(){},f=/MSIE/.test(navigator.userAgent),o=/MSIE 6.0/.test(navigator.userAgent)&&!/MSIE 8.0/.test(navigator.userAgent),p=document.documentMode||0,v=n.isFunction(document.createElement("div").style.setExpression);n.blockUI=function(n){s(window,n)};n.unblockUI=function(n){e(window,n)};n.growlUI=function(t,i,r,u){var f=n('<div class="growlUI"><\/div>'),e,o;t&&f.append("<h1>"+t+"<\/h1>");i&&f.append("<h2>"+i+"<\/h2>");r===undefined&&(r=3e3);e=function(t){t=t||{};n.blockUI({message:f,fadeIn:typeof t.fadeIn!="undefined"?t.fadeIn:700,fadeOut:typeof t.fadeOut!="undefined"?t.fadeOut:1e3,timeout:typeof t.timeout!="undefined"?t.timeout:r,centerY:!1,showOverlay:!1,onUnblock:u,css:n.blockUI.defaults.growlCSS})};e();o=f.css("opacity");f.mouseover(function(){e({fadeIn:0,timeout:3e4});var t=n(".blockMsg");t.stop();t.fadeTo(300,1)}).mouseout(function(){n(".blockMsg").fadeOut(1e3)})};n.fn.block=function(t){if(this[0]===window)return n.blockUI(t),this;var i=n.extend({},n.blockUI.defaults,t||{});return this.each(function(){var t=n(this);i.ignoreIfBlocked&&t.data("blockUI.isBlocked")||t.unblock({fadeOut:0})}),this.each(function(){n.css(this,"position")=="static"&&(this.style.position="relative",n(this).data("blockUI.static",!0));this.style.zoom=1;s(this,t)})};n.fn.unblock=function(t){return this[0]===window?(n.unblockUI(t),this):this.each(function(){e(this,t)})};n.blockUI.version=2.7;n.blockUI.defaults={message:"<h1>Please wait...<\/h1>",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},cursorReset:"default",growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,focusableElements:":input:enabled:visible",onBlock:null,onUnblock:null,onOverlayClick:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg",ignoreIfBlocked:!1};t=null;i=[]}typeof define=="function"&&define.amd&&define.amd.jQuery?define(["jquery"],n):n(jQuery)})();RallyPeople=RallyPeople||{};RallyPeople={HTMLtags:{html:"html",head:"head",body:"body",base:"base",meta:"meta",title:"title",link:"link",style:"style",script:"script",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",div:"div",span:"span",p:"p",br:"br",hr:"hr",a:"a",strong:"strong",em:"em",blockquote:"blockquote",q:"q",abbr:"abbr",acronym:"acronym",address:"address",pre:"pre",dfn:"dfn",code:"code",cite:"cite",del:"del",ins:"ins",sub:"sub",sup:"sup",bdo:"bdo",ol:"ol",ul:"ul",li:"li",dl:"dl",dt:"dt",dd:"dd",form:"form",fieldset:"fieldset",legend:"legend",label:"label",input:"input",select:"select",optgroup:"optgroup",option:"option",textarea:"textarea",button:"button",table:"table",caption:"caption",thead:"thead",tbody:"tbody",tfoot:"tfoot",colgroup:"colgroup",col:"col",tr:"tr",th:"th",td:"td",img:"img",map:"map",area:"area",object:"object",param:"param",area:"area",base:"base",br:"br",col:"col",hr:"hr",toTags:function(n){switch(n){case"img":case"br":case"link":case"meta":return"<"+n+"/>";default:return"<"+n+"><\/"+n+">"}}},HTMLCoreAttributes:{CssClass:"class",Id:"id",Style:"style",Title:"title"},HTMLElementProperties:{checked:"checked",type:"type",Value:"value",disabled:"disabled",enabled:"enabled",href:"href",rel:"rel",rev:"rev",target:"target",height:"height",width:"width",maxLength:"maxLength",readOnly:"readOnly",size:"size",align:"align",border:"border",text:"text",selectedIndex:"selectedIndex",length:"length",cellPadding:"cellPadding",cellSpacing:"cellSpacing",colSpan:"colSpan",rowSpan:"rowSpan",vAlign:"vAlign",rowIndex:"rowIndex",sectionRowIndex:"sectionRowIndex",cols:"cols",rows:"rows",src:"src"},jQuerySelectorQualifier:{visible:"visible",hidden:"hidden",disabled:"disabled",enabled:"enabled",checked:"checked",selected:"selected",first:"first",last:"last",even:"even",odd:"odd",empty:"empty",header:"header",animated:"animated",parent:"parent"}};RallyPeople.alert=function(n,t){$("#customAlertModalLabel").empty().text(n||"");$("#customAlertModalBody").empty().text(t);$("#customAlertModal").modal()};RallyPeople.Util={inferUrl:function(n,t){var f=window.location,o=f.pathname,i=f.pathname.split("/"),e=i[i.length-1],r,u;for((t==undefined||t==null)&&(t=i.length>1?i[1]:""),r=0,u=[],r=0;r<i.length;r++)i[r]!=""&&i[r]!=e&&i[r]!=t&&u.push("../");return u.join("")+n},Event_KeyDown:function(n){var r,i,t;try{if(n.keyCode==13&&(n.preventDefault(),r=n.target,ObjCtrl=$(":input[type!=hidden]"),ObjCtrl.length!=0))for(i=0;i<ObjCtrl.length;i++)if(ObjCtrl[i].id==r.id.toString())for(t=i+1;t<ObjCtrl.length;t++)if(!ObjCtrl[t].disabled&&ObjCtrl[t].type!="button"){ObjCtrl[t].focus();break}}catch(u){}},fnReplaceStringTypeNull:function(n){return typeof n==undefined?"":n==null?"":n},testAttribute:function(n,t){var i=document.createElement(n);return t in i?!0:!1},fn_backToFirstField:function(n){$(n).find("input[type=text],input[type=radio],select").filter(':visible:enabled:last:not([readonly="readonly"])').on("keydown",function(t){if(t.which==9)return $(n).find("input[type=text],input[type=radio],select").filter(':visible:enabled:first:not([readonly="readonly"])').focus().select(),!1})},MaskInputNumberOnly:function(n){$(n).keydown(function(n){$.inArray(n.keyCode,[46,8,9,27,13,110,190])!==-1||n.keyCode==65&&n.ctrlKey===!0||n.keyCode>=35&&n.keyCode<=39||(n.shiftKey||n.keyCode<48||n.keyCode>57)&&(n.keyCode<96||n.keyCode>105)&&n.preventDefault()})},OpenQueryCtrlWidth:750,OpenQueryCtrlHeight:470,OpenDivDialogName:"OpenDivDialogWrapper",OpenDivDialogWidth:760,OpenDivDialogHeight:600,GetLanguageResource:function(n,t,i){var r="";return $.ajax({async:i,type:"POST",url:n,data:JSON.stringify({ColLan:t}),contentType:"application/json; charset=utf-8",dataType:"json",error:function(n){var t=null;t=typeof n=="object"?n.responseJSON&&n.responseJSON.Message?n.responseJSON.Message:typeof n.responseText=="string"?JSON.parse(n.responseText).Message:n.responseText.Message:JSON.parse(n).responseText.Message;alert(t)},success:function(n){r=n.d}}),r},HotKeys:[{Hotkey:"Alt+s",handler:function(){return $("#btn_save").click()}},{Hotkey:"Alt+q",handler:function(){return $("#btn_search").click()}},{Hotkey:"Alt+n",handler:function(){return $("#btn_insert").click()}}],moveToNextTableRow:function(n){$(n).keydown(function(n){if(n.altKey&&(n.which===48||n.which===96)){var r=$(n.target).closest("table").find("tr:visible").index($(n.target).closest("tr")),t=r+1;for(i=r+1;i<$(n.target).closest("table").find("tr:visible").length;i++)if($(n.target).closest("table").find("tr:visible").eq(i).find("input[type=text],input[type=radio],select").length==0)t+=1;else break;return t==$(n.target).closest("table").find("tr:visible").length&&(t=0),$(n.target).closest("table").find("tr:visible").eq(t).find("input[type=text],input[type=radio],select").filter(':visible:enabled:not([readonly="readonly"]):first').focus().select(),!1}})}};dateFormat=function(){var t=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,i=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,r=/[^-+\dA-Z]/g,n=function(n,t){for(n=String(n),t=t||2;n.length<t;)n="0"+n;return n};return function(u,f,e){var h=dateFormat;if(arguments.length!=1||Object.prototype.toString.call(u)!="[object String]"||/\d/.test(u)||(f=u,u=undefined),u=u?new Date(u):new Date,isNaN(u))throw SyntaxError("invalid date");f=String(h.masks[f]||f||h.masks["default"]);f.slice(0,4)=="UTC:"&&(f=f.slice(4),e=!0);var o=e?"getUTC":"get",c=u[o+"Date"](),y=u[o+"Day"](),l=u[o+"Month"](),p=u[o+"FullYear"](),s=u[o+"Hours"](),w=u[o+"Minutes"](),b=u[o+"Seconds"](),a=u[o+"Milliseconds"](),v=e?0:u.getTimezoneOffset(),k={d:c,dd:n(c),ddd:h.i18n.dayNames[y],dddd:h.i18n.dayNames[y+7],M:l+1,MM:n(l+1),MMM:h.i18n.monthNames[l],MMMM:h.i18n.monthNames[l+12],yy:String(p).slice(2),yyyy:p,h:s%12||12,hh:n(s%12||12),H:s,HH:n(s),m:w,mm:n(w),s:b,ss:n(b),l:n(a,3),L:n(a>99?Math.round(a/10):a),t:s<12?"a":"p",tt:s<12?"am":"pm",T:s<12?"A":"P",TT:s<12?"AM":"PM",Z:e?"UTC":(String(u).match(i)||[""]).pop().replace(r,""),o:(v>0?"-":"+")+n(Math.floor(Math.abs(v)/60)*100+Math.abs(v)%60,4),S:["th","st","nd","rd"][c%10>3?0:(c%100-c%10!=10)*c%10]};return f.replace(t,function(n){return n in k?k[n]:n.slice(1,n.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(n,t){return dateFormat(this,n,t)};Date.prototype.dateAdd=function(interval,number){var d=this,k={y:"FullYear",q:"Month",m:"Month",w:"Date",d:"Date",h:"Hours",n:"Minutes",s:"Seconds",ms:"MilliSeconds"},n={q:3,w:7};return eval("d.set"+k[interval]+"(d.get"+k[interval]+"()+"+(n[interval]||1)*number+")"),d};Date.prototype.dateDiff=function(n,t){var r=this,i={},u=r.getTime(),f=t.getTime();return i.y=t.getFullYear()-r.getFullYear(),i.q=i.y*4+Math.floor(t.getMonth()/4)-Math.floor(r.getMonth()/4),i.m=i.y*12+t.getMonth()-r.getMonth(),i.ms=t.getTime()-r.getTime(),i.w=Math.floor((f+3456e5)/6048e5)-Math.floor((u+3456e5)/6048e5),i.d=Math.floor(f/864e5)-Math.floor(u/864e5),i.h=Math.floor(f/36e5)-Math.floor(u/36e5),i.n=Math.floor(f/6e4)-Math.floor(u/6e4),i.s=Math.floor(f/1e3)-Math.floor(u/1e3),i[n]};typeof String.prototype.trim!="function"&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});Array.prototype.indexOf!=="function"&&(Array.prototype.indexOf=function(n){var i=this.length>>>0,t=Number(arguments[1])||0;for(t=t<0?Math.ceil(t):Math.floor(t),t<0&&(t+=i);t<i;t++)if(t in this&&this[t]===n)return t;return-1});String.prototype.Blength=function(){var n=this.match(/[^\x00-\xff]/ig);return n==null?this.length:this.length+n.length};typeof String.prototype.padLeft!="function"&&(String.prototype.padLeft=function(n,t){return Array(n-this.length+1).join(t||" ")+this});typeof String.prototype.padRight!="function"&&(String.prototype.padRight=function(n,t){return this+Array(n-this.length+1).join(t||" ")});RallyPeople.CommonUtility=null;RallyPeople.CommonUtility={CommonUtil:{KeyList:"123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",fh_checkTB:function(n){var i=n.value,f=[1,2,1,2,1,2,4,1],r=0,u=0,t;if(i.match(/^\d{8}$/)){for(t=0;t<f.length;t++)r=i.charAt(t)*f[t],u+=Math.floor(r/10)+r%10;return u%10==0||(u+1)%10==0&&i.charAt(6)==7?!0:(alert("發票編號格式錯誤!"),!1)}return alert("發票編號格式錯誤!"),!1}}};RallyPeople.CommonUtility.CommonUtil.RandomGenKey=function(n){for(var i=[],r=RallyPeople.CommonUtility.CommonUtil.KeyList.length,t=0;t<n;t++)i.push(RallyPeople.CommonUtility.CommonUtil.KeyList.charAt(Math.floor(Math.random()*r)));return i.join("")};RallyPeople.CommonUtility.CommonUtil.checkPid=function(n){if((n=n.toUpperCase(),tab="ABCDEFGHJKLMNPQRSTUVXYWZIO",A1=[1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3],A2=[0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5],Mx=[9,8,7,6,5,4,3,2,1,1],n.length!=10)||(i=tab.indexOf(n.charAt(0)),i==-1))return!1;for(sum=A1[i]+A2[i]*9,i=1;i<10;i++){if(v=parseInt(n.charAt(i)),isNaN(v))return!1;sum=sum+v*Mx[i]}return sum%10!=0?!1:!0};RallyPeople.CommonUtility.CommonUtil.chkNum=function(n){for(var i,r="0123456789",t=0;t<n.length;t++)if(i=r.indexOf(n.charAt(t)),i==-1)return!1;return!0};RallyPeople.CommonUtility.CommonUtil.chkMail=function(n){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(n)?!0:!1};RallyPeople.CommonUtility.CommonUtil.base64ToArrayBuffer=function(n){for(var i=window.atob(n),r=i.length,u=new Uint8Array(r),f,t=0;t<r;t++)f=i.charCodeAt(t),u[t]=f;return u};RallyPeople.CommonUtility.CommonUtil.roundDecimal=function(n,t){return Math.round(Math.round(n*Math.pow(10,(t||0)+1))/10)/Math.pow(10,t||0)};RallyPeople.CommonUtility.TWyearUtil={substractYear:1911,validateTWDate:function(n){var f,t,u,i,e,r;if(n.length<6||n.length>7)return!1;if(/^(\d{2,3}(0?[1-9]|1[012])(0?[1-9]|[12][0-9]|3[01]))$/.test(n)){if((t=[],n.length<=6?(t.push(n.substr(0,2)),t.push(n.substr(2,2)),t.push(n.substr(4,2))):(t.push(n.substr(0,3)),t.push(n.substr(3,2)),t.push(n.substr(5,2))),f=parseInt(t[0])+RallyPeople.CommonUtility.TWyearUtil.substractYear,u={"01":31,"03":31,"04":30,"05":31,"06":30,"07":31,"08":31,"09":30,"10":31,"11":30,"12":31},i=parseInt(t[2],10),u[t[1]]!=null&&i<=u[t[1]]&&i!=0)||(e=parseInt(t[1],10),e==2&&((r=f,i>0&&i<29)||i==29&&(r%4==0&&r%100!=0||r%400==0))))return!0}else return!1;return!1},validateACDate:function(n){var f,t,u,i,e,r;if(n.length!=8)return!1;if(/^(\d{4}(0?[1-9]|1[012])(0?[1-9]|[12][0-9]|3[01]))$/.test(n)){if((t=[],t.push(n.substr(0,4)),t.push(n.substr(4,2)),t.push(n.substr(6,2)),f=parseInt(t[0]),u={"01":31,"03":31,"04":30,"05":31,"06":30,"07":31,"08":31,"09":30,"10":31,"11":30,"12":31},i=parseInt(t[2],10),u[t[1]]!=null&&i<=u[t[1]]&&i!=0)||(e=parseInt(t[1],10),e==2&&((r=f,i>0&&i<29)||i==29&&(r%4==0&&r%100!=0||r%400==0))))return!0}else return!1;return!1},trimAll:function(n){var t=/^(\s*)$/;return t.test(n)&&(n=n.replace(t,""),n.length==0)?n:(t=/^(\s*)([\W\w]*)(\b\s*$)/,t.test(n)&&(n=n.replace(t,"$2")),n)},validateEmail:function(n){return/(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i.test(n)},validateNumeric:function(n){return/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/.test(n)},validateInteger:function(n){return/(^-?\d\d*$)/.test(n)},validateNotEmpty:function(n){var t=n;return(t=$.trim(t),t.length>0)?!0:!1},validateValue:function(n,t){var i=new RegExp(t);return i.test(n)},TransTWYearToAC:function(n,t){if(typeof n=="string"){if(n==="")return"";(t==null||t==undefined)&&(t="");var i=0;return n.length<=6?(i=parseInt(n.substr(0,2)),i+=RallyPeople.CommonUtility.TWyearUtil.substractYear,i.toString()+t+n.substr(2,2)+t+n.substr(4,2)):(i=parseInt(n.substr(0,3)),i+=RallyPeople.CommonUtility.TWyearUtil.substractYear,i.toString()+t+n.substr(3,2)+t+n.substr(5,2))}return""},TransTWYearToAC2:function(n,t){return typeof n=="string"?n!==""?RallyPeople.CommonUtility.TWyearUtil.PadTWYear(n,t):n:n},TransACYearToTW:function(n,t){if(n==="")return"";if(typeof n=="string"){(t==null||t==undefined)&&(t="");var i=0;return i=parseInt(n.substr(0,4)),i-=RallyPeople.CommonUtility.TWyearUtil.substractYear,i.toString()+t+n.substr(4,2)+t+n.substr(6,2)}return""},ConcatTWYear:function(n,t){return n===""?"":typeof n=="string"?n.length<=6?n.substr(0,2)+t+n.substr(2,2)+t+n.substr(4,2):n.substr(0,3)+t+n.substr(3,2)+t+n.substr(5,2):""},PadTWYear:function(n,t){if(typeof n=="string"){if(n!==""){(t==null||t==undefined)&&(t="/");var i=n.split(t);return i[0].length<3&&(i[0]="0"+i[0]),i[1].length<2&&(i[1]="0"+i[1]),i[2].length<2&&(i[2]="0"+i[2]),i.join(t)}return n}return n},ConcatACYear:function(n,t){return n===""?"":typeof n=="string"?n.substr(0,4)+t+n.substr(4,2)+t+n.substr(6,2):""},CalTwYearDiff:function(n,t,i){var u,f,r;return(s_d=n.substr(n.length-2,2),s_m=n.substr(n.length-4,2),s_y=n.substr(0,n.length-4),u=s_m+"/"+s_d+"/"+(parseInt(s_y)+1911),dt_s=new Date(u),s_d=t.substr(t.length-2,2),s_m=t.substr(t.length-4,2),s_y=t.substr(0,t.length-4),f=s_m+"/"+s_d+"/"+(parseInt(s_y)+1911),r=new Date(f),i=="d")?dt_s.dateDiff("d",r):i=="m"?dt_s.dateDiff("m",r):-1}};RallyPeople.showMessageBox=function(n,t,i){(i==undefined||i==null)&&(i=3e4);$.iaoAlert({msg:t,type:n,mode:"dark",alertTime:i,zIndex:"99999"})};RallyPeople.CommonUtility.UIUtil={easyBlock:function(n,t,i){t=t||"載入中...";i=i||{border:"none",padding:"0px",opacity:.7};$(n).parent().block({message:t,css:i})},easyUNBlock:function(n){$(n).parent().unblock()},easyAlertError:function(n,t){var i=null;window.console&&window.console.log&&window.console.log(n);window.console&&window.console.log&&window.console.log("error:"+t);try{typeof n=="object"?n.responseJSON&&n.responseJSON.Message?i=n.responseJSON.Message:typeof n.responseText=="string"?(i=n.responseText,i.search(/<html>/g)>-1?i=n.statusText:(i=JSON.parse(n.responseText),i.Message&&(i=i.Message))):i=n.responseText.Message:i=JSON.parse(n).responseText.Message;alert(i)}catch(r){window.console&&window.console.log&&(window.console.log(r.message),window.console.log(r.lineNumber||r.line),window.console.log(r.stackTrace||r.stack));alert(r.message)}},buildHTML:function(n,t,i){typeof t!="string"&&(i=t,t=null);var r="<"+n;for(attr in i)i[attr]!==!1&&(r+=" "+attr+'="'+i[attr]+'"');return r+(t?">"+t+"<\/"+n+">":"/>")}}