/** * XMLHttpRequest»ý¼º * @param null * @return Object */ function xhr() { var xmlreq = false; if (window.XMLHttpRequest) { xmlreq = new XMLHttpRequest();} else if (window.ActiveXObject) { try { xmlreq = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e1) { try { xmlreq = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) {} } } return xmlreq; } /** * ´Þ·ÂÄÁÆ®·Ñ * @author Â÷Çö¹Ì * @date 2008-04-16 */ function CalendarController() { var oDate = new Date(); this.calendar_ym = oDate.getFullYear().toString() + ( oDate.getMonth() + 1 ).toString(); } /** * ´Þ·ÂÆû »ý¼º * @param Number year * @param Number month * @param Number date * @return void */ CalendarController.prototype.getCalendar = function(year, month, date) { if(!year) year = ''; if(!month) month = ''; if(!date) date = ''; if(year == '') { var oDate2 = new Date(); dateDispaly = oDate2.getFullYear().toString()+'³â '+ ( oDate2.getMonth() + 1 ).toString()+'¿ù'; } else { dateDispaly = year.toString()+'³â '+ month.toString()+'¿ù'; } oXHR = xhr(); oXHR.onreadystatechange = function() { if( oXHR.readyState == 4 ) { if( oXHR.status == 200 ) { document.getElementById('result').innerHTML = oXHR.responseText; document.getElementById('cur').innerHTML = '' + dateDispaly + ''; } } }; oXHR.open('POST', '/chtml/reservation/reservation_calender.php?comReservationMode=calender&template=bizdemo157908', true); oXHR.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); oXHR.send('year=' + year + '&month=' + month + '&date=' + date); } /** * ´Þ·Â¿ù À̵¿ * @param String type * @return void */ CalendarController.prototype.moveMonth = function(type) { var ym = this.calendar_ym; var year = ym.substring(0, 4); var month = parseInt(ym.substring(4),10); if( type == 'prev') { month--; if( month == 0 ) { year--; month = 12; } } if( type == 'next') { month++; if( month == 13 ) { year++; month = 1; } } this.getCalendar(year, month); this.calendar_ym = year.toString() + month.toString(); } /** * event-onload */ window.onload = function() { ACV = new CalendarController(); ACV.getCalendar(); }