/* * my97 datepicker 4.8 beta1 * license: http://www.my97.net/dp/license.asp */ var $dp,wdatepicker;(function(){var $={ $langlist:[{ name:"en",charset:"utf-8"}, {name:"zh-cn",charset:"gb2312"}, {name:"zh-tw",charset:"gbk"} ], $skinlist:[ {name:"default",charset:"gb2312"}, {name:"whygreen",charset:"gb2312"} ], $wdate:true, $crossframe:true, $preload:false, doublecalendar:false, enablekeyboard:true, enableinputmask:true, autoupdateonchanged:null, whichdayisfirstweek:4, position:{}, lang:"auto", skin:"default", datefmt:"yyyy-mm-dd", realdatefmt:"yyyy-mm-dd", realtimefmt:"hh:mm:ss", realfullfmt:"%date %time", mindate:"1900-01-01 00:00:00", maxdate:"2099-12-31 23:59:59", startdate:"", alwaysusestartdate:false, yearoffset:1911, firstdayofweek:0, isshowweek:false, highlineweekday:true, isshowclear:true, isshowtoday:true, isshowok:true, isshowothers:true, readonly:false, errdealmode:0, autopickdate:null, qsenabled:true, autoshowqs:false, specialdates:null,specialdays:null,disableddates:null,disableddays:null,opposite:false,errmsg:"",quicksel:[],has:{},getreallang:function(){var _=$.$langlist;for(var a=0;a<_.length;a++)if(_[a].name==this.lang)return _[a];return _[0]}};wdatepicker=t;var x=window,s={innerhtml:""},m="document",h="documentelement",c="getelementsbytagname",u,a,r,g,a,w=navigator.appname;if(w=="microsoft internet explorer")r=true;else if(w=="opera")a=true;else g=true;a=j();if($.$wdate)k(a+"skin/wdatepicker.css");u=x;if($.$crossframe){try{while(u.parent&&u.parent[m]!=u[m]&&u.parent[m][c]("frameset").length==0)u=u.parent}catch(n){}}if(!u.$dp)u.$dp={ff:g,ie:r,opera:a,status:0,defmindate:$.mindate,defmaxdate:$.maxdate};b();if($.$preload&&$dp.status==0)e(x,"onload",function(){t(null,true)});if(!x[m].docmd){e(x[m],"onmousedown",d);x[m].docmd=true}if(!u[m].docmd){e(u[m],"onmousedown",d);u[m].docmd=true}e(x,"onunload",function(){if($dp.dd)o($dp.dd,"none")});function b(){u.$dp=u.$dp||{};obj={$:function($){return(typeof $=="string")?x[m].getelementbyid($):$},$d:function($,_){return this.$dv(this.$($).value,_)},$dv:function(_,$){if(_!=""){this.dt=$dp.cal.splitdate(_,$dp.cal.datefmt);if($)for(var b in $)if(this.dt[b]===undefined)this.errmsg="invalid property:"+b;else{this.dt[b]+=$[b];if(b=="m"){var c=$["m"]>0?1:0,a=new date(this.dt["y"],this.dt["m"],0).getdate();this.dt["d"]=math.min(a+c,this.dt["d"])}}if(this.dt.refresh())return this.dt}return""},show:function(){var a=u[m].getelementsbytagname("div"),$=100000;for(var b=0;b$)$=_}this.dd.style.zindex=$+2;o(this.dd,"block")},hide:function(){o(this.dd,"none")},attachevent:e};for(var $ in obj)u.$dp[$]=obj[$];$dp=u.$dp}function e(a,$,_){if(r)a.attachevent($,_);else if(_){var b=$.replace(/on/,"");_._ieemueventhandler=function($){return _($)};a.addeventlistener(b,_._ieemueventhandler,false)}}function j(){var _,a,$=x[m][c]("script");for(var b=0;b<$.length;b++){_=$[b].getattribute("src");_=_.substr(0,_.tolowercase().indexof("wdatepicker.js"));a=_.lastindexof("/");if(a>0)_=_.substring(0,a+1);if(_)break}return _}function k(a,$,b){var d=x[m][c]("head").item(0),_=x[m].createelement("link");if(d){_.href=a;_.rel="stylesheet";_.type="text/css";if($)_.title=$;if(b)_.charset=b;d.appendchild(_)}}function f($){$=$||u;var a=0,_=0;while($!=u){var d=$.parent[m][c]("iframe");for(var f=0;f_.scrolltop||a.scrollleft>_.scrollleft))?a:_;return{"top":b.scrolltop,"left":b.scrollleft}}function d($){var _=$?($.srcelement||$.target):null;try{if($dp.cal&&!$dp.econt&&$dp.dd&&_!=$dp.el&&$dp.dd.style.display=="block")$dp.cal.close()}catch($){}}function y(){$dp.status=2}var p,_;function t(l,d){$dp.win=x;b();l=l||{};for(var j in $)if(j.substring(0,1)!="$"&&l[j]===undefined)l[j]=$[j];if(d){if(!k()){_=_||setinterval(function(){if(u[m].readystate=="complete")clearinterval(_);t(null,true)},50);return}if($dp.status==0){$dp.status=1;l.el=s;i(l,true)}else return}else if(l.econt){l.econt=$dp.$(l.econt);l.el=s;l.autopickdate=true;l.qsenabled=false;i(l)}else{if($.$preload&&$dp.status!=2)return;var h=f();if(h){l.srcel=h.srcelement||h.target;h.cancelbubble=true}l.el=l.el=$dp.$(l.el||l.srcel);if(!l.el||l.el["my97mark"]===true||l.el.disabled||($dp.dd&&o($dp.dd)!="none"&&$dp.dd.style.left!="-970px")){l.el["my97mark"]=false;return}i(l);if(h&&l.el.nodetype==1&&l.el["my97mark"]===undefined){l.el["my97mark"]=false;var a,c;if(h.type=="focus"){a="onclick";c="onfocus"}else{a="onfocus";c="onclick"}e(l.el,a,l.el[c])}}function k(){if(r&&u!=x&&u[m].readystate!="complete")return false;return true}function f(){if(g){func=f.caller;while(func!=null){var $=func.arguments[0];if($&&($+"").indexof("event")>=0)return $;func=func.caller}return null}return event}}function q(_,$){return _.currentstyle?_.currentstyle[$]:document.defaultview.getcomputedstyle(_,false)[$]}function o(_,$){if(_)if($!=null)_.style.display=$;else return q(_,"display")}function i(g,_){var d=g.el?g.el.nodename:"input";if(_||g.econt||new regexp(/input|textarea|div|span|p|a/ig).test(d))g.elprop=d=="input"?"value":"innerhtml";else return;if(g.lang=="auto")g.lang=r?navigator.browserlanguage.tolowercase():navigator.language.tolowercase();if(!g.econt)for(var c in g)$dp[c]=g[c];if(!$dp.dd||g.econt||($dp.dd&&(g.getreallang().name!=$dp.dd.lang||g.skin!=$dp.dd.skin))){if(g.econt)e(g.econt,g);else{$dp.dd=u[m].createelement("div");$dp.dd.style.csstext="position:absolute";u[m].body.appendchild($dp.dd);e($dp.dd,g);if(_)$dp.dd.style.left=$dp.dd.style.top="-970px";else{$dp.show();b($dp)}}}else if($dp.cal){$dp.show();$dp.cal.init();if(!$dp.econt)b($dp)}function e(f,e){f.innerhtml="";var d=f.lastchild.contentwindow[m],_=$.$langlist,c=$.$skinlist,h=e.getreallang();f.lang=h.name;f.skin=e.skin;var g=[""];for(var i=0;i");g.push("");g.push("");g.push("");e.setpos=b;e.onload=y;d.write("");d.cfg=e;d.write(g.join(""))}function b(i){var g=i.position.left,b=i.position.top,c=i.el;if(c==s)return;if(c!=i.srcel&&(o(c)=="none"||c.type=="hidden"))c=i.srcel;var h=v(c),$=f(x),d=l(u),a=z(u),e=$dp.dd.offsetheight,_=$dp.dd.offsetwidth;if(isnan(b))b=0;if(b!="under"&&(($.topm+h.bottom+e>d.height)&&($.topm+h.top-e>0)))b+=a.top+$.topm+h.top-e-2;else b+=a.top+$.topm+math.min(h.bottom,d.height-e)+2;if(isnan(g))g=0;g+=a.left+math.min($.leftm+h.left,d.width-_-5)-(r?2:0);i.dd.style.top=b+"px";i.dd.style.left=g+"px"}}})()