12345 |
- /*
- * My97 DatePicker 4.8.5
- * License: http://www.my97.net/license.asp
- */
- function My97DP(){$c=this,this.QS=[],$d=document.createElement("div"),$d.className="WdateDiv",$d.innerHTML='<div id=dpTitle><div class="NavImg NavImgll"><a></a></div><div class="NavImg NavImgl"><a></a></div><div style="float:left"><div class="menuSel MMenu"></div><input class=yminput></div><div style="float:left"><div class="menuSel YMenu"></div><input class=yminput></div><div class="NavImg NavImgrr"><a></a></div><div class="NavImg NavImgr"><a></a></div><div style="float:right"></div></div><div style="position:absolute;overflow:hidden"></div><div></div><div id=dpTime><div class="menuSel hhMenu"></div><div class="menuSel mmMenu"></div><div class="menuSel ssMenu"></div><table cellspacing=0 cellpadding=0 border=0><tr><td rowspan=2><span id=dpTimeStr></span> <input class=tB maxlength=2><input value=":" class=tm readonly><input class=tE maxlength=2><input value=":" class=tm readonly><input class=tE maxlength=2></td><td><button id=dpTimeUp></button></td></tr><tr><td><button id=dpTimeDown></button></td></tr></table></div><div id=dpQS></div><div id=dpControl><input class=dpButton id=dpClearInput type=button><input class=dpButton id=dpTodayInput type=button><input class=dpButton id=dpOkInput type=button></div>',attachTabEvent($d,function(){hideSel()}),function(){function t(t){return $d.getElementsByTagName(t)}var e=t("a");divs=t("div"),ipts=t("input"),btns=t("button"),spans=t("span"),$d.navLeftImg=e[0],$d.leftImg=e[1],$d.rightImg=e[3],$d.navRightImg=e[2],$d.rMD=divs[9],$d.MI=ipts[0],$d.yI=ipts[1],$d.titleDiv=divs[0],$d.MD=divs[4],$d.yD=divs[6],$d.qsDivSel=divs[10],$d.dDiv=divs[11],$d.tDiv=divs[12],$d.HD=divs[13],$d.mD=divs[14],$d.sD=divs[15],$d.qsDiv=divs[16],$d.qsDiv.title=$lang.quickStr,$d.bDiv=divs[17],$d.HI=ipts[2],$d.mI=ipts[4],$d.sI=ipts[6],$d.clearI=ipts[7],$d.todayI=ipts[8],$d.okI=ipts[9],$d.upButton=btns[0],$d.downButton=btns[1],$d.timeSpan=spans[0]}(),this.init(),$dp.focusArr=[document,$d.MI,$d.yI,$d.HI,$d.mI,$d.sI,$d.clearI,$d.todayI,$d.okI];for(var t=0;t<$dp.focusArr.length;t++){var e=$dp.focusArr[t];e.nextCtrl=t==$dp.focusArr.length-1?$dp.focusArr[1]:$dp.focusArr[t+1],$dp.attachEvent(e,"onkeydown",_tab)}!function(){$d.navLeftImg.onclick=function(){if($ny=$ny<=0?$ny-1:-1,$ny%5==0)return void $d.yI.focus();$d.yI.value=$dt.y-1,$d.yI.onblur()},$d.leftImg.onclick=function(){$dt.attr("M",-1),$d.MI.onblur()},$d.rightImg.onclick=function(){$dt.attr("M",1),$d.MI.onblur()},$d.navRightImg.onclick=function(){if($ny=$ny>=0?$ny+1:1,$ny%5==0)return void $d.yI.focus();$d.yI.value=$dt.y+1,$d.yI.onblur()}}(),_inputBindEvent("y,M,H,m,s"),$d.upButton.onclick=function(){updownEvent(1)},$d.downButton.onclick=function(){updownEvent(-1)},$d.qsDiv.onclick=function(){"block"!=$d.qsDivSel.style.display?($c._fillQS(),showB($d.qsDivSel)):hide($d.qsDivSel)},document.body.appendChild($d)}function elFocus(){var t=$dp.el;try{"none"==t.style.display||"hidden"==t.type||"input"!=t.nodeName.toLowerCase()&&"textarea"!=t.nodeName.toLowerCase()||(t.My97Mark=!0,t.focus())}catch(t){}setTimeout(function(){t.My97Mark=!1},197)}function sb(){this.s=new Array,this.i=0,this.a=function(t){this.s[this.i++]=t},this.j=function(){return this.s.join("")}}function getWeek(t,e){e=e||0;var d,a=new Date(t.y,t.M-1,t.d+e);if("ISO8601"==$dp.weekMethod){a.setDate(a.getDate()-(a.getDay()+6)%7+3);var n=a.valueOf();a.setMonth(0),a.setDate(4),d=Math.round((n-a.valueOf())/6048e5)+1}else{var s=new Date(t.y,0,1);a=Math.round((a.valueOf()-s.valueOf())/864e5),d=Math.ceil((a+(s.getDay()+1))/7)}return 1==$dt.M&&d>52?1:d}function getDay(t){return new Date(t.y,t.M-1,t.d).getDay()}function show(){setDisp(arguments,"")}function showB(){setDisp(arguments,"block")}function hide(){setDisp(arguments,"none")}function setDisp(t,e){for(i=0;i<t.length;i++)t[i].style.display=e}function shorH(t,e){e?show(t):hide(t)}function disHMS(t,e){e?t.disabled=!1:(t.disabled=!0,t.value="00")}function c(t,e){var d,a=e;"M"==t?a=makeInRange(e,1,12):"H"==t?a=makeInRange(e,0,23):"ms".indexOf(t)>=0&&(a=makeInRange(e,0,59)),$dt[t]=a,$d[t+"I"]&&("M"==t?($d.MI.realValue=a,$d.MI.value=$lang.aMonStr[a-1]):$d[t+"I"].value=a),$sdt[t]==a||callFunc(t+"changing")||(d=$c.checkRange(),0==d?sv(t,a):d<0?_setAll($c.minDate):d>0&&_setAll($c.maxDate),$d.okI.disabled=!$c.checkValid($sdt),"yMd".indexOf(t)>=0&&$c.draw(),callFunc(t+"changed"))}function _setTime(t){sv("H",t.H),sv("m",t.m),sv("s",t.s)}function _setAll(t){sv("y",t.y),sv("M",t.M),sv("d",t.d),_setTime(t)}function day_Click(t,e,d,a,n,s){var i=new DPDate($dt.y,$dt.M,$dt.d,$dt.H,$dt.m,$dt.s);if($dt.loadDate(t,e,d,a,n,s),callFunc("onpicking"))$dt=i;else{var r=i.y==t&&i.M==e&&i.d==d;r||0==arguments.length||(c("y",t),c("M",e),c("d",d),$dp.has.st&&updownEvent(0),$c.currFocus=$dp.el,dealAutoUpdate()),($c.autoPickDate||r||0==arguments.length)&&$c.pickDate()}}function dealAutoUpdate(){if($dp.autoUpdateOnChanged)try{$c.update(),$dp.el.focus()}catch(t){}}function callFunc(t){var e;return $dp[t]&&(e=$dp[t].call($dp.el,$dp)),e}function sv(t,e){if(null==e&&(e=$dt[t]),$sdt[t]=$dt[t]=e,"yHms".indexOf(t)>=0&&($d[t+"I"].value=e),"M"==t&&($d.MI.realValue=e,$d.MI.value=$lang.aMonStr[e-1]),"Hms".indexOf(t)>=0){var d=$c.checkTimeRange($dt,t);d<0?(_setTime($c.minTime),e=$c.minTime[t]):d>0&&(_setTime($c.maxTime),e=$c.maxTime[t])}}function makeInRange(t,e,d){return t<e?t=e:t>d&&(t=d),t}function attachTabEvent(t,e){$dp.attachEvent(t,"onkeydown",function(t){t=t||event,k=void 0==t.which?t.keyCode:t.which,9==k&&e()})}function doStr(t,e){for(t+="";t.length<e;)t="0"+t;return t}function hideSel(){hide($d.yD,$d.MD,$d.HD,$d.mD,$d.sD)}function updownEvent(t){var e=$c.currFocus,d=$dp.hmsMenuCfg;e!=$d.HI&&e!=$d.mI&&e!=$d.sI&&(e=$d.HI);var a,n=e==$d.HI?"H":e==$d.mI?"m":"s",s=d[n][0],i=$dt[n]+t*s;for(a=0;a<=60;a+=s)if(i<=a){i=a-i<s/2?a:Math.max(0,a-s),60==i&&i--;break}$dt[n]=i,c(n,$dt[n]),dealAutoUpdate()}function DPDate(t,e,d,a,n,s){this.loadDate(t,e,d,a,n,s)}function pInt(t){return parseInt(t,10)}function pInt2(t,e){return rtn(pInt(t),e)}function pInt3(t,e,d){return pInt2(t,rtn(e,d))}function rtn(t,e){return null==t||isNaN(t)?e:t}function fireChangeEvent(){$dp.valueEdited||$dp.cal.oldValue==$dp.el[$dp.elProp]||fireEvent($dp.el,"change")}function fireEvent(t,e){if($IE)t.fireEvent("on"+e);else{var d=document.createEvent("HTMLEvents");d.initEvent(e,!0,!0),t.dispatchEvent(d)}}function _foundInput(t){var e,d,a="y,M,H,m,s,ry,rM".split(",");for(d=0;d<a.length;d++)if(e=a[d],$d[e+"I"]==t)return e.slice(e.length-1,e.length);return 0}function _focus(t){var e=_foundInput(this),d=$d[e+"D"];if(e){$c.currFocus=this,$c.lastFocusTime=new Date,"y"==e?this.className="yminputfocus":"M"==e&&(this.className="yminputfocus",this.value=this.realValue);try{$dp.isTouch||this.select()}catch(t){}$c["_f"+e](this),showB(d),"Hms".indexOf(e)>=0&&(d.style.marginLeft=Math.min(this.offsetLeft,$d.sI.offsetLeft+60*$dp._scaled-d.offsetWidth),d.style.marginTop=this.offsetTop-d.offsetHeight-2)}}function _blur(showDiv){if(!(new Date-$c.lastFocusTime<97)){var p=_foundInput(this),isR,mStr,v=this.value,oldv=$dt[p];0!=p&&($dt[p]=Number(v)>=0?Number(v):$dt[p],"y"==p?(isR=this==$d.ryI)&&12==$dt.M&&($dt.y-=1):"M"==p&&(isR=this==$d.rMI,isR&&(mStr=$lang.aMonStr[$dt[p]-1],12==oldv&&($dt.y+=1),$dt.attr("M",-1)),$sdt.M==$dt.M&&(this.value=mStr||$lang.aMonStr[$dt[p]-1]),$sdt.y!=$dt.y&&c("y",$dt.y)),eval('c("'+p+'",'+$dt[p]+")"),!0!==showDiv&&("y"!=p&&"M"!=p||(this.className="yminput"),hide($d[p+"D"])),dealAutoUpdate())}}function _cancelKey(t){t.preventDefault?(t.preventDefault(),t.stopPropagation()):(t.cancelBubble=!0,t.returnValue=!1),$OPERA&&(t.keyCode=0)}function _inputBindEvent(t){for(var e=t.split(","),d=0;d<e.length;d++){var a=e[d]+"I";$d[a].onfocus=_focus,$d[a].onblur=_blur,$dp.isTouch&&($d[a].readOnly=!0)}}function _tab(t){var e=t.srcElement||t.target,d=t.which||t.keyCode,a=!!$dp.eCont||"none"!=$dp.dd.style.display;if($dp.valueEdited=1,d>=96&&d<=105&&(d-=48),$dp.enableKeyboard&&a){if(e.nextCtrl||(e.nextCtrl=$dp.focusArr[1],$c.currFocus=$dp.el),e==$dp.el&&($c.currFocus=$dp.el),27==d){if(e==$dp.el)return void $c.close();$dp.el.focus()}if(d>=37&&d<=40){var n;if($c.currFocus==$dp.el||$c.currFocus==$d.okI){if($dp.has.d)return n="d",38==d?$dt[n]-=7:39==d?$dt[n]+=1:37==d?$dt[n]-=1:$dt[n]+=7,$dt.refresh(),c("y",$dt.y),c("M",$dt.M),c("d",$dt[n]),void _cancelKey(t);n=$dp.has.minUnit,$d[n+"I"].focus()}n=n||_foundInput($c.currFocus),n&&(38==d||39==d?$dt[n]+=1:$dt[n]-=1,$dt.refresh(),$c.currFocus.value=$dt[n],_blur.call($c.currFocus,!0),$dp.isTouch||$c.currFocus.select())}else if(9==d){for(var s=e.nextCtrl,i=0;i<$dp.focusArr.length&&(1==s.disabled||0==s.offsetHeight);i++)s=s.nextCtrl;$c.currFocus!=s&&($c.currFocus=s,s.focus())}else 13==d&&(_blur.call($c.currFocus),"button"==$c.currFocus.type?$c.currFocus.click():$dp.cal.oldValue==$dp.el[$dp.elProp]?$c.pickDate():$c.close(),$c.currFocus=$dp.el)}else 9==d&&e==$dp.el&&$c.close();if($dp.enableInputMask&&!$dp.isTouch&&!$OPERA&&!$dp.readOnly&&$c.currFocus==$dp.el&&d>=48&&d<=57){var r,l,o,$,p,u,h,f,m=$dp.el,y=m.value,v=function(t){var e=0;if($dp.win.document.selection){var d=$dp.win.document.selection.createRange(),a=d.text.length;d.moveStart("character",-t.value.length),e=d.text.length-a}else(t.selectionStart||"0"==t.selectionStart)&&(e=t.selectionStart);return e}(m),g={str:"",arr:[]},i=0,D=0,M=0,I=0,b=/yyyy|yyy|yy|y|MM|M|dd|d|%ld|HH|H|mm|m|ss|s|WW|W|w/g,w=$dp.dateFmt.match(b),l=0;if(""!=y){for(I=y.match(/[0-9]/g),I=null==I?0:I.length,i=0;i<w.length;i++)I-=Math.max(w[i].length,2);I=I>=0?1:0,1==I&&v>=y.length&&(v=y.length-1)}for(y=y.substring(0,v)+String.fromCharCode(d)+y.substring(v+I),v++,i=0;i<y.length;i++){var k=y.charAt(i);/[0-9]/.test(k)?g.str+=k:g.arr[i]=1}for(y="",b.lastIndex=0;null!==(r=b.exec($dp.dateFmt))&&(M=r.index-("%ld"==r[0]?1:0),D>=0&&(y+=$dp.dateFmt.substring(D,M),v>=D+l&&v<=M+l&&(v+=M-D)),D=b.lastIndex,f=D-M,o=g.str.substring(0,f),$=r[0].charAt(0),p=pInt(o.charAt(0)),g.str.length>1?(u=g.str.charAt(1),h=10*p+pInt(u)):(u="",h=p),g.arr[M+1]||"M"==$&&h>12||"d"==$&&h>31||"H"==$&&h>23||"ms".indexOf($)>=0&&h>59?(o=2==r[0].length?"0"+p:p,v++):1==f&&(o=h,f++,l++),y+=o,g.str=g.str.substring(f),""!=g.str););m.value=y,function(t,e){if(t.setSelectionRange)t.focus(),t.setSelectionRange(e,e);else if(t.createTextRange){var d=t.createTextRange();d.collapse(!0),d.moveEnd("character",e),d.moveStart("character",e),d.select()}}(m,v),_cancelKey(t)}a&&$c.currFocus!=$dp.el&&!(d>=48&&d<=57||8==d||46==d)&&_cancelKey(t)}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};if($cfg.eCont){$dp={};for(var p in $pdp)if("object"==_typeof($pdp[p])){$dp[p]={};for(var pp in $pdp[p])$dp[p][pp]=$pdp[p][pp]}else $dp[p]=$pdp[p]}else $dp=$pdp;for(var p in $cfg)$dp[p]=$cfg[p];var $c;$FF&&(Event.prototype.__defineSetter__("returnValue",function(t){return t||this.preventDefault(),t}),Event.prototype.__defineGetter__("srcElement",function(){for(var t=this.target;1!=t.nodeType;)t=t.parentNode;return t})),My97DP.prototype={init:function(){$ny=0,$dp.cal=this,$dp.readOnly&&null!=$dp.el.readOnly&&($dp.el.readOnly=!0,$dp.el.blur()),this._dealFmt(),$dt=this.newdate=new DPDate,$tdt=new DPDate,$sdt=this.date=new DPDate,$dp.valueEdited=0,this.dateFmt=this.doExp($dp.dateFmt),this.autoPickDate=null==$dp.autoPickDate?!$dp.has.st||!$dp.has.st:$dp.autoPickDate,$dp.autoUpdateOnChanged=null==$dp.autoUpdateOnChanged?!$dp.isShowOK||!$dp.has.d:$dp.autoUpdateOnChanged,this.ddateRe=this._initRe("disabledDates"),this.ddayRe=this._initRe("disabledDays"),this.sdateRe=this._initRe("specialDates"),this.sdayRe=this._initRe("specialDays"),this.minDate=this.doCustomDate($dp.minDate,$dp.minDate!=$dp.defMinDate?$dp.realFmt:$dp.realFullFmt,$dp.defMinDate),this.maxDate=this.doCustomDate($dp.maxDate,$dp.maxDate!=$dp.defMaxDate?$dp.realFmt:$dp.realFullFmt,$dp.defMaxDate),this.minTime=this.doCustomDate($dp.minTime,$dp.realTimeFmt),this.maxTime=this.doCustomDate($dp.maxTime,$dp.realTimeFmt),this.minDate.compareWith(this.maxDate)>0&&($dp.errMsg=$lang.err_1),this.loadDate()?(this._makeDateInRange(),this.oldValue=$dp.el[$dp.elProp]):this.mark(!1,2),_setAll($dt),$d.timeSpan.innerHTML=$lang.timeStr,$d.clearI.value=$lang.clearStr,$d.todayI.value=$lang.todayStr,$d.okI.value=$lang.okStr,$d.okI.disabled=!$c.checkValid($sdt),this.initShowAndHide(),this.initBtn(),$dp.errMsg&&alert($dp.errMsg),this.draw(),1==$dp.el.nodeType&&void 0===$dp.el.My97Mark&&($dp.attachEvent($dp.el,"onkeydown",_tab),$dp.attachEvent($dp.el,"onblur",function(){$dp&&"none"==$dp.dd.style.display&&$c.close()}),$dp.el.My97Mark=!1),$c.currFocus=$dp.el,hideSel()},_makeDateInRange:function(){var t=this.checkRange();if(0!=t){var e;e=t>0?this.maxDate:this.minDate,$dp.has.sd&&($dt.y=e.y,$dt.M=e.M,$dt.d=e.d),$dp.has.st&&($dt.H=e.H,$dt.m=e.m,$dt.s=e.s)}},splitDate:function(t,e,d,a,n,s,i,r,l){var o;if(t&&t.loadDate)o=t;else{o=new DPDate,e=e||$dp.dateFmt;var c,$,p,u=0,h=/yyyy|yyy|yy|y|MMMM|MMM|MM|M|dd|d|%ld|HH|H|mm|m|ss|s|DD|D|WW|W|w/g,f=e.match(h);if(h.lastIndex=0,l)p=t.split(/\W+/);else{for(var m=0,y="^";null!==(p=h.exec(e));)switch(m>=0&&($=e.substring(m,p.index),$&&"-/\\".indexOf($)>=0&&($="[\\-/]"),y+=$),m=h.lastIndex,p[0]){case"yyyy":y+="(\\d{4})";break;case"yyy":y+="(\\d{3})";break;case"MMMM":case"MMM":case"DD":case"D":y+="(\\D+)";break;default:y+="(\\d\\d?)"}y+=".*$",p=new RegExp(y).exec(t),u=1}if(p){for(c=0;c<f.length;c++){var v=p[c+u];if(v)switch(f[c]){case"MMMM":case"MMM":o.M=function(t,e){for(var d="MMMM"==t?$lang.aLongMonStr:$lang.aMonStr,a=0;a<12;a++)if(d[a].toLowerCase()==e.substr(0,d[a].length).toLowerCase())return a+1;return-1}(f[c],v);break;case"y":case"yy":v=pInt2(v,0),v+=v<50?2e3:1900,o.y=v;break;case"yyy":o.y=pInt2(v,0)+$dp.yearOffset;break;default:o[f[c].slice(-1)]=v}}o.refresh()}else""!=t&&(o.d=32)}return o.coverDate(d,a,n,s,i,r),o},_initRe:function(t){var e,d=$dp[t],a="";if(d&&d.length>0){for(e=0;e<d.length;e++)a+=this.doExp(d[e]),e!=d.length-1&&(a+="|");a=a?new RegExp("(?:"+a+")"):null}else a=null;return a},update:function(t){void 0===t&&(t=this.getNewDateStr()),$dp.el[$dp.elProp]!=t&&($dp.el[$dp.elProp]=t),this.setRealValue()},setRealValue:function(t){var e=$dp.$($dp.vel),t=rtn(t,this.getNewDateStr($dp.realFmt));e&&(e.value=t),$dp.el.realValue=t},doExp:function doExp(s){var ps="yMdHms",arr,tmpEval,re=/#?\{(.*?)\}/;s+="";for(var i=0;i<ps.length;i++)s=s.replace("%"+ps.charAt(i),this.getP(ps.charAt(i),null,$tdt));for("#F{"==s.substring(0,3)&&(s=s.substring(3,s.length-1),s.indexOf("return ")<0&&(s="return "+s),s=$dp.win.eval('new Function("'+s+'");'),s=s());null!=(arr=re.exec(s));)arr.lastIndex=arr.index+arr[1].length+arr[0].length-arr[1].length-1,tmpEval=pInt(eval(arr[1])),tmpEval<0&&(tmpEval="9700"+-tmpEval),s=s.substring(0,arr.index)+tmpEval+s.substring(arr.lastIndex+1);return s},doCustomDate:function(t,e,d){var a;return t=this.doExp(t),t&&""!=t||(t=d),"object"==(void 0===t?"undefined":_typeof(t))?a=t:(a=this.splitDate(t,e,null,null,1,0,0,0,!0),a.y=(""+a.y).replace(/^9700/,"-"),a.M=(""+a.M).replace(/^9700/,"-"),a.d=(""+a.d).replace(/^9700/,"-"),a.H=(""+a.H).replace(/^9700/,"-"),a.m=(""+a.m).replace(/^9700/,"-"),a.s=(""+a.s).replace(/^9700/,"-"),t.indexOf("%ld")>=0&&(t=t.replace(/%ld/g,"0")),a.refresh()),a},loadDate:function(){var t=$dp.el[$dp.elProp],e=this.dateFmt,d=$dp.has;if(($dp.alwaysUseStartDate||""!=$dp.startDate&&""==t)&&(t=this.doExp($dp.startDate),e=$dp.realFmt),$dt.loadFromDate(this.splitDate(t,e)),""!=t){var a=1;return d.sd&&!this.isDate($dt)&&($dt.y=$tdt.y,$dt.M=$tdt.M,$dt.d=$tdt.d,a=0),d.st&&!this.isTime($dt)&&($dt.H=$tdt.H,$dt.m=$tdt.m,$dt.s=$tdt.s,a=0),a&&this.checkValid($dt)}return d.H||($dt.H=0),d.m||($dt.m=0),d.s||($dt.s=0),1},isDate:function(t){return null!=t.y&&(t=doStr(t.y,4)+"-"+t.M+"-"+t.d),t.match(/^((\d{2}(([02468][048])|([13579][26]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|([1-2][0-9])))))|(\d{2}(([02468][1235679])|([13579][01345789]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\s(((0?[0-9])|([1-2][0-3]))\:([0-5]?[0-9])((\s)|(\:([0-5]?[0-9])))))?$/)},isTime:function(t){return null!=t.H&&(t=t.H+":"+t.m+":"+t.s),t.match(/^([0-9]|([0-1][0-9])|([2][0-3])):([0-9]|([0-5][0-9])):([0-9]|([0-5][0-9]))$/)},checkRange:function(t,e){t=t||$dt;var d=t.compareWith(this.minDate,e);return d>0&&(d=t.compareWith(this.maxDate,e))<0&&(d=0),d},checkTimeRange:function(t,e){return t=t||$dt,t.compareWith(this.minTime,e,"Hms")<0?-1:t.compareWith(this.maxTime,e,"Hms")>0?1:0},checkValid:function(t,e,d){e=e||$dp.has.minUnit;var a=this.checkRange(t,e);return 0==a?(a=1,"d"==e&&null==d&&(d=Math.abs((new Date(t.y,t.M-1,t.d).getDay()-$dp.firstDayOfWeek+7)%7)),a=!this.testDisDay(d)&&!this.testDisDate(t,e),"Hms".indexOf(e)>=0&&(a=0==this.checkTimeRange(t,e))):a=0,a},checkAndUpdate:function(){var t=($dp.el,this),e=$dp.el[$dp.elProp];if($dp.errDealMode>=0&&$dp.errDealMode<=2&&null!=e){if(""!=e&&t.date.loadFromDate(t.splitDate(e,$dp.dateFmt)),!(""==e||t.isDate(t.date)&&t.isTime(t.date)&&t.checkValid(t.date)))return!1;""!=e?(t.newdate.loadFromDate(t.date),t.update()):t.setRealValue("")}return!0},close:function(t){hideSel(),this.checkAndUpdate()?(this.mark(!0),$dp.hide()):(t?(_cancelKey(t),this.mark(!1,2)):this.mark(!1),$dp.show())},_fd:function(){var t,e,d,a,n,s=new sb,i=$lang.aWeekStr,r=$dp.firstDayOfWeek,l="",o="",c=new DPDate($dt.y,$dt.M,$dt.d,2,0,0),$=c.y,p=c.M;for(n=1-new Date($,p-1,1).getDay()+r,n>1&&(n-=7),s.a("<table class=WdayTable width=100% border=0 cellspacing=0 cellpadding=0>"),s.a("<tr class=MTitle align=center>"),$dp.isShowWeek&&s.a("<td>"+i[0]+"</td>"),t=0;t<7;t++)s.a("<td>"+i[(r+t)%7+1]+"</td>");for(s.a("</tr>"),t=1,e=n;t<7;t++){for(s.a("<tr>"),d=0;d<7;d++){if(c.loadDate($,p,e++),c.refresh(),c.M==p)a=!0,l=0==c.compareWith($sdt,"d")?"Wselday":0==c.compareWith($tdt,"d")?"Wtoday":!$dp.highLineWeekDay||0!=(r+d)%7&&6!=(r+d)%7?"Wday":"Wwday",o=!$dp.highLineWeekDay||0!=(r+d)%7&&6!=(r+d)%7?"WdayOn":"WwdayOn";else if($dp.isShowOthers){if(0==d&&t>1)break;a=!0,l="WotherDay",o="WotherDayOn"}else a=!1;$dp.isShowWeek&&0==d&&(t<4||a)&&s.a("<td class=Wweek>"+getWeek(c,0==$dp.firstDayOfWeek?1:0)+"</td>"),s.a("<td "),a?(this.checkValid(c,"d",d)?((this.testSpeDay(Math.abs((new Date(c.y,c.M-1,c.d).getDay()-$dp.firstDayOfWeek+7)%7))||this.testSpeDate(c))&&(l="WspecialDay"),s.a('onclick="day_Click('+c.y+","+c.M+","+c.d+');" '),s.a("onmouseover=\"this.className='"+o+"'\" "),s.a("onmouseout=\"this.className='"+l+"'\" ")):l="WinvalidDay",s.a("class="+l),s.a(">"+c.d+"</td>")):s.a("></td>")}s.a("</tr>")}return s.a("</table>"),s.j()},testDisDate:function(t,e){var d=this.testDate(t,this.ddateRe,e);return this.ddateRe&&$dp.opposite?!d:d},testDisDay:function(t){return this.testDay(t,this.ddayRe)},testSpeDate:function(t){return this.testDate(t,this.sdateRe)},testSpeDay:function(t){return this.testDay(t,this.sdayRe)},testDate:function(t,e,d){var a="d"==d?$dp.realDateFmt:$dp.realFmt;if("d"==d&&$dp.has.d&&$dp.opposite){e=(e+"").replace(/^\/\(\?:(.*)\)\/.*/,"$1");var n=e.indexOf($dp.dateSplitStr);n>=0&&(e=e.substr(0,n)),e=new RegExp(e)}return e?e.test(this.getDateStr(a,t)):0},testDay:function(t,e){return e?e.test(t):0},_f:function _f(p,max,c,r,e,isR){var s=new sb,fp=isR?"r"+p:p;isR&&$dt.attr("M",1),bak=$dt[p],s.a("<table cellspacing=0 cellpadding=3 border=0>");for(var i=0;i<r;i++){s.a('<tr nowrap="nowrap">');for(var j=0;j<c;j++)s.a("<td nowrap "),$dt[p]=eval(e),$dt[p]>max?s.a("class='menu'"):this.checkValid($dt,p)||$dp.opposite&&-1=="Hms".indexOf(p)&&0==this.checkRange($dt,p)?(s.a("class='menu' onmouseover=\"this.className='menuOn'\" onmouseout=\"this.className='menu'\" onmousedown=\""),s.a("hide($d."+p+"D);$d."+fp+"I.value="+$dt[p]+";_blur.call($d."+fp+'I);"')):s.a("class='invalidMenu'"),s.a(">"),$dt[p]<=max&&s.a("M"==p?$lang.aMonStr[$dt[p]-1]:$dt[p]),s.a("</td>");s.a("</tr>")}return s.a("</table>"),$dt[p]=bak,isR&&$dt.attr("M",-1),s.j()},_fMyPos:function(t,e){if(t){var d=t.offsetLeft;$IE&&(d=t.getBoundingClientRect().left),e.style.left=d}},_fM:function(t){this._fMyPos(t,$d.MD),$d.MD.innerHTML=this._f("M",12,2,6,"i+j*6+1",t==$d.rMI)},_fy:function(t,e,d){var a=new sb;d=d||t==$d.ryI,e=Math.max(0,rtn(e,$dt.y-5)),a.a(this._f("y",9999,2,5,e+"+i+j*5",d)),a.a("<table width=100% cellspacing=0 cellpadding=3 border=0 align=center><tr><td "),a.a(this.minDate.y<e?"class='menu' onmouseover=\"this.className='menuOn'\" onmouseout=\"this.className='menu'\" onmousedown='if(event.preventDefault)event.preventDefault();event.cancelBubble=true;$c._fy(0,"+(e-10)+","+d+")'":"class='invalidMenu'"),a.a(">←</td><td class='menu' onmouseover=\"this.className='menuOn'\" onmouseout=\"this.className='menu'\" onmousedown=\"hide($d.yD);$d.yI.blur();\">×</td><td "),a.a(this.maxDate.y>=e+10?"class='menu' onmouseover=\"this.className='menuOn'\" onmouseout=\"this.className='menu'\" onmousedown='if(event.preventDefault)event.preventDefault();event.cancelBubble=true;$c._fy(0,"+(e+10)+","+d+")'":"class='invalidMenu'"),a.a(" align=right>→</td></tr></table>"),this._fMyPos(t,$d.yD),$d.yD.innerHTML=a.j()},_fHMS:function(t,e){var d=$dp.hmsMenuCfg[t],a=d[0],n=d[1];$d[t+"D"].innerHTML=this._f(t,e-1,n,Math.ceil(e/a/n),"i*"+n+"*"+a+"+j*"+a)},_fH:function(){this._fHMS("H",24)},_fm:function(){this._fHMS("m",60)},_fs:function(){this._fHMS("s",60)},_fillQS:function(t,e){this.initQS();var d=e?[">a/<rekci","PetaD 79y",'M>knalb_=tegrat "eulb:roloc"=elyts "ten.79ym.w','ww//:ptth"=ferh a<'].join("").split("").reverse().join(""):$lang.quickStr,a=this.QS,n=(a.style,new sb);n.a("<table class=WdayTable width=100% height=100% border=0 cellspacing=0 cellpadding=0>"),n.a('<tr class=MTitle><td><div style="float:left"> '+d+"</div>"),t||n.a('<div style="float:right;cursor:pointer;font-size:14px;" onclick="hide($d.qsDivSel);">× </div>'),n.a("</td></tr>");for(var s=0;s<a.length;s++)a[s]?(n.a("<tr><td style='text-align:left' nowrap='nowrap' class='menu' onmouseover=\"this.className='menuOn'\" onmouseout=\"this.className='menu'\" onclick=\""),n.a("day_Click("+a[s].y+", "+a[s].M+", "+a[s].d+","+a[s].H+","+a[s].m+","+a[s].s+');">'),n.a(" "+this.getDateStr(null,a[s])),n.a("</td></tr>")):n.a("<tr><td class='menu'> </td></tr>");n.a("</table>"),$d.qsDivSel.innerHTML=n.j()},_dealFmt:function(){function t(t){var e=(t+"").slice(1,2);$dp.has[e]=!!t.exec($dp.dateFmt)&&($dp.has.minUnit=e,!0)}t(/w/),t(/WW|W/),t(/DD|D/),t(/yyyy|yyy|yy|y/),t(/MMMM|MMM|MM|M/),t(/dd|d/),t(/HH|H/),t(/mm|m/),t(/ss|s/),$dp.has.sd=!!($dp.has.y||$dp.has.M||$dp.has.d),$dp.has.st=!!($dp.has.H||$dp.has.m||$dp.has.s);var e=$dp.realFullFmt.match(/%Date(.*)%Time/);$dp.dateSplitStr=e?e[1]:" ",$dp.realFullFmt=$dp.realFullFmt.replace(/%Date/,$dp.realDateFmt).replace(/%Time/,$dp.realTimeFmt),$dp.has.sd?$dp.has.st?$dp.realFmt=$dp.realFullFmt:$dp.realFmt=$dp.realDateFmt:$dp.realFmt=$dp.realTimeFmt},initShowAndHide:function(){var t=0;$dp.has.y?(t=1,show($d.yI,$d.navLeftImg,$d.navRightImg)):hide($d.yI,$d.navLeftImg,$d.navRightImg),$dp.has.M?(t=1,show($d.MI,$d.leftImg,$d.rightImg)):hide($d.MI,$d.leftImg,$d.rightImg),t?show($d.titleDiv):hide($d.titleDiv),$dp.has.st?(show($d.tDiv),disHMS($d.HI,$dp.has.H),disHMS($d.mI,$dp.has.m),disHMS($d.sI,$dp.has.s)):hide($d.tDiv),shorH($d.clearI,$dp.isShowClear),shorH($d.todayI,$dp.isShowToday),shorH($d.okI,$dp.isShowOK),shorH($d.qsDiv,!$dp.doubleCalendar&&$dp.has.d&&$dp.qsEnabled),$dp.eCont||!($dp.isShowClear||$dp.isShowToday||$dp.isShowOK)?hide($d.bDiv):show($d.bDiv)},mark:function(t,e){function d(t){var e=t.className;if(e){var d=e.replace(/WdateFmtErr/g,"");if(e!=d)try{t.setAttribute(s,d)}catch(t){alert("WdatePicker:el is null")}}}function a(t){try{t.setAttribute(s,t.className+" WdateFmtErr")}catch(t){alert("WdatePicker:el is null")}}var n=$dp.el,s=$FF?"class":"className";if(-1!=$dp.errDealMode)if(t)d(n);else switch(null==e&&(e=$dp.errDealMode),e){case 0:confirm($lang.errAlertMsg)?(n[$dp.elProp]=this.oldValue||"",d(n)):a(n);break;case 1:n[$dp.elProp]=this.oldValue||"",d(n);break;case 2:a(n)}},getP:function(t,e,d){d=d||$sdt;var a,n,s=[t+t,t],i=d[t],r=function(t){return doStr(i,t.length)};switch(t){case"w":i=getDay(d);break;case"D":var l=getDay(d)+1;r=function(t){return 2==t.length?$lang.aLongWeekStr[l]:$lang.aWeekStr[l]};break;case"W":i=getWeek(d);break;case"y":s=["yyyy","yyy","yy","y"],e=e||s[0],r=function(t){return doStr(t.length<4?t.length<3?d.y%100:(d.y+2e3-$dp.yearOffset)%1e3:i,t.length)};break;case"M":s=["MMMM","MMM","MM","M"],r=function(t){return 4==t.length?$lang.aLongMonStr[i-1]:3==t.length?$lang.aMonStr[i-1]:doStr(i,t.length)}}e=e||t+t,"yMdHms".indexOf(t)>-1&&"y"!=t&&!$dp.has[t]&&(i="Hms".indexOf(t)>-1?0:1);var o=[];for(a=0;a<s.length;a++)n=s[a],e.indexOf(n)>=0&&(o[a]=r(n),e=e.replace(new RegExp(n,"g"),"{"+a+"}"));for(a=0;a<o.length;a++)e=e.replace(new RegExp("\\{"+a+"\\}","g"),o[a]);return e},getDateStr:function(t,e){if(e=e||this.splitDate($dp.el[$dp.elProp],this.dateFmt)||$sdt,t=t||this.dateFmt,t.indexOf("%ld")>=0){var d=new DPDate;d.loadFromDate(e),d.d=0,d.M=pInt(d.M)+1,d.refresh(),t=t.replace(/%ld/g,d.d)}for(var a="ydHmswW",n=0;n<a.length;n++){var s=a.charAt(n);t=this.getP(s,t,e)}return t.indexOf("D")>=0?(t=t.replace(/DD/g,"%dd").replace(/D/g,"%d"),t=this.getP("M",t,e),t=t.replace(/\%dd/g,this.getP("D","DD",e)).replace(/\%d/g,this.getP("D","D",e))):t=this.getP("M",t,e),t},getNewP:function(t,e){return this.getP(t,e,$dt)},getNewDateStr:function(t){return this.getDateStr(t,this.newdate)},draw:function(){if($c._dealFmt(),$d.rMD.innerHTML="",$dp.doubleCalendar){$c.autoPickDate=!0,$dp.isShowOthers=!1,$d.className="WdateDiv WdateDiv2";var t=new sb;t.a("<table class=WdayTable2 width=100% cellspacing=0 cellpadding=0 border=1><tr><td valign=top>"),t.a(this._fd()),t.a("</td><td valign=top>"),$dt.attr("M",1),t.a(this._fd()),$d.rMI=$d.MI.cloneNode(!0),$d.ryI=$d.yI.cloneNode(!0),$d.rMD.appendChild($d.rMI),$d.rMD.appendChild($d.ryI),$d.rMI.value=$lang.aMonStr[$dt.M-1],$d.rMI.realValue=$dt.M,$d.ryI.value=$dt.y,_inputBindEvent("rM,ry"),$d.rMI.className=$d.ryI.className="yminput",$dt.attr("M",-1),t.a("</td></tr></table>"),$d.dDiv.innerHTML=t.j()}else $d.className="WdateDiv",$d.dDiv.innerHTML=this._fd();!$dp.has.d||$dp.autoShowQS?(this._fillQS(!0),showB($d.qsDivSel)):hide($d.qsDivSel),this.autoSize()},convertScale:function(t){var e;if($dp.eCont){var d=($dp.eCont.offsetWidth-5)/$d.offsetWidth,a=($dp.eCont.offsetHeight-5)/$d.offsetWidth;e=Math.min(d,a),e=Math.max(1,e)}else e=parseFloat(t);return isNaN(e)?$dp.isTouch?1.5:1:e},autoSize:function(){for(var t=parent.document.getElementsByTagName("iframe"),e=$d.offsetHeight,d=$d.offsetWidth,a=0;a<t.length;a++){var n=$d.style.height;if($d.style.height="",t[a].contentWindow==window&&e){var s=this.convertScale($dp.scale);if($dp._scaled&&$dp.eCont&&(s*=$dp._scaled),$dp._scaled!=s){doc.body.style="font-size:"+100*s+"% !important";var i=s/($dp._scaled||1);1!=i&&(d=Math.round(d*i),$d.style.width=d-2,e=$d.style.height=Math.round(e*i)),$dp._scaled=s}1==$dp._scaled?show($d.upButton,$d.downButton):hide($d.upButton,$d.downButton),t[a].style.width=d+"px";var r=$d.tDiv.offsetHeight;r&&"none"==$d.bDiv.style.display&&"none"!=$d.tDiv.style.display&&document.body.scrollHeight-e>=r?(e+=r,$d.style.height=e):$d.style.height=n,t[a].style.height=Math.max(e,$d.offsetHeight)+"px"}}$d.qsDivSel.style.width=$d.dDiv.offsetWidth+"px",$d.qsDivSel.style.height=$d.dDiv.offsetHeight+"px"},pickDate:function(){$dt.d=Math.min(new Date($dt.y,$dt.M,0).getDate(),$dt.d),$sdt.loadFromDate($dt),$dp.valueEdited=0,this.update(),$dp.eCont||this.checkValid($dt)&&(elFocus(),hide($dp.dd)),$dp.onpicked?callFunc("onpicked"):fireChangeEvent()},initBtn:function(){$d.clearI.onclick=function(){callFunc("onclearing")||($dp.valueEdited=0,$c.update(""),elFocus(),hide($dp.dd),$dp.oncleared?callFunc("oncleared"):fireChangeEvent())},$d.okI.onclick=function(){day_Click()},this.checkValid($tdt)?($d.todayI.disabled=!1,$d.todayI.onclick=function(){$dt.loadFromDate($tdt),day_Click()}):$d.todayI.disabled=!0},initQS:function(){var t,e,d,a=[],n=$dp.quickSel.length,s=$dp.has.minUnit;if(n>5)n=5;else if("m"==s||"s"==s)a=[-60,-30,0,30,60,-15,15,-45,45];else for(t=0;t<14;t++)a[t]=$dt[s]-2+t;for(t=e=0;t<n;t++)d=this.doCustomDate($dp.quickSel[t]),this.checkValid(d)&&(this.QS[e++]=d);var i="yMdHms",r=[1,1,1,0,0,0];for(t=0;t<=i.indexOf(s);t++)r[t]=$dt[i.charAt(t)];for(t=0;e<5;t++)t<a.length?(d=new DPDate(r[0],r[1],r[2],r[3],r[4],r[5]),d[s]=a[t],d.refresh(),this.checkValid(d)&&(this.QS[e++]=d)):this.QS[e++]=null}},DPDate.prototype={loadDate:function(t,e,d,a,n,s){var i=new Date;this.y=pInt3(t,this.y,i.getFullYear()),this.M=pInt3(e,this.M,i.getMonth()+1),this.d=$dp.has.d?pInt3(d,this.d,i.getDate()):1,this.H=pInt3(a,this.H,i.getHours()),this.m=pInt3(n,this.m,i.getMinutes()),this.s=pInt3(s,this.s,i.getSeconds())},loadFromDate:function(t){t&&this.loadDate(t.y,t.M,t.d,t.H,t.m,t.s)},coverDate:function(t,e,d,a,n,s){var i=new Date;this.y=pInt3(this.y,t,i.getFullYear()),this.M=pInt3(this.M,e,i.getMonth()+1),this.d=$dp.has.d?pInt3(this.d,d,i.getDate()):1,this.H=pInt3(this.H,a,i.getHours()),this.m=pInt3(this.m,n,i.getMinutes()),this.s=pInt3(this.s,s,i.getSeconds())},compareWith:function(t,e,d){d=d||"yMdHms";var a,n;e=d.indexOf(e),e=e>=0?e:5;for(var s=0;s<=e;s++){if(n=d.charAt(s),(a=this[n]-t[n])>0)return 1;if(a<0)return-1}return 0},refresh:function(){"ld"==this.d&&(this.d=0,this.M=pInt(this.M)+1);var t=new Date(this.y,this.M-1,this.d,this.H,this.m,this.s);return this.y<1900&&t.setFullYear(this.y),this.y=t.getFullYear(),this.M=t.getMonth()+1,this.d=t.getDate(),this.H=t.getHours(),this.m=t.getMinutes(),this.s=t.getSeconds(),!isNaN(this.y)},attr:function(t,e){if("yMdHms".indexOf(t)>=0){var d=this.d;"M"==t&&(this.d=1),this[t]+=e,this.refresh(),this.d=d}}},document.ready=1;
|