function getFirstDay(b,a){return(new Date(b,a,1)).getDay()}function getMonthLen(b,a){b=new Date(b,a+1,1);b.setHours(b.getHours()-3);return b.getDate()}
function populateTable(b,a,c,f){var p=Array(a);var m=Array(a);var q=Array(a);var h=Array(a),l=Array(a),r;var g=b.getMonth();var n=b.getFullYear();var t=new Date;document.getElementById("tableHaderMonth").innerHTML=n+" / "+("0"+(g+1)).slice(-2);var d=document.getElementById("tableHeaderLink");var e="<a href='#' class='movelink' onClick='changeMonth( "+n+","+(g+1)+","+b.getDate()+",-12,"+a+","+c.getFullYear()+","+c.getMonth()+","+c.getDate()+");return false;'>&lt;&lt;</a>";e+="<a href='#' class='movelink' onClick='changeMonth( "+
n+","+(g+1)+","+b.getDate()+",-1,"+a+","+c.getFullYear()+","+c.getMonth()+","+c.getDate()+");return false;'>&lt;</a>";e+="<a href='#' class='movelink' onClick='changeToday("+a+","+c.getFullYear()+","+c.getMonth()+","+c.getDate()+");'>\u4eca\u65e5</a>";e+="<a href='#' class='movelink' onClick='changeMonth( "+n+","+(g+1)+","+b.getDate()+",1,"+a+","+c.getFullYear()+","+c.getMonth()+","+c.getDate()+");return false;'>&gt;</a>";e+="<a href='#' class='movelink' onClick='changeMonth( "+n+","+(g+1)+","+b.getDate()+
",12,"+a+","+c.getFullYear()+","+c.getMonth()+","+c.getDate()+");return false;'>&gt;&gt;</a>";d.innerHTML=e;g-=Math.floor(a/2);0>g&&(g+=12,--n);null==b&&(b="undefined"!=typeof window.dialogArguments?window.dialogArguments:getPopArgs(),f&&(b=b.replace(/\//g,"")),b=new Date(b.substring(0,4),b.substring(4,6)-1,b.substring(6,8)));for(d=0;d<a;d++)0==d?(h[d]=n,l[d]=g):11>l[d-1]?(h[d]=h[d-1],l[d]=l[d-1]+1):(h[d]=h[d-1]+1,l[d]=0),q[d]=HYBS_CAL_START_MON?(getFirstDay(h[d],l[d])+6)%7:getFirstDay(h[d],l[d]),
p[d]=getMonthLen(h[d],l[d]),e="0"+(l[d]+1),e=e.slice(e.length-2)+"\u6708",0==d?document.getElementById("tableHeader").innerHTML=e:document.getElementById("tableHeader"+d).innerHTML=e,m[d]=1;for(g=document.getElementById("tableBody");0<g.rows.length;)g.deleteRow(0);var u=!1;for(r=0;!u;)if(n=g.insertRow(g.rows.length))for(k=0;k<a;k++)for(d=0;7>d;d++)if(e=n.insertCell(n.cells.length),e.className+=" cell",6==d&&k!=a-1&&(e.className+=" cell-right"),1==g.rows.length&&d<q[k])e.innerHTML="&nbsp;";else if(m[k]==
p[k]&&(r+=1,r==a&&(u=!0)),m[k]<=p[k]){var v=new Date(h[k],l[k],m[k]);if(0==v.getDay()||6==v.getDay())e.className+=" holiday";t.getFullYear()==h[k]&&t.getMonth()==l[k]&&t.getDate()==m[k]&&(e.className+=" now");null!=b&&c.getFullYear()==h[k]&&c.getMonth()==l[k]&&c.getDate()==m[k]&&(e.id="basic");e.innerHTML="<a href='#'onclick='chooseDate("+m[k]+","+l[k]+","+h[k]+","+f+"); return false;'>"+m[k]+"</a>";m[k]++}else e.innerHTML="&nbsp;";else u=!0;setWinSize()}
function chooseDate(b,a,c,f){c=c.toString();a=9<=a?(a+1).toString():"0"+(a+1).toString();b=10<=b?b.toString():"0"+b.toString();f?rtnPopup(c+"/"+a+"/"+b):rtnPopup(c+a+b);"undefined"!=typeof window.dialogArguments&&window.close()}
function initCalendar(b){b="undefined"!=typeof b?b:1;var a=getPopArgs();var c=0<=a.indexOf("/");c&&(a=a.replace(/\//g,""));var f=null==a||8!=a.length||isNaN(a)?new Date:new Date(a.substring(0,4),a.substring(4,6)-1,a.substring(6,8));window.returnValue=a;populateTable(f,b,f,c);document.getElementById("calendar").style.visibility="visible";window.focus()}
function setWinSize(){var b,a;if(b=document.getElementById("calendarTable")){var c=a=0;if(document.all){var f=getInternetExplorerVersion();7>f&&(c=6,a=52);window.dialogWidth=b.offsetWidth+c+"px";window.dialogHeight=b.offsetHeight+a+"px"}else{f=10;do c=b.offsetWidth-(document.documentElement.clientWidth||document.body.clientWidth),a=b.offsetHeight-(document.documentElement.clientHeight||document.body.clientHeight),window.resizeBy(c,a),f--;while((0<c||0<c)&&0<f)}}}
function changeToday(b,a,c,f){populateTable(new Date,b,new Date(a,c,f))}function changeMonth(b,a,c,f,p,m,q,h){a=Number(a)+f;f=b;0>=a?(a=12+a,f=Number(b)-1):13<=a&&(a-=12,f=Number(b)+1);populateTable(new Date(f,a-1,c),p,new Date(m,q,h))};
