/*
 * My97 DatePicker Ver 4.0 Beta1
 * SITE: http://dp.my97.net
 * BLOG: http://blog.csdn.net/my97/
 * MAIL: smallcarrot@163.com
 */
var $dp,$My97DPCfg = {
	$wdate: true,
	$dpPath: '',
	$preLoad: true,
	$position: 0,	
	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,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,win:window,loaded:false,$docMD:false,$:function($){return(typeof $=="string")?this.win.document.getElementById($):$},appendChild:function(_,$){if(this.ff)_.appendChild($);else _.insertAdjacentElement("beforeEnd",$)},attachEvent:function(A,$,_){if(this.ff){var B=$.replace(/on/,"");_._ieEmuEventHandler=function($){window.event=$;return _()};A.addEventListener(B,_._ieEmuEventHandler,false)}else A.attachEvent($,_)},addCSS:function(B,_,C){var $=this.win.document;if(this.ff){var 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)}else $.createStyleSheet(B)},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);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($){$=$||window;var A=0,_=0;while($!=window){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($){$=$||window;var _=$.document;_=(_.firstChild.nodeType==1)?_.body:_.documentElement;return{"width":_.clientWidth,"height":_.clientHeight}},getScroll:function($){$=$||window;var _=$.document;_=(_.firstChild.nodeType==1)?_.body:_.documentElement;return{"top":_.scrollTop,"left":_.scrollLeft}},disposeDP:function(){var A=event?(event.srcElement||event.target):null;if($dp&&$dp.dd&&$dp.dd.style.display!="none"&&A!=$dp.el){$dp.$w.hideSel();var $=$dp.el,_=$dp.cal;if($.value!=""&&!$dp.readOnly)_.date.loadFromDate($dp.splitDate($.value,_.dateFmt));if($.value==""||(_.isDate(_.date)&&_.isTime(_.date)&&_.checkValid(_.date))){_.mark(true);if($.value!="")_.update();else $.setAttribute("realValue","");$dp.dd.style.display="none"}else _.mark(false)}}};if($My97DPCfg.$wdate)$dp.addCSS($My97DPCfg.$jsPath+"skin/WdatePicker.css");if($My97DPCfg.$preLoad&&!$dp.loaded){$dp.loaded=true;$dp.attachEvent(window,"onload",function(){new WdatePicker({el:{value:""}})})}function WdatePicker(H){$dp.win=window;var C=$My97DPCfg;H.el=$dp.$(H.el);if(H.el==$dp.el&&$dp.dd&&$dp.dd.style.display!="none")return;for(var E in C)if(E.substring(0,1)!="$")$dp[E]=C[E];for(E in H)if($dp[E]===undefined)$dp.errMsg="invalid property:"+E;else $dp[E]=H[E];if(!$dp.dd||H.lang){if($dp.dd)document.body.removeChild($dp.dd);if(C.$dpPath=="")C.$createDPPath();$dp.dd=document.createElement("DIV");setTimeout(Utils.delegate($dp.dd,dpdd_onLoad),500);$dp.dd.style.cssText="position:absolute;z-index:19700;display:block";$dp.dd.innerHTML="<iframe src=\""+C.$dpPath+"My97DatePicker.htm#97\" frameborder=\"0\" width=\"1px\" height=\"1px\" border=\"0\" scrolling=\"no\"></iframe>";$dp.appendChild(C.top.document.body,$dp.dd);if(!H.lang&&C.$preLoad){$dp.dd.style.left="-19700px";return}}else{$dp.dd.style.display="block";$dp.cal.init()}var G=$dp.getBound($dp.el),_=$dp.getAbsM($dp.win),D=$dp.getWH($dp.top),B=$dp.getScroll($dp.top),I=_.topM+G.bottom,$=_.leftM+G.left,F=Math.max(parseInt($dp.dd.offsetHeight),180),A=Math.max(parseInt($dp.dd.offsetWidth),180);if((C.$position==2)||((C.$position==0)&&((I+F<D.height)||(I-F<F*0.8))))$dp.dd.style.top=(B.top+I+1)+"px";else $dp.dd.style.top=(B.top+I-F-$dp.el.offsetHeight-3)+"px";$dp.dd.style.left=-1+B.left+Math.min($,D.width-A-5)+"px";if(!C.$docMD){$dp.attachEvent(document,"onmousedown",$dp.disposeDP);C.$docMD=true}if(!$dp.$docMD){$dp.attachEvent($dp.top.document,"onmousedown",$dp.disposeDP);$dp.$docMD=true}if(!C.$winUL){$dp.attachEvent(window,"onbeforeunload",function(){$dp.dd.style.display="none"});C.$winUL=true}}
function dpdd_onLoad()
{
    if(typeof(this.None)=='undefined')
    {
        this.style.display='none';
        this.None=true;
    }
}