//--------------------------------------------------------------------------------------------------
// 달력호출 프로그램
//--------------------------------------------------------------------------------------------------
nombresMonth = Array("","1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월");
var minYear = 1990;
var maxYear = 2020;
var year;
var month;
var day;
var dateObj;
var dateTitle;
var separator ="";
// 해당월에 들어있는 날짜수를 리턴
function daysOfMonth(year,month) {
if ((month==1)||(month==3)||(month==5)||(month==7)||(month==8)||(month==10)||(month==12)) days=31
else if ((month==4)||(month==6)||(month==9)||(month==11)) days=30
else if ((((year % 100)==0) && ((year % 400)==0)) || (((year % 100)!=0) && ((year % 4)==0))) days = 29
else days = 28;
return days;
};
// 월에 대한 selectBox를 생성
function makeMonths(curMonth) {
var selectorMonth = "";
selectorMonth = "" +
"";
selectorMonth = selectorMonth + "\r\n";
return selectorMonth;
}
function goPreMonth(){
if(Number(self.document.form1.month[self.document.form1.month.selectedIndex].value)-1 < 1) return;
createCal(self.document.form1.year[self.document.form1.year.selectedIndex].value, Number(self.document.form1.month[self.document.form1.month.selectedIndex].value)-1, day);
}
function goNextMonth(){
if(Number(self.document.form1.month[self.document.form1.month.selectedIndex].value)+1 > 12) return;
createCal(self.document.form1.year[self.document.form1.year.selectedIndex].value, Number(self.document.form1.month[self.document.form1.month.selectedIndex].value)+1, day);
}
function goChangeMonthLeftOver(obj){
obj.src = "../../images/common/page_ar_q_1a.gif";
}
function goChangeMonthLeftOut(obj){
obj.src = "../../images/common/page_ar_q_1b.gif";
}
function goChangeMonthRightOver(obj){
obj.src = "../../images/common/page_ar_q_2a.gif";
}
function goChangeMonthRightOut(obj){
obj.src = "../../images/common/page_ar_q_2b.gif";
}
// 연도에 대한 selectBox를 생성
function makeYears(curYear) {
var selectorYear = "";
var onmouseover = "";
var onmouseout = "";
selectorYear = "" +
"";
selectorYear = selectorYear + "";
return selectorYear;
}
function goPreYear(){
if(Number(self.document.form1.year[self.document.form1.year.selectedIndex].value)-1 < minYear) return;
createCal(Number(self.document.form1.year[self.document.form1.year.selectedIndex].value)-1, self.document.form1.month[self.document.form1.month.selectedIndex].value, day);
}
function goNextYear(){
if(Number(self.document.form1.year[self.document.form1.year.selectedIndex].value)+1 > maxYear) return;
createCal(Number(self.document.form1.year[self.document.form1.year.selectedIndex].value)+1, self.document.form1.month[self.document.form1.month.selectedIndex].value, day);
}
function goChangeYearLeftOver(obj){
obj.src = "../../images/common/page_ar_q_1a.gif";
}
function goChangeYearLeftOut(obj){
obj.src = "../../images/common/page_ar_q_1b.gif";
}
function goChangeYearRightOver(obj){
obj.src = "../../images/common/page_ar_q_2a.gif";
}
function goChangeYearRightOut(obj){
obj.src = "../../images/common/page_ar_q_2b.gif";
}
// 연월이 바뀔 경우 해당 달력을 remake
function makeCalDesc(year,month) {
var caldesc = "
\r\n" +
"
\r\n";
var baseDate = new Date();
var i = 0;
var row = 1;
var col = 0;
var temp;
var strtemp;
baseDate.setYear(year);
baseDate.setMonth(month-1);
alert(day);
baseDate.setDate(day);
var startingPos = baseDate.getDay();
var days = startingPos + daysOfMonth(year, month);
caldesc = caldesc + "
\n";
for (col = 0; col < 7 ; col++) {
temp = i - startingPos + 1;
if ((temp == nowDay()) && (month == nowMonth()) && (year == nowYear())) {
caldesc = caldesc + "
";
} else {
caldesc = caldesc + "
";
}
if ( i < startingPos )
caldesc = caldesc + " ";
else if ( i < days ) {
strtemp = makeVal(year, month, temp);
caldesc = caldesc + "" + temp + "";
}
else
caldesc = caldesc + " ";
i++;
caldesc = caldesc + "
\n";
}
caldesc = caldesc + "
\n";
}
caldesc = caldesc + "
\r\n";
return caldesc;
}
function makeCalDesc(year,month,arg_date) {
var caldesc = "
\r\n" +
"
\r\n";
var baseDate = new Date();
var i = 0;
var row = 1;
var col = 0;
var temp;
var strtemp;
baseDate.setYear(year);
baseDate.setMonth(month-1);
baseDate.setDate(1);
var startingPos = baseDate.getDay();
var days = startingPos + daysOfMonth(year, month);
caldesc = caldesc + "
\r\n";
return caldesc;
}
// 전체 달력을 새로 생성
function call_cal(year, month, dateTitle) {
var winopt = "status=no,width=220,height=255,left=100,top=200";
calwin = window.open("./jsp/com/calendar.jsp?p_year="+year+"&p_month="+month+"&p_dateTitle="+dateTitle,"calwin",winopt);
}
function call_cal(year, month, date, dateTitle) {
var winopt = "status=no,width=250,height=265,left=100,top=200";
calwin = window.open("./jsp/com/calendar.jsp?p_year="+year+"&p_month="+month+"&p_day="+date+"&p_dateTitle="+dateTitle,"calwin",winopt);
}
function createCal(year, month) {
var html = "
\r\n" +
"
\r\n \r\n
\r\n";
html = html + makeCalDesc(year,month);
html = html + " \r\n" +
"