var subTarget

var fixedX = 0; // //////// ·¹ÀÌ¾î XÃà À§Ä¡ (0 : ¹öÆ°¿¡ ¹Ù·Î ¾Æ·¡¿¡ Ç¥½Ã)
var fixedY = 0; // //////////// ·¹ÀÌ¾î YÃà À§Ä¡ (0 : ¹öÆ°¿¡ ¹Ù·Î ¾Æ·¡¿¡ Ç¥½Ã)
var startAt = 0; // /////////// ÀÏ¿äÀÏ Ç¥½Ã ºÎºÐ / 0 : ÀÏ¿äÀÏ(ÀÏ¿ùÈ­...) / 1 : ¿ù¿äÀÏ(...±ÝÅäÀÏ)
var showToday = 1; // ¿À´Ã ³¯ÀÚ Ç¥½Ã À¯¹« - 0 : °¨Ãã / 1 : º¸ÀÓ
var imgDir = './'; // ÀÌ¹ÌÁö µð·ºÅä¸® - ./ : ÇöÀç µð·ºÅä¸®

// ///////////////////////////// °¢ º¯¼ö ¼±¾ð ///////////////////
var crossobj, crossMonthObj, crossYearObj, monthSelected, yearSelected, dateSelected, omonthSelected, oyearSelected, odateSelected, monthConstructed, yearConstructed, intervalID1, intervalID2, timeoutID1, timeoutID2, ctlToPlaceValue, ctlNow, dateFormat, nStartingMonth, nStartingYear
var objSelIdx;
var bPageLoaded = false;
var ie = document.all;
var dom = document.getElementById;
var bShow = false;
var ns4 = document.layers;

var today = new Date(); // ///////////// ³¯ÀÚ º¯¼ö ¼±¾ð
var dateNow = today.getDate(); // ////////////// ·ÎÄÃ ÄÄÇ»ÅÍÀÇ ÀÏ(day)À» ±¸ÇÔ
var monthNow = today.getMonth(); // /////////////// ·ÎÄÃ ÄÄÇ»ÅÍÀÇ ¿ù(month)À» ±¸ÇÔ
var yearNow = today.getYear(); // /////////////// ·ÎÄÃ ÄÄÇ»ÅÍÀÇ ³â(year)À» ±¸ÇÔ

var monthName = new Array("1¿ù", "2¿ù", "3¿ù", "4¿ù", "5¿ù", "6¿ù", "7¿ù", "8¿ù", "9¿ù",
		"10¿ù", "11¿ù", "12¿ù")
var monthName2 = new Array("1¿ù", "2¿ù", "3¿ù", "4¿ù", "5¿ù", "6¿ù", "7¿ù", "8¿ù",
		"9¿ù", "10¿ù", "11¿ù", "12¿ù")

if (startAt == 0) {
	dayName = new Array("ÀÏ", "¿ù", "È­", "¼ö", "¸ñ", "±Ý", "Åä")
} else {
	dayName = new Array("¿ù", "È­", "¼ö", "¸ñ", "±Ý", "Åä", "ÀÏ")
}
var oPopup = window.createPopup();
var oPopBody = oPopup.document.body;
var strCalendar;
var cleft;
var ctop;

if (dom) {
	strCalendar = "<img src='' width=0 height=0>";
	strCalendar += "<style type='text/css'>";
	strCalendar += "td {font-size:12px; font-family:±¼¸²; text-decoration:none; }";
	strCalendar += "A:link,A:active,A:visited{text-decoration:none;font-size:12PX;color:#333333;}";
	strCalendar += "A:hover {text-decoration:none; color:ff9900}";
	strCalendar += "font { font-size: 9pt; }";
	strCalendar += ".cnj_close {font-size:9pt;color:#000000; background-color:#EFEFEF; border-width:1; border-color:#808080; border-style:solid;cursor:hand;font-weight:bold;height:16px;width:16px;text-align:center;vertical-align:bottom}";
	strCalendar += ".cnj_close2 {font-size:9pt;color:#000000; background-color:#EFEFEF; border-width:1; border-color:#808080; border-style:solid;cursor:hand;font-weight:bold;height:16px;width:16px;text-align:center;vertical-align:bottom}";
	strCalendar += ".cnj_input {background-color:rgb(240,240,240);border-width:1pt; height:16pt;cursor:hand;}";
	strCalendar += ".cnj_input2 {font-size:9pt;color:#808080; background-color:#EFEFEF; border-width:1; border-color:#808080; border-style:solid;cursor:hand;height:16px;}";
	strCalendar += ".cnj_input3 {font-size:9pt;color:#000000; background-color:#FFFFFF; border-width:1; border-color:#C00000; border-style:solid;cursor:hand;height:16px;}";
	strCalendar += ".cnj_input4 {font-size:9pt;color:#C00000; background-color:#FFFFFF; border-width:1; border-color:#808080; border-style:solid;cursor:hand;height:16px;}";
	strCalendar += ".cnj_td     {border-width:1;border-style:solid;border-color:#a0a0a0;}";
	strCalendar += ".day_on     {font-size:9pt;background-color:#F29708; cursor:hand;height:16px;}";
	strCalendar += "</style>";

	strCalendar += "<div id='calendar' style='z-index:+999;position:absolute;;'>";
	strCalendar += "<table width='200px' class='cnj_td'>";
	strCalendar += " <tr bgcolor='#EEEEEE' height=20>";
	strCalendar += "  <td>";
	strCalendar += "   <table width='100%' border=0>";
	strCalendar += "    <tr height=20>";
	strCalendar += "     <td style='padding:0px;'><font color='#ffffff'><B><span id='caption'></span></B></font></td>";
	strCalendar += "     <td align=right><input type='button' value='x' class='cnj_close' title='´Ý±â' onclick='parent.oPopup.hide()' onfocus='this.blur()' onMouseover=\"this.className='cnj_close2'\" onMouseout=\"this.className='cnj_close'\"></td>";
	strCalendar += "    </tr>";
	strCalendar += "   </table>";
	strCalendar += "  </td>";
	strCalendar += " </tr>";
	strCalendar += " <tr height=1>";
	strCalendar += "  <td style='padding:2px' bgcolor=#ffffff><span id='content'></span></td>";
	strCalendar += " </tr>";

	if (showToday == 1) {
		//strCalendar += "<tr bgcolor=#f0f0f0 height=20><td style='padding:5px' align=center><a title='¿À´Ã ³¯Â¥·Î Ç¥½ÃÇÏ±â' href='javascript:monthSelected=monthNow;yearSelected=yearNow;constructCalendar();'><span id='lblToday'></span></a></td></tr>";
		strCalendar += "<tr bgcolor=#f0f0f0 height=20><td style='padding:5px' align=center><span id='lblToday'></span></td></tr>";
	}

	strCalendar += "</table>";
	strCalendar += "</div>";
	strCalendar += "<div id='selectMonth' style='z-index:+999;position:absolute;display:none;'></div> ";
	strCalendar += "<div id='selectYear' style='z-index:+999;position:absolute;display:none;'></div>";
	oPopBody.innerHTML = strCalendar;
}


function HolidayRec(d, m, y, desc) {
	this.d = d;
	this.m = m;
	this.y = y;
	this.desc = desc;
}

var HolidaysCounter = 0;
var Holidays = new Array();

function addHoliday(d, m, y, desc) {
	Holidays[HolidaysCounter++] = new HolidayRec(d, m, y, desc);
}

var styleAnchor = "text-decoration:none;color:black;cursor:hand;width:100%;height:100%";
var styleLightBorder = "border-style:solid;border-width:1px;border-color:#a0a0a0;text-decoration:underline;font-weight:bold;cursor:hand;width:100%;height:100%";

function padZero(num) {
	return (num < 10) ? '0' + num : num;
}

function constructDate(d, m, y) {
	sTmp = dateFormat
	sTmp = sTmp.replace("dd", "<e>");
	sTmp = sTmp.replace("d", "<d>");
	sTmp = sTmp.replace("<e>", padZero(d));
	sTmp = sTmp.replace("<d>", d);
	sTmp = sTmp.replace("mmmm", "<p>");
	sTmp = sTmp.replace("mmm", "<o>");
	sTmp = sTmp.replace("mm", "<n>");
	sTmp = sTmp.replace("m", "<m>");
	sTmp = sTmp.replace("<m>", m + 1);
	sTmp = sTmp.replace("<n>", padZero(m + 1));
	sTmp = sTmp.replace("<o>", monthName[m]);
	sTmp = sTmp.replace("<p>", monthName2[m]);
	sTmp = sTmp.replace("yyyy", y);

	return sTmp.replace("yy", padZero(y % 100));
}

function closeCalendar() {
	oPopup.hide();
	ctlToPlaceValue.value = constructDate(dateSelected, monthSelected, yearSelected);
}

function moveincMonth() {
	monthSelected++;

	if (monthSelected > 11) {
		monthSelected = 0;
		yearSelected++;
	}
	constructCalendar();
}

function movedecMonth() {
	monthSelected--;

	if (monthSelected < 0) {
		monthSelected = 11;
		yearSelected--;
	}
	constructCalendar();
}

function incMonth() {
	if (nStartingMonth + 6 == 12)
		return;
	for (i = 0; i < 7; i++) {
		newMonth = (i + nStartingMonth) + 1;

		if (newMonth > 12) {
			nStartingMonth--;
			break;
		}
		if (newMonth == monthSelected + 1) {
			txtMonth = " <B>" + newMonth + "¿ù</B> ";
		} else {
			txtMonth = " " + newMonth + "¿ù";
		}
		oPopup.document.getElementById("m" + i).innerHTML = txtMonth;
	}
	nStartingMonth++;
	bShow = true;
}

function decMonth() {
	if (nStartingMonth == 1)
		return;
	for (i = 0; i < 7; i++) {
		newMonth = (i + nStartingMonth) - 1;

		if (newMonth < 1) {
			nStartingMonth++;
			break;
		}
		if (newMonth == monthSelected + 1) {
			txtMonth = " <B>" + newMonth + "¿ù</B> ";
		} else {
			txtMonth = " " + newMonth + "¿ù";
		}
		oPopup.document.getElementById("m" + i).innerHTML = txtMonth;
	}
	nStartingMonth--;
	bShow = true;
}

function selectMonth(nMonth) {
	monthSelected = parseInt(nMonth + nStartingMonth - 1);
	monthConstructed = false;
	constructCalendar();
	popDownMonth();
}

function constructMonth() {
	popDownYear();
	sHTML = "";

	if (!monthConstructed) { // ¿ù ÀÌÀü ¿ù ¸µÅ©
		sHTML += "<tr><td align='center' style='cursor:pointer'  "
		sHTML += " onmouseover='this.style.backgroundColor=\"#FFCC99\"' "
		sHTML += " onmouseout='clearInterval(parent.intervalID1);this.style.backgroundColor=\"\"'  "
		sHTML += " onmousedown='clearInterval(parent.intervalID1);parent.intervalID1=setInterval(\"parent.decMonth()\",30)' "
		sHTML += " onmouseup='clearInterval(parent.intervalID1)'> "
		sHTML += " ¡ã</td></tr>";
		j = 0;

		var nSelectedMonth = monthSelected + 1;

		nStartingMonth = (nSelectedMonth - 3) < 1 ? 1 : nSelectedMonth - 3; // ½ÃÀÛ¿ù
		// - 3
		// ÀÌ
		// 1º¸´Ù
		// ÀÛÀ¸¸é
		// 1·Î
		// °íÁ¤
		nStartingMonth = nStartingMonth > 6 ? 6 : nStartingMonth; // ½ÃÀÛ¿ùÀÌ 6º¸´Ù
		// Å©¸é 6·Î °íÁ¤
		// (6 ½ÃÀÛ ¿ù +
		// ¸ñ·Ï ¼ýÀÚ 6 =
		// 12 Á¾·á ¿ù)

		var nEndMonth = (nSelectedMonth + 3) > 12 ? 12 : (nSelectedMonth + 3); // Á¾·á¿ù
		// + 3ÀÌ
		// 12º¸´Ù
		// Å©¸é
		// 12·Î
		// °íÁ¤
		nEndMonth = nEndMonth < 7 ? 7 : nEndMonth; // Á¾·á ¿ùÀÌ 7º¸´Ù ÀÛÀ¸¸é 7·Î °íÁ¤

		for (i = nStartingMonth; i <= nEndMonth; i++) {
			sName = i;

			// ////////////// ÇöÀç ¿ù ////////////////////////
			if (i == nSelectedMonth) {
				sName = "<b>" + sName + "</b>"
			}
			sHTML += "<tr><td height='15' id='m"
					+ j
					+ "' onmouseover='this.style.backgroundColor=\"#FFCC99\"' onmouseout='this.style.backgroundColor=\"\"' "
			sHTML += " style='cursor:pointer' onClick='parent.selectMonth(" + j
					+ ");event.cancelBubble=true'> " + sName + "¿ù"
			sHTML += "</td></tr>";
			j++;
		}

		// ¿ù ´ÙÀ½ ¿ù ¸µÅ©
		sHTML += "<tr><td align='center' onmouseover='this.style.backgroundColor=\"#FFCC99\"' style='cursor:pointer' "
		sHTML += " onmouseout='clearInterval(parent.intervalID2);this.style.backgroundColor=\"\"' "
		sHTML += " onmousedown='clearInterval(parent.intervalID2);parent.intervalID2=setInterval(\"parent.incMonth()\",30)' "
		sHTML += " onmouseup='clearInterval(parent.intervalID2)'> "
		sHTML += " ¡å</td></tr>";

		// ///// ¿ù Ç¥ Å©±â ///////////////////////////////
		oPopup.document.getElementById("selectMonth").innerHTML = ""
				+ "<table width='50' style='font-family:±¼¸²; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;' bgcolor='#FFFFDD' "
				+ " onmouseover='clearTimeout(parent.timeoutID2)' "
				+ " onmouseout='clearTimeout(parent.timeoutID2);parent.timeoutID2=setTimeout(\"parent.popDownMonth()\",100)' cellspacing=0>"
				+ "" + sHTML + "" + "</table>";
		monthConstructed = true;
	}
}

function popUpMonth() {
	constructMonth();
	crossMonthObj.style.display = "";
	crossMonthObj.style.left = crossobj.style.left + 50;
	crossMonthObj.style.top = crossobj.style.top + 26;
}

function popDownMonth() {
	crossMonthObj.style.display = "none";
}

function incYear() {
	for (i = 0; i < 7; i++) {
		newYear = (i + nStartingYear) + 1;

		if (newYear == yearSelected) {
			txtYear = " <B>" + newYear + "³â  </B> ";
		} else {
			txtYear = " " + newYear + "³â  ";
		}
		oPopup.document.getElementById("y" + i).innerHTML = txtYear;
	}
	nStartingYear++;
	bShow = true;
}

function decYear() {
	for (i = 0; i < 7; i++) {
		newYear = (i + nStartingYear) - 1;

		if (newYear == yearSelected) {
			txtYear = " <B>" + newYear + "³â  </B> ";
		} else {
			txtYear = " " + newYear + "³â  ";
		}
		oPopup.document.getElementById("y" + i).innerHTML = txtYear;
	}
	nStartingYear--;
	bShow = true;
}

function selectYear(nYear) {
	yearSelected = parseInt(nYear + nStartingYear);
	yearConstructed = false;
	constructCalendar();
	popDownYear();
}

function constructYear() {
	popDownMonth();
	sHTML = "";

	if (!yearConstructed) { // ³âµµ ÀÌÀü ³âµµ ¸µÅ©
		sHTML = "<tr><td align='center' style='cursor:pointer'  "
		sHTML += " onmouseover='this.style.backgroundColor=\"#FFCC99\"' "
		sHTML += " onmouseout='clearInterval(parent.intervalID1);this.style.backgroundColor=\"\"'  "
		sHTML += " onmousedown='clearInterval(parent.intervalID1);parent.intervalID1=setInterval(\"parent.decYear()\",30)' "
		sHTML += " onmouseup='clearInterval(parent.intervalID1)'> "
		sHTML += " ¡ã</td></tr>";
		j = 0;
		nStartingYear = yearSelected - 3;

		for (i = (yearSelected - 3); i <= (yearSelected + 3); i++) {
			sName = i;

			if (i == yearSelected) {
				sName = "<b>" + sName + "</b>"
			}
			sHTML += "<tr><td height='15' id='y"
					+ j
					+ "' onmouseover='this.style.backgroundColor=\"#FFCC99\"' onmouseout='this.style.backgroundColor=\"\"' "
			sHTML += " style='cursor:pointer' onClick='parent.selectYear(" + j
					+ ");event.cancelBubble=true'> " + sName + "³â  "
			sHTML += "</td></tr>";
			j++;
		}

		// ³âµµ ´ÙÀ½ ³âµµ ¸µÅ©
		sHTML += "<tr><td align='center' onmouseover='this.style.backgroundColor=\"#FFCC99\"' style='cursor:pointer' "
		sHTML += " onmouseout='clearInterval(parent.intervalID2);this.style.backgroundColor=\"\"' "
		sHTML += " onmousedown='clearInterval(parent.intervalID2);parent.intervalID2=setInterval(\"parent.incYear()\",30)' "
		sHTML += " onmouseup='clearInterval(parent.intervalID2)'> "
		sHTML += " ¡å</td></tr>";

		// ///// ³âµµ Ç¥ Å©±â ///////////////////////////////
		oPopup.document.getElementById("selectYear").innerHTML = ""
				+ "<table width='55' style='font-family:±¼¸²; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;' bgcolor='#FFFFDD' "
				+ " onmouseover='clearTimeout(parent.timeoutID2)' "
				+ " onmouseout='clearTimeout(parent.timeoutID2);parent.timeoutID2=setTimeout(\"parent.popDownYear()\",100)' cellspacing=0>"
				+ "" + sHTML + "" + "</table>";
		yearConstructed = true;
	}
}

function popDownYear() {
	clearInterval(intervalID1);
	clearTimeout(timeoutID1);
	clearInterval(intervalID2);
	clearTimeout(timeoutID2);
	crossYearObj.style.display = "none";
}

function popUpYear() {
	constructYear();
	crossYearObj.style.display = "";
	crossYearObj.style.left = crossobj.style.left
			+ (6 + oPopup.document.getElementById("spanYear").offsetLeft)
			+ "px";
	crossYearObj.style.top = crossobj.style.top + 26;
}

function constructCalendar() {
	var aNumDays = Array(31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	var dateMessage;
	var startDate = new Date(yearSelected, monthSelected, 1);
	var endDate;
	var intWeekCount = 1;

	if (monthSelected == 1) {
		endDate = new Date(yearSelected, monthSelected + 1, 1);
		endDate = new Date(endDate - (24 * 60 * 60 * 1000));
		numDaysInMonth = endDate.getDate();
	} else {
		numDaysInMonth = aNumDays[monthSelected];
	}

	datePointer = 0;
	dayPointer = startDate.getDay() - startAt;

	if (dayPointer < 0) {
		dayPointer = 6;
	}
	sHTML = "<table  border=1 cellspacing=0 cellpadding=2 style='border-collapse:collapse;font-family:µ¸¿ò;font-size:10px;bordercolor:#E1E1E1;' ><tr height=16 style='background-color:#EFEFEF;'>";

	for (i = 0; i < 7; i++) { // ///// ¿äÀÏ ///////////////////////
		sHTML += "<td width='27' align='right'><B>" + dayName[i] + "</B></td>";
	}
	sHTML += "</tr><tr height=16>";

	for ( var i = 1; i <= dayPointer; i++) { // ºó ³¯Â¥
		sHTML += "<td>&nbsp;</td>";
	}

	for (datePointer = 1; datePointer <= numDaysInMonth; datePointer++) {
		dayPointer++;
		sHTML += "<td align=right>";
		sStyle = styleAnchor;

		if ((datePointer == odateSelected) && (monthSelected == omonthSelected)
				&& (yearSelected == oyearSelected)) {
			sStyle += styleLightBorder;
		}
		sHint = "";

		for (k = 0; k < HolidaysCounter; k++) {
			if ((parseInt(Holidays[k].d) == datePointer)
					&& (parseInt(Holidays[k].m) == (monthSelected + 1))) {
				if ((parseInt(Holidays[k].y) == 0)
						|| ((parseInt(Holidays[k].y) == yearSelected) && (parseInt(Holidays[k].y) != 0))) {
					sStyle += "background-color:#FFDDDD;";
					sHint += sHint == "" ? Holidays[k].desc : "\n"
							+ Holidays[k].desc;
				}
			}
		}
		var regexp = /\"/g;
		sHint = sHint.replace(regexp, "&quot;");
		// ///////////// ³¯Â¥ ¼±ÅÃ½Ã ==> ¸¶¿ì½º°¡ ³¯Â¥ À§·Î °¬À»¶§
		// ///////////////////////////////
		dateMessage = "title=' ³¯Â¥ ¼±ÅÃ : " + yearSelected + "³â "
				+ monthName[monthSelected] + " " + datePointer + "ÀÏ"
				+ "' onmousemove='window.status=\" ³¯Â¥ ¼±ÅÃ : " + yearSelected
				+ "³â " + monthName[monthSelected] + " " + datePointer + "ÀÏ"
				+ "\"' onmouseout='window.status=\"\"' ";

		if ((datePointer == dateNow) && (monthSelected == monthNow)
				&& (yearSelected == yearNow)) { // ÇöÀç ¿À´Ã ³¯Â¥
			sHTML += "<b><div style='" + sStyle
					+ "' onclick='javascript:parent.dateSelected="
					+ datePointer
					+ ";parent.closeCalendar();'><font color=#EE7EAD> "
					+ datePointer + "</font> </div></b>";
		} else if (dayPointer % 7 == (startAt * -1) + 1) { // ÀÏ¿äÀÏ ÀÏ¶§
			sHTML += "<div style='" + sStyle
					+ "' onclick='javascript:parent.dateSelected="
					+ datePointer
					+ ";parent.closeCalendar();'> <font color=red>"
					+ datePointer + "</font> </div>";
		} else if (dayPointer % 7 == (startAt * -1)) { // Åä¿äÀÏ ÀÏ¶§
			sHTML += "<div style='" + sStyle
					+ "' onclick='javascript:parent.dateSelected="
					+ datePointer
					+ ";parent.closeCalendar();'> <font color=#2A00FF>"
					+ datePointer + "</font> </div>";
		} else {
			sHTML += "<div style='" + sStyle
					+ "' onclick='javascript:parent.dateSelected="
					+ datePointer + ";parent.closeCalendar();' onMouseover=\"this.className='day_on'\" onMouseout=\"this.className=''\">" + datePointer
					+ "</div>";
		}
		sHTML += "";

		if ((dayPointer + startAt) % 7 == startAt) {
			sHTML += "</tr><tr height=16>";
			intWeekCount++;
		}
	}
	sHTML += "</tr>";
	sHTML = sHTML.replace("<tr height=16></tr>", "");
	if (((dayPointer + startAt) % 7) == 0)
		intWeekCount--;
	oPopup.document.getElementById("content").innerHTML = sHTML;
	// ////// ¼¿¸¯Æ® ¿ù ¼±ÅÃ
	oPopup.document.getElementById("spanMonth").innerHTML = " "
			+ monthName[monthSelected]
			+ " <input type='button'  id='changeMonth'value='¡å'  class='cnj_input2' onfocus='this.blur()' onMouseover=\"this.className='cnj_input3'\" onMouseout=\"this.className='cnj_input2'\">"

	// ////// ¼¿¸¯Æ® ³âµµ ¼±ÅÃ
	oPopup.document.getElementById("spanYear").innerHTML = " "
			+ yearSelected
			+ "³â <input type='button'  id='changeYear'' value='¡å'  class='cnj_input2' onfocus='this.blur()' onMouseover=\"this.className='cnj_input3'\" onMouseout=\"this.className='cnj_input2'\">"

	// alert(intWeekCount);
	var popHeight;
	if (intWeekCount == 6)
		popHeight = 200;
	else
		popHeight = 182;
	oPopup.show(cleft, ctop, 202, popHeight, document.body);
}

function init() {
	if (!ns4) {
		if (!ie) {
			yearNow += 1900;
		}

		crossobj = oPopBody.all.calendar;
		crossMonthObj = oPopBody.all.selectMonth;
		crossYearObj = oPopBody.all.selectYear;
		monthConstructed = false;
		yearConstructed = false;

		if (showToday == 1) {
			oPopup.document.getElementById("lblToday").innerHTML = ""
					//+ "<a title='¿À´Ã ³¯Â¥·Î Ç¥½ÃÇÏ±â' href='javascript:monthSelected=monthNow;yearSelected=yearNow;constructCalendar();'>"
					+ "<div style='" + styleAnchor + "'>" + "¿À´Ã ³¯Â¥ :  "
					+ yearNow + "³â " + "" + monthName[monthNow].substring(0, 3)
					+ " " + "" + dateNow + "ÀÏ </div>";
		}

		sHTML1 = "<span class='cnj_input2' onClick='javascript:parent.movedecMonth()' title='ÀÌÀü ´Þ(¿ù)·Î ÀÌµ¿' "
		sHTML1 += "onMouseover=\"this.className='cnj_input3';window.status='ÀÌÀü ´Þ(¿ù)·Î ÀÌµ¿'\" onMouseout=\"this.className='cnj_input2';window.status=''\">¢¸</span> "

		sHTML1 += "<span class='cnj_input2' onClick='javascript:parent.moveincMonth()' title='´ÙÀ½ ´Þ(¿ù)·Î ÀÌµ¿' "
		sHTML1 += "onMouseover=\"this.className='cnj_input3';window.status='´ÙÀ½ ´Þ(¿ù)·Î ÀÌµ¿'\"  onMouseout=\"this.className='cnj_input2';window.status=''\">¢º</span> "

		sHTML1 += "<span id='spanMonth'  class='cnj_input4' onclick='parent.popUpMonth()' title='¿ù ¼±ÅÃ' "
		sHTML1 += "onMouseover=\"this.className='cnj_input3';window.status='¿ù ¼±ÅÃ'\" onMouseout=\"this.className='cnj_input4';window.status=''\"></span>&nbsp;";

		sHTML1 += "<span id='spanYear'  class='cnj_input4' onclick='parent.popUpYear()' title='³âµµ ¼±ÅÃ' "
		sHTML1 += "onMouseover=\"this.className='cnj_input3';window.status='³âµµ ¼±ÅÃ'\" onMouseout=\"this.className='cnj_input4';window.status=''\"></span> ";

		oPopup.document.getElementById("caption").innerHTML = sHTML1;
		bPageLoaded = true;
	}
}

init();

function cfPopCalendar(ctl, ctl2) {
	cfPopCalendarWithIdx(ctl.name, ctl2.name, 0);
}


function cfPopCalendarWithIdx(ctlnm, ctl2nm, idx) {
	var leftpos = 0;
	var toppos = 0;
	if (bPageLoaded) {
		
		if (null == idx) {
			objSelIdx= 0;
		} else {
			objSelIdx= idx;
		}
		ctlToPlaceValue = document.getElementsByName(ctl2nm)[objSelIdx];
		
		dateFormat = "yyyy.mm.dd";
		
		formatChar = " ";
		aFormat = dateFormat.split(formatChar);

		if (aFormat.length < 3) {
			formatChar = "/";
			aFormat = dateFormat.split(formatChar);

			if (aFormat.length < 3) {
				formatChar = ".";
				aFormat = dateFormat.split(formatChar);

				if (aFormat.length < 3) {
					formatChar = "-";
					aFormat = dateFormat.split(formatChar);

					if (aFormat.length < 3) {
						formatChar = "";
					}
				}
			}
		}
		tokensChanged = '0';

		if (formatChar != "") {
			aData = ctlToPlaceValue.value.split(formatChar);

			for (i = 0; i < 3; i++) {
				if ((aFormat[i] == "d") || (aFormat[i] == "dd")) {
					dateSelected = parseInt(aData[i], 10);
					tokensChanged++;
				} else if ((aFormat[i] == "m") || (aFormat[i] == "mm")) {
					monthSelected = parseInt(aData[i], 10) - 1;
					tokensChanged++;
				} else if (aFormat[i] == "yyyy") {
					yearSelected = parseInt(aData[i], 10);
					tokensChanged++;
				} else if (aFormat[i] == "mmm") {

					for (j = 0; j < 12; j++) {
						if (aData[i] == monthName[j]) {
							monthSelected = j;
							tokensChanged++;
						}
					}
				} else if (aFormat[i] == "mmmm") {
					for (j = 0; j < 12; j++) {
						if (aData[i] == monthName2[j]) {
							monthSelected = j;
							tokensChanged++;
						}
					}
				}
			}
		}

		if ((tokensChanged != 3) || isNaN(dateSelected) || isNaN(monthSelected)
				|| isNaN(yearSelected)) {
			dateSelected = dateNow;
			monthSelected = monthNow;
			yearSelected = yearNow;
		}
		odateSelected = dateSelected;
		omonthSelected = monthSelected;
		oyearSelected = yearSelected;
		
		aTag = document.getElementsByName(ctlnm)[objSelIdx];
		
		sclTop = 0;
		sclLeft= 0;
		cleft  =aTag.offsetLeft+ fixedX+1;
		ctop   =aTag.offsetTop+ aTag.offsetHeight + fixedY+2;
		
		do {
			aTag = aTag.offsetParent;
			sclTop = aTag.scrollTop;
			sclLeft = aTag.scrollLeft;
			cleft += aTag.offsetLeft;
			ctop += aTag.offsetTop;
		} while (aTag.tagName != "BODY");
		
		//½ºÅ©·Ñ ¿µ¿ª Æ÷Áö¼Ç Ãß°¡
		cleft -=sclLeft;
		ctop  -=sclTop;
		
		constructCalendar(1, monthSelected, yearSelected);

		bShow = true;
		//ctlNow = aTag;
	}
}