/*
 * My97 DatePicker Ver 4.0 Beta2
 * SITE: http://dp.my97.net
 * BLOG: http://blog.csdn.net/my97/
 * MAIL: smallcarrot@163.com
 */
var $dp,$My97DPCfg={
	$wdate:true,
	$dpPath:"",
	$preLoad:true,
	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:"",
	isShowWeek:false,
	highLineWeekDay:true,
	isShowClear:true,
	isShowToday:true,
	isShowOthers:true,
	readOnly:false,
	errDealMode:0,
	autoPickDate:null,
	qsEnabled:true,


disabledDates:null,disabledDays:null,onpicking:null,onpicked:null,onclearing:null,oncleared:null,eCont:null,errMsg:"",quickSel:[],has:{},top:function(){var $=window;while($.parent.document!=$.document&&$.parent.document.getElementsByTagName("frameset").length==0)$=$.parent;return $}(),$docMD:false,$winUL:false,$jsPath:function(){var _,$=document.getElementsByTagName("script");for(var A=0;A<$.length;A++)if($[A].src.substring($[A].src.length-14).toLowerCase()=="wdatepicker.js"){_=$[A].src.substring(0,$[A].src.length-14);break}return _}(),$createDPPath:function(){var D,B,E=this.$dpPath||this.$jsPath;if(E.substring(0,1)!="/"&&E.indexOf("://")==-1){D=this.top.location.href;B=location.href;if(D.indexOf("?")>-1)D=D.substring(0,D.indexOf("?"));if(B.indexOf("?")>-1)B=B.substring(0,B.indexOf("?"));var $="",C="",_="",G,F,A="";for(G=0;G<Math.max(D.length,B.length);G++)if(D.charAt(G).toLowerCase()!=B.charAt(G).toLowerCase()){F=G;while(D.charAt(F)!="/"){if(F==0)break;F-=1}$=D.substring(F+1,D.length);$=$.substring(0,$.lastIndexOf("/"));C=B.substring(F+1,B.length);C=C.substring(0,C.lastIndexOf("/"));break}if($!="")for(G=0;G<$.split("/").length;G++)A+="../";if(C!="")A+=C+"/";E=A+E}this.$dpPath=E}};if($My97DPCfg.top.$dp)$dp=$My97DPCfg.top.$dp;else $dp=$My97DPCfg.top.$dp={ff:(navigator.product=="Gecko"),el:null,loaded:false,win:window,$docMD:false,$:function($){return(typeof $=="string")?this.win.document.getElementById($):$},attachEvent:function(A,$,_){if(this.ff){var B=$.replace(/on/,"");_._ieEmuEventHandler=function($){window.event=$;return _()};A.addEventListener(B,_._ieEmuEventHandler,false)}else A.attachEvent($,_)},loadCSS:function(B,_,C){var $=this.win.document,D=$.getElementsByTagName("HEAD").item(0),A=$.createElement("link");A.href=B;A.rel="stylesheet";A.type="text/css";if(_)A.title=_;if(C)A.charset=C;D.appendChild(A)},callback:function($,_){$.onload=$.onreadystatechange=function(){if(this.readyState&&this.readyState=="loading")return;_()}},pInt:function($){return parseInt($,10)},pIntDef:function(_,$){_=this.pInt(_);if(isNaN(_))_=$;return _},Date:function(D,A,$,C,B,_){this.loadDate=function(E,B,_,D,C,A){var $=new Date();this.y=$dp.pIntDef(E,$.getFullYear());this.M=$dp.pIntDef(B,$.getMonth()+1);this.d=$dp.pIntDef(_,$.getDate());this.H=$dp.pIntDef(D,$.getHours());this.m=$dp.pIntDef(C,$.getMinutes());this.s=$dp.pIntDef(A,$.getSeconds())};this.loadFromDate=function($){this.loadDate($.y,$.M,$.d,$.H,$.m,$.s)};this.coverDate=function(E,B,_,D,C,A){var $=new Date();this.y=$dp.pIntDef(this.y,E||$.getFullYear());this.M=$dp.pIntDef(this.M,B||$.getMonth()+1);this.d=$dp.pIntDef(this.d,_||$.getDate());this.H=$dp.pIntDef(this.H,D||$.getHours());this.m=$dp.pIntDef(this.m,C||$.getMinutes());this.s=$dp.pIntDef(this.s,A||$.getSeconds())};this.compareWith=function($,C){var A="yMdHms",_,B;C=A.indexOf(C);C=C>=0?C:5;for(var D=0;D<=C;D++){B=A.charAt(D);_=this[B]-$[B];if(_>0)return 1;else if(_<0)return-1}return 0};this.refresh=function(){var $=new Date(this.y,this.M-1,this.d,this.H,this.m,this.s);this.y=$.getFullYear();this.M=$.getMonth()+1;this.d=$.getDate();this.H=$.getHours();this.m=$.getMinutes();this.s=$.getSeconds();return!isNaN(this.y)};this.loadDate(D,A,$,C,B,_)},$D:function($,_){return this.$DV(this.$($).value,_)},$DV:function(_,$){if(_!=""){this.dt=this.splitDate(_,$dp.cal.dateFmt);if($){for(var A in $){if(this.dt[A]===undefined)this.errMsg="invalid property:"+A;this.dt[A]+=$[A]}if(this.dt.refresh())return this.dt}}return""},splitDate:function(J,C,O,E,B,G,F,K,L){C=C||$dp.dateFmt;var H,$=new this.Date(),N=0,A=/yyyy|yy|y|MM|M|dd|d|HH|H|mm|m|ss|s/g,M=J.split(/\W+/),_=C.match(A);A.lastIndex=0;if(!L&&M.length!=_.length){var D=0,K="^";while((M=A.exec(C))!==null){D=M.index-D;K+=(D==0)?"":(".{"+D+"}");D=A.lastIndex;switch(M[0]){case"yyyy":K+="(\\d{4})";break;default:K+="(\\d\\d?)";break}}K+=".*$";M=new RegExp(K).exec(J);N=1}if(M)for(H=0;H<_.length;H++){var I=M[H+N];if(I)switch(_[H]){case"y":case"yy":I=this.pIntDef(I,0);if(I<50)I+=2000;else I+=1900;$.y=I;break;default:$[_[H].slice(-1)]=I;break}}$.coverDate(O,E,B,G,F,K);return $},getAbsM:function($){$=$||$dp.top;var A=0,_=0;while($!=$dp.top){var C=$.parent.document.getElementsByTagName("iframe");for(var E=0;E<C.length;E++){try{if(C[E].contentWindow==$){var D=this.getBound(C[E]);A+=D.left;_+=D.top;break}}catch(B){continue}}$=$.parent}return{"leftM":A,"topM":_}},getBound:function(C){if(this.ff){var E=null,_=C.offsetTop,D=C.offsetLeft,B=C.offsetWidth,A=C.offsetHeight;while(C=C.offsetParent){_+=C.offsetTop;D+=C.offsetLeft;if(C.tagName.toLowerCase()=="body")E=C.ownerDocument.defaultView}var $=this.getScroll(E);D-=$.left;_-=$.top;B+=D;A+=_;return{"left":D,"top":_,"right":B,"bottom":A}}else return C.getBoundingClientRect()},getWH:function($){$=$||$dp.top;var _=$.document;_=_.documentElement&&_.documentElement.clientHeight?_.documentElement:_.body;return{"width":_.clientWidth,"height":_.clientHeight}},getScroll:function($){$=$||$dp.top;var _=$.document;_=(_.documentElement&&!(_.documentElement.scrollTop==undefined||_.documentElement.scrollTop==0))?_.documentElement:_.body;return{"top":_.scrollTop,"left":_.scrollLeft}},disposeDP:function(){var A=event?(event.srcElement||event.target):null;if($dp&&$dp.dd&&$dp.dd.style.display=="block"&&A&&A!=$dp.el){$dp.$w.hideSel();var $=$dp.el,_=$dp.cal;if($[$dp.elProp]!=""&&!$dp.readOnly)_.date.loadFromDate($dp.splitDate($[$dp.elProp],_.dateFmt));if($[$dp.elProp]==""||(_.isDate(_.date)&&_.isTime(_.date)&&_.checkValid(_.date))){_.mark(true);if($[$dp.elProp]!="")_.update();else $.setAttribute("realValue","");$dp.dd.style.display="none"}else _.mark(false)}}};if($My97DPCfg.$wdate)$dp.loadCSS($My97DPCfg.$jsPath+"skin/WdatePicker.css");if($My97DPCfg.$preLoad&&!$dp.loaded){$dp.loaded=true;$dp.attachEvent(window,"onload",function(){WdatePicker()})}function WdatePicker(F){$dp.win=window;var $=$My97DPCfg;F=F||{};if(!$dp.dd||F.eCont){if(F.eCont){F.eCont=$dp.$(F.eCont);F.qsEnabled=false}F.el={innerHTML:""}}else{var E,D=_();if(D){E=D.srcElement||D.target;D.cancelBubble=true}F.el=$dp.$(F.el||E);if(F.el.disabled||(F.el==$dp.el&&$dp.dd.style.display!="none"))return}for(var C in $)if(C.substring(0,1)!="$")$dp[C]=$[C];for(C in F)if($dp[C]===undefined)$dp.errMsg="invalid property:"+C;else $dp[C]=F[C];$dp.elProp=$dp.el&&$dp.el.nodeName=="INPUT"?"value":"innerHTML";if($dp.lang=="auto")$dp.lang=$dp.ff?navigator.language.toLowerCase():navigator.browserLanguage.toLowerCase();if(!$dp.dd||$dp.eCont||($dp.lang&&$dp.realLang&&$dp.realLang.name!=$dp.lang)){if($dp.dd)document.body.removeChild($dp.dd);if($.$dpPath=="")$.$createDPPath();var A="<iframe src=\""+$.$dpPath+"My97DatePicker.htm\" frameborder=\"0\" width=\"1px\" height=\"1px\" border=\"0\" scrolling=\"no\"></iframe>";if($dp.eCont)$dp.eCont.innerHTML=A;else{$dp.dd=$.top.document.createElement("DIV");$dp.dd.style.cssText="position:absolute;z-index:1970";$dp.dd.innerHTML=A;$.top.document.body.appendChild($dp.dd);if(!$dp.realLang&&$.$preLoad){$dp.dd.style.top=$dp.dd.style.left="-1970px";return}else{$dp.dd.style.display="block";$dp.callback($dp.dd.childNodes[0],B)}}}else{$dp.dd.style.display="block";$dp.cal.init();B()}if(!$.$docMD){$dp.attachEvent(document,"onclick",$dp.disposeDP);$.$docMD=true}if(!$dp.$docMD){$dp.attachEvent($dp.top.document,"onclick",$dp.disposeDP);$dp.$docMD=true}if(!$.$winUL){$dp.attachEvent(window,"onbeforeunload",function(){$dp.dd.style.display="none"});$.$winUL=true}function B(){var D=$dp.position.left,F=$dp.position.top,E=$dp.getBound($dp.el),$=$dp.getAbsM($dp.win),B=$dp.getWH($dp.top),A=$dp.getScroll($dp.top),C=$dp.dd.offsetHeight,_=$dp.dd.offsetWidth;if(isNaN(F)){if(F=="above"||(F!="under"&&(($.topM+E.bottom+C>B.height)&&($.topM+E.top-C>0))))F=A.top+$.topM+E.top-C-3;else F=A.top+$.topM+E.bottom;F+=$dp.ff?1:-1}else F+=A.top+$.topM;if(isNaN(D))D=A.left+Math.min($.leftM+E.left,B.width-_-5)-($dp.ff?0:2);else D+=A.left+$.leftM;$dp.dd.style.top=F+"px";$dp.dd.style.left=D+"px"}function _(){if($dp.ff){func=_.caller;while(func!=null){var $=func.arguments[0];if($&&($+"").indexOf("Event")>=0)return $;func=func.caller}return null}return event}}