var nodesk=true;todaycolor="aqua";stermcolor="blue";function gethint(cldObj){s="";if(cldObj.hint1.length>0) s+=replace(cldObj.hint1,"\r\n"," <br> ");if(cldObj.hint2.length>0){if(s.length>0) s+=" <br> ";;s=s+cldObj.hint2;}if(cldObj.hint3.length>0){if(s.length>0) s+=" <br> ";s=s+cldObj.hint3;}return s;}tY=0;tM=0;tD=0;
function getdayinfo(ob){var ds="";ds=ob.sYear+"年"+ob.sMonth+"月"+ob.sDay+"日"+"<br>农历"+(ob.isLeap?'闰':'')+GetcMon(ob.lMonth)+"月"+GetcDay(ob.lDay);
return ds;}function drawCld(SY,SM){var i,sD,s,size;cldObj=new calendar(SY,SM);if(cldObj.firstWeek==0) cldObj.firstWeek=7;
ldyear=cldObj[0].lYear;nlyear=cyclical(ldyear-1900+36)+'【'+Animals[(ldyear-4)%12]+'】年';lsyear=cldObj[cldObj.length-1].lYear;if(lsyear!=ldyear){nlyear+="-"+cyclical(lsyear-1900+36)+'【'+Animals[(lsyear-4)%12]+'】年';}document.getElementById("GZ").innerHTML=nlyear;document.getElementById("YMBG").innerHTML=monthName[SM];
for(i=0;i<42;i++){sObj=document.getElementById('SD'+i);lObj=document.getElementById('LD'+i);gObj=document.getElementById('GD'+i);lObj.style.color='';sObj.style.color='';sObj.style.background='';gObj.style.background=backcolor;
sD=i-cldObj.firstWeek+1;if(sD>-1&&sD<cldObj.length){theob=cldObj[sD];theob.v=i;sObj.innerHTML=sD+1;if(theob.lDay==1){ts='<b>'+(theob.isLeap?'闰':'')+theob.lMonth+'月';if(!theob.isLeap) ts+=(monthDays(theob.lYear,theob.lMonth)==29?'小':'大');ts+='</b>';lObj.innerHTML=ts;}
else{lObj.innerHTML=GetcDay(theob.lDay);}if(nodesk){s1=theob.lunarFestival;s2=theob.solarFestival;s3=theob.solarTerms;
if(s3.length>0){lObj.innerHTML=s3;lObj.style.color=stermcolor;if(s1.length>0){sObj.innerHTML=s1;sObj.style.color=theob.color;	}
else if(s2.length>0){sObj.innerHTML=s2;sObj.style.color=theob.color;}}else{if(s1.length>0){lObj.innerHTML=s1;lObj.style.color=theob.color;}else if(s2.length>0){lObj.innerHTML=s2;lObj.style.color=theob.color;}
}}}else{sObj.innerHTML='';lObj.innerHTML='';}}}var cldObj;function changeCld(){var y,m;y=document.CLDFORM.SY.selectedIndex+1900;m=document.CLDFORM.SM.selectedIndex;drawCld(y,m);srvread();}function pushBtm(K){switch(K){case 'YU':if(document.CLDFORM.SY.selectedIndex>0) document.CLDFORM.SY.selectedIndex--;break;case 'YD':if(document.CLDFORM.SY.selectedIndex<150) document.CLDFORM.SY.selectedIndex++;break;case 'MU':if(document.CLDFORM.SM.selectedIndex>0){document.CLDFORM.SM.selectedIndex--;}else{document.CLDFORM.SM.selectedIndex=11;if(document.CLDFORM.SY.selectedIndex>0) document.CLDFORM.SY.selectedIndex--;}break;case 'MD':if(document.CLDFORM.SM.selectedIndex<11){document.CLDFORM.SM.selectedIndex++;}else{document.CLDFORM.SM.selectedIndex=0;if(document.CLDFORM.SY.selectedIndex<150) document.CLDFORM.SY.selectedIndex++;}break;default:document.CLDFORM.SY.selectedIndex=tY-1900;document.CLDFORM.SM.selectedIndex=tM-1;}changeCld();}
function cldinit(){tY=nyear;tM=nmonth;tD=nday;document.CLDFORM.SY.selectedIndex=tY-1900;document.CLDFORM.SM.selectedIndex=tM-1;pushBtm('');
}var curd=null;function mClick(v){var sObj=document.getElementById('SD'+v);if(sObj.innerHTML!=''){curd=v-cldObj.firstWeek+1;
showframe("hintset",-200,-100);hset.focuson();}else{curd=null;closeinput();}}function mOvr(v){sObj=document.getElementById('SD'+ v);
if(sObj.innerHTML!=''){d=v-cldObj.firstWeek+1;tmphint=gethint(cldObj[d]);if(tmphint.length>0){document.getElementById("detail").innerHTML=tmphint;
}else{document.getElementById("detail").innerHTML=getdayinfo(cldObj[d])+"<br><small><i>点击写入记事</i></small>";}showframe("detail",12,8);
}}function mOut(){hideframe("detail");}hintcolor="lightskyblue";function closeinput(){hideframe("hintset");}function drawhint(cobj){if(cobj.isToday){thint=gethint(cobj);if(thint.length>0){document.getElementById("todayhint").innerHTML=thint;document.getElementById("hintframe").style.display="block";
}}if(cobj.v>-1){sObj=document.getElementById('SD'+cobj.v);gObj=document.getElementById('GD'+cobj.v);hlen=gethint(cobj).length;if(hlen>0) gObj.style.background=hintcolor;else gObj.style.background=backcolor;if(cobj.isToday) sObj.style.background=todaycolor;else if(hlen>0) sObj.style.background=hintcolor;else sObj.style.background=backcolor;}}
