!function(g){var a={},h=document,f="laydate_box laydate_void laydate_click LayDateSkin skins/ /laydate.css".split(" "),k=null;g.laydate=function(b){b=b||{};try{f.event=g.event?g.event:laydate.caller.arguments[0]}catch(c){}a.run(b);return laydate};laydate.v="1.1";a.getPath=function(){var a=document.scripts,a=a[a.length-1].src;return a.substring(0,a.lastIndexOf("/")+1)}();a.use=function(b,c){var d=h.createElement("link");d.type="text/css";d.rel="stylesheet";d.href=a.getPath+b+f[5];c&&(d.id=c);h.getElementsByTagName("head")[0].appendChild(d)};
a.trim=function(a){return(a||"").replace(/^\s|\s$/g,"").replace(/\s+/g," ")};a.digit=function(a){return 10>a?"0"+(a|0):a};a.stopmp=function(a){a=a||g.event;a.stopPropagation?a.stopPropagation():a.cancelBubble=!0;return this};a.each=function(a,c){for(var d=0,e=a.length;d<e&&!1!==c(d,a[d]);d++);};a.hasClass=function(a,c){a=a||{};return RegExp("\\b"+c+"\\b").test(a.className)};a.addClass=function(b,c){b=b||{};a.hasClass(b,c)||(b.className+=" "+c);b.className=a.trim(b.className);return this};a.removeClass=
function(b,c){b=b||{};a.hasClass(b,c)&&(b.className=b.className.replace(RegExp("\\b"+c+"\\b"),""));return this};a.removeCssAttr=function(a,c){var d=a.style;d.removeProperty?d.removeProperty(c):d.removeAttribute(c)};a.shde=function(a,c){a.style.display=c?"none":"block"};a.query=function(b){if(b&&1===b.nodeType){if("input"!==b.tagName.toLowerCase())throw Error("选择器elem错误");return b}b=a.trim(b).split(" ");var c=h.getElementById(b[0].substr(1)),d;if(c){if(b[1]){if(/^\./.test(b[1])){b=b[1].substr(1);var e=
RegExp("\\b"+b+"\\b");d=[];c=c.getElementsByClassName?c.getElementsByClassName(b):c.getElementsByTagName("*");a.each(c,function(a,b){e.test(b.className)&&d.push(b)});return d[0]?d:""}d=c.getElementsByTagName(b[1]);return d[0]?c.getElementsByTagName(b[1]):""}return c}};a.on=function(b,c,d){b.attachEvent?b.attachEvent("on"+c,function(){d.call(b,g.even)}):b.addEventListener(c,d,!1);return a};a.stopMosup=function(b,c){if("mouseup"!==b)a.on(c,"mouseup",function(b){a.stopmp(b)})};a.run=function(b){var c=
a.query,d,e=f.event,l;try{l=e.target||e.srcElement||{}}catch(r){l={}}c=b.elem?c(b.elem):l;try{c.onkeydown=function(a){a=a||window.event;eventPreventDefault(a)},c.onclick=function(){this.blur()}}catch(m){}e&&l.tagName?c&&c!==a.elem&&(a.stopMosup(e.type,c),a.stopmp(e),a.view(c,b),a.reshow()):(d=b.event||"click",a.each(0<(c.length|0)?c:[c],function(c,e){a.stopMosup(d,e);a.on(e,d,function(c){h.body.click();a.stopmp(c);e!==a.elem&&(a.view(e,b),a.reshow())})}))};a.scroll=function(a){a=a?"scrollLeft":"scrollTop";
return h.body[a]|h.documentElement[a]};a.winarea=function(a){return document.documentElement[a?"clientWidth":"clientHeight"]};a.isleap=function(a){return 0===a%4&&0!==a%100||0===a%400};a.checkVoid=function(b,c,d){var e=[];b|=0;c|=0;d|=0;b<a.mins[0]?e=["y"]:b>a.maxs[0]?e=["y",1]:b>=a.mins[0]&&b<=a.maxs[0]&&(b==a.mins[0]&&(c<a.mins[1]?e=["m"]:c==a.mins[1]&&d<a.mins[2]&&(e=["d"])),b==a.maxs[0]&&(c>a.maxs[1]?e=["m",1]:c==a.maxs[1]&&d>a.maxs[2]&&(e=["d",1])));return e};a.timeVoid=function(b,c){if(a.ymd[1]+
1==a.mins[1]&&a.ymd[2]==a.mins[2]){if(0===c&&b<a.mins[3]||1===c&&b<a.mins[4]||2===c&&b<a.mins[5])return 1}else if(a.ymd[1]+1==a.maxs[1]&&a.ymd[2]==a.maxs[2]&&(0===c&&b>a.maxs[3]||1===c&&b>a.maxs[4]||2===c&&b>a.maxs[5]))return 1;if(b>(c?59:23))return 1};a.check=function(){var b=a.options.format.replace(/YYYY|MM|DD|hh|mm|ss/g,"\\d+\\").replace(/\\$/g,""),b=RegExp(b),c=a.elem[f.elemv],d=c.match(/\d+/g)||[],e=a.checkVoid(d[0],d[1],d[2]);if(c==label.date)return 1;if(""!==c.replace(/\s/g,""))if(b.test(c)){if(e[0])return a.elem[f.elemv]=
"",1;e.value=a.elem[f.elemv].match(b).join();d=e.value.match(/\d+/g);1>d[1]?(d[1]=1,e.auto=1):12<d[1]?(d[1]=12,e.auto=1):2>d[1].length&&(e.auto=1);1>d[2]?(d[2]=1,e.auto=1):d[2]>a.months[(d[1]|0)-1]?(d[2]=2==(d[1]|0)?29:31,e.auto=1):2>d[2].length&&(e.auto=1);3<d.length&&(a.timeVoid(d[3],0)&&(e.auto=1),a.timeVoid(d[4],1)&&(e.auto=1),a.timeVoid(d[5],2)&&(e.auto=1));e.auto?a.creation([d[0],d[1]|0,d[2]|0],1):e.value!==a.elem[f.elemv]&&(a.elem[f.elemv]=e.value)}else return a.elem[f.elemv]="",1};a.months=
[31,null,31,30,31,30,31,31,30,31,30,31];a.viewDate=function(b,c,d){var e,l,h,m,p,g=new Date,k=new Date,n=[k.getFullYear(),k.getMonth()+1,k.getDate()];b<(a.mins[0]|0)&&(b=a.mins[0]|0);b>(a.maxs[0]|0)&&(b=a.maxs[0]|0);g.setFullYear(b,c,d);e=[g.getFullYear(),g.getMonth(),g.getDate()];a.months[1]=a.isleap(e[0])?29:28;g.setFullYear(e[0],e[1],1);l=g.getDay();h=a.months[0===c?11:c-1]-l+1;m=1;a.each(f.tds,function(b,c){var d=e[0],g=e[1]+1,k;c.className="";b<l?(c.innerHTML=k=b+h,a.addClass(c,"laydate_nothis"),
1===g&&(d-=1),g=1===g?12:g-1):b>=l&&b<l+a.months[e[1]]?(c.innerHTML=k=b-l+1,b-l+1===e[2]&&(a.addClass(c,f[2]),p=c,a.appendSpan(c))):(c.innerHTML=k=m++,a.addClass(c,"laydate_nothis"),12===g&&(d+=1),g=12===g?1:g+1);if(void 0!=a.options.videoDay){b=0;for(var q=a.options.videoDay.length;b<q;b++)d==a.options.videoDay[b].year&&g==a.options.videoDay[b].month&&k==a.options.videoDay[b].day&&a.addClass(c,"has_video")}void 0!=a.options.sysTime?a.options.sysTime.getFullYear()==d&&a.options.sysTime.getMonth()+
1==g&&a.options.sysTime.getDate()==k&&a.addClass(c,"laydate_today"):n[0]==d&&n[1]==g&&n[2]==k&&a.addClass(c,"laydate_today");a.checkVoid(d,g,k)[0]&&a.addClass(c,f[1]);c.setAttribute("y",d);c.setAttribute("m",g);c.setAttribute("d",k)});a.valid=!a.hasClass(p,f[1]);a.ymd=e;f.chooseShow.innerHTML=0==f.currentChooseType?a.ymd[0]+"年 "+a.digit(a.ymd[1]+1)+"月":1==f.currentChooseType?a.ymd[0]+"年 ":a.ymd[0]-7+" - "+(a.ymd[0]+4);a.each(f.mms,function(b,c){var d=a.checkVoid(a.ymd[0],(c.getAttribute("m")|0)+1);
"y"===d[0]||"m"===d[0]?a.addClass(c.childNodes[0],f[1]):a.removeClass(c.childNodes[0],f[1]);a.removeClass(c.childNodes[0],f[2])});a.addClass(f.mms[a.ymd[1]].childNodes[0],f[2]);a[a.valid?"removeClass":"addClass"](f.ok,f[1])};a.viewYears=function(b){var c=a.query,d="",e;a.each(Array(12),function(a){7===a?d+='<span class="chooseY" y="'+b+'"><span class="'+f[2]+'">'+b+"</span></span>":(e=b-7+a,d=2E3>e||2037<e?d+('<span class="chooseY laydate_nothis" y="'+e+'"><span>'+e+"</span></span>"):d+('<span class="chooseY" y="'+
e+'"><span>'+e+"</span></span>"))});c("#laydate_ys").innerHTML=d;a.each(c("#laydate_ys .chooseY"),function(b,c){if("y"===a.checkVoid(c.getAttribute("y"))[0])a.addClass(c,f[1]);else a.on(c,"click",function(b){a.stopmp(b).reshow();document.getElementById("laydate_ys").style.top="-9999px";f.currentChooseType=1;a.viewDate(this.getAttribute("y")|0,a.ymd[1],a.ymd[2]);"function"==typeof a.options.preInitFun&&a.options.preInitFun(this.getAttribute("y"))})})};a.initDate=function(b){var c=a.elem[f.elemv].match(/\d+/g)||
[];void 0==b&&(b=new Date);3>c.length&&(c=a.options.start.match(/\d+/g)||[],3>c.length&&(c=[b.getFullYear(),b.getMonth()+1,b.getDate()]));a.inymd=c;a.viewDate(c[0],c[1]-1,c[2])};a.iswrite=function(){};a.orien=function(b,c){var d;d=a.elem.getBoundingClientRect();var e=k.getBoundingClientRect();b.style.left=d.left-(e.left+a.scroll(1))+(c?0:a.scroll(1))+"px";!1==a.options.close&&(b.style.left="");d=d.bottom+b.offsetHeight/1.5<=a.winarea()?d.bottom-1:d.top>b.offsetHeight/1.5?d.top-b.offsetHeight+1:a.winarea()-
b.offsetHeight;b.style.top=d-(e.top+a.scroll())+(c?0:a.scroll())+5+"px"};a.follow=function(b){a.options.fixed?(b.style.position="fixed",a.orien(b,1)):(b.style.position="absolute",a.orien(b))};a.viewtb=function(){var b,c=[],d="日一二三四五六".split(""),e={},f=h.createElement("table"),g=h.createElement("thead");g.appendChild(h.createElement("tr"));e.creath=function(a){var b=h.createElement("th");b.innerHTML=d[a];g.getElementsByTagName("tr")[0].appendChild(b)};a.each(Array(6),function(d){c.push([]);b=f.insertRow(0);
a.each(Array(7),function(a){c[d][a]=0;0===d&&e.creath(a);b.insertCell(a)})});f.insertBefore(g,f.children[0]);f.id=f.className="laydate_table";b=c=null;return f.outerHTML.toLowerCase()}();a.view=function(b,c){var d=a.query,e;c=c||b;a.elem=b;a.options=c;a.options.format||(a.options.format="YYYY-MM-DD");a.options.start=a.options.start||"";a.mm=e=[a.options.min||"2000-01-01 00:00:00",a.options.max||"2037-12-31 23:59:59"];a.mins=e[0].match(/\d+/g);a.maxs=e[1].match(/\d+/g);f.elemv=/textarea|input/.test(a.elem.tagName.toLocaleLowerCase())?
"value":"innerHTML";d("#"+f[0])&&k!=(h.getElementById("confCon")||h.getElementById("infoCon")||h.getElementById("toolCon")||h.body)&&a.box.parentNode.removeChild(a.box);d("#"+f[0])?a.shde(a.box):(k=h.getElementById("confCon")||h.getElementById("infoCon")||h.getElementById("toolCon")||h.body,e=h.createElement("div"),e.id=f[0],e.className=f[0],e.style.cssText="position: absolute;",e.setAttribute("name","laydate-v"+laydate.v),e.innerHTML='<div id="laydate_top" class="laydate_top"><a class="laydate_tab laydate_chprev"></a><span id="laydate_ym" class="ym"></span><a class="laydate_tab laydate_chnext"></a><div class="laydate_yms" id="laydate_ys"></div><div class="laydate_yms" id="laydate_ms">'+
function(){var b="";a.each(Array(12),function(c){b+='<span class="chooseM" m="'+c+'"><span>'+a.digit(c+1)+"月</span></span>"});return b}()+"</div></div>"+a.viewtb+'<div class="laydate_bottom"><div class="laydate_time" id="laydate_time"></div><div class="laydate_btn"><a id="laydate_ok">确定</a></div></div>',k.appendChild(e),a.box=d("#"+f[0]),a.events(),e=null);a.follow(a.box);c.zIndex?a.box.style.zIndex=c.zIndex:a.removeCssAttr(a.box,"z-index");a.stopMosup("click",a.box);a.initDate(c.sysTime);a.iswrite();
a.check()};g.hideBox=function(){void 0!=a.box&&a.shde(a.box,!0)};a.reshow=function(){a.each(a.query("#"+f[0]+" .laydate_show"),function(b,c){a.removeClass(c,"laydate_show")});return this};a.close=function(){a.reshow();f.currentChooseType=0;!1==a.options.close?(a.shde(a.query("#"+f[0]),!1),a.view(a.elem,a.options)):(a.shde(a.query("#"+f[0]),!0),a.elem=null);document.getElementById("laydate_ys").style.top="-9999px";document.getElementById("laydate_ms").style.top="-9999px"};a.parse=function(b,c,d){b=
b.concat(c);d=d||(a.options?a.options.format:"YYYY-MM-DD");return d.replace(/YYYY|MM|DD|hh|mm|ss/g,function(c,d){b.index=++b.index|0;return a.digit(b[b.index])})};a.creation=function(b,c){var d=a.parse(b);a.elem[f.elemv]=d;c||(a.close(),"function"===typeof a.options.choose&&a.options.choose(d))};a.appendSpan=function(b){if(null!=a.options.choose){var c;$("#laydate_table td span.borderBlue").remove();c=document.createElement("span");c.className="borderBlue";b.appendChild(c)}};a.events=function(){var b=
a.query,c={box:"#"+f[0]};a.addClass(h.body,"laydate_body");f.tds=b("#laydate_table td");f.mms=b("#laydate_ms .chooseM");f.chooseShow=b("#laydate_ym");f.currentChooseType=0;a.each(b(c.box+" .ym"),function(b,e){a.on(e,"click",function(b){a.stopmp(b).reshow();switch(f.currentChooseType){case 0:document.getElementById("laydate_ms").style.top="34px";f.currentChooseType=1;break;case 1:c.YY=parseInt(f.chooseShow.innerHTML);a.viewYears(c.YY);document.getElementById("laydate_ys").style.top="34px";f.currentChooseType=
2;break;default:return}f.chooseShow.innerHTML=0==f.currentChooseType?a.ymd[0]+"年 "+a.digit(a.ymd[1]+1)+"月":1==f.currentChooseType?a.ymd[0]+"年 ":a.ymd[0]-7+" - "+(a.ymd[0]+4)})});a.on(b(c.box),"click",function(){a.reshow()});c.tabYearRange=function(b){var e=c.YY;0==b&&2E3>=e-7||1==b&&2037<=e+4||(c.YY=0==b?c.YY-12:c.YY+12,f.chooseShow.innerHTML=c.YY-7+" - "+(c.YY+4),a.viewYears(c.YY))};c.tabYear=function(b){0===b?a.ymd[0]--:1===b&&a.ymd[0]++;2>b?(a.viewDate(a.ymd[0],a.ymd[1],a.ymd[2]),a.reshow()):a.viewYears(c.YY)};
c.tabMonth=function(b){var c=!1,f=!1;if(b){if(a.maxs[0]==a.ymd[0]&&11==a.ymd[1])return;a.ymd[1]++;12===a.ymd[1]&&(a.ymd[0]++,a.ymd[1]=0,c=!0)}else{if(a.mins[0]==a.ymd[0]&&0==a.ymd[1])return;a.ymd[1]--; -1===a.ymd[1]&&(a.ymd[0]--,a.ymd[1]=11,c=!0)}!0==c&&"function"==typeof a.options.preInitFun&&(a.options.preInitFun(a.ymd[0],function(){a.viewDate(a.ymd[0],a.ymd[1],a.ymd[2])}),f=!0);a.months[a.ymd[1]]<a.ymd[2]&&(a.ymd[2]=a.months[a.ymd[1]]);!1==f&&a.viewDate(a.ymd[0],a.ymd[1],a.ymd[2])};a.each(b("#laydate_top .laydate_tab"),
function(b,e){a.on(e,"click",function(e){a.stopmp(e).reshow();0==f.currentChooseType?c.tabMonth(b):1==f.currentChooseType?c.tabYear(b):c.tabYearRange(b)})});a.each(b("#laydate_top .laydate_tab"),function(b,c){a.on(c,"mousedown",function(a){0==b?setStyle(this,{backgroundImage:"url(../web-static/images/lastPagePressed.png)"}):setStyle(this,{backgroundImage:"url(../web-static/images/nextPagePressed.png)"})})});a.each(b("#laydate_top .laydate_tab"),function(b,c){a.on(c,"mouseup",function(a){setStyle(this,
{backgroundImage:""})})});a.each(b("#laydate_ms .chooseM"),function(b,c){a.on(c,"click",function(b){a.stopmp(b).reshow();document.getElementById("laydate_ms").style.top="-9999px";f.currentChooseType=0;a.hasClass(this,f[1])||(a.months[this.getAttribute("m")|0]<a.ymd[2]&&(a.ymd[2]=a.months[this.getAttribute("m")|0]),a.viewDate(a.ymd[0],this.getAttribute("m")|0,a.ymd[2]))})});a.each(b("#laydate_table td"),function(b,c){a.on(c,"click",function(b){void 0!=a.options.tdDisabled&&!0==a.options.tdDisabled.clickDisabled||
a.hasClass(this,f[1])||(a.stopmp(b),a.creation([this.getAttribute("y")|0,this.getAttribute("m")|0,this.getAttribute("d")|0]))})});f.ok=b("#laydate_ok");a.on(f.ok,"click",function(){a.valid&&a.creation([a.ymd[0],a.ymd[1]+1,a.ymd[2]])});a.on(h,"mouseup",function(){var c=b("#"+f[0]);c&&"none"!==c.style.display&&(a.check()||a.close())})};a.init=void 0;laydate.reset=function(){a.box&&a.elem&&a.follow(a.box)};laydate.now=function(b,c){var d=Date,e;b|0?(e=parseInt(b),e=864E5>e?+new Date+864E5*e:e):e=+new Date;
d=new d(e);return a.parse([d.getFullYear(),d.getMonth()+1,d.getDate()],[d.getHours(),d.getMinutes(),d.getSeconds()],c)};laydate.skin=function(b){a.skinLink.href=a.getPath+f[4]+b+f[5]}}(window);
