	function selectbox_hidden(layer_id) { 
		var ly = eval(layer_id); 

		// ·¹ÀÌ¾î ÁÂÇ¥ 
		var ly_left = ly.offsetLeft; 
		var ly_top = ly.offsetTop; 
		var ly_right = ly.offsetLeft + ly.offsetWidth; 
		var ly_bottom = ly.offsetTop + ly.offsetHeight; 

		// ¼¿·ºÆ®¹Ú½ºÀÇ ÁÂÇ¥ 
		var el; 

		for (i=0; i<document.forms.length; i++) { 
			for (k=0; k<document.forms[i].length; k++) { 
				el = document.forms[i].elements[k]; 
				if (el.type == "select-one") { 
					var el_left = el_top = 0; 
					var obj = el; 
					if (obj.offsetParent) { 
						while (obj.offsetParent) { 
							el_left += obj.offsetLeft; 
							el_top += obj.offsetTop; 
							obj = obj.offsetParent; 
						} 
					} 
					el_left += el.clientLeft; 
					el_top += el.clientTop; 
					el_right = el_left + el.clientWidth; 
					el_bottom = el_top + el.clientHeight; 

					if ((ly_right >= el_left && ly_left <= el_right) && (ly_bottom >= el_top && ly_top <= el_bottom)) 
					/*
					if ( (el_left >= ly_left && el_top >= ly_top && el_left <= ly_right && el_top <= ly_bottom) || 
					(el_right >= ly_left && el_right <= ly_right && el_top >= ly_top && el_top <= ly_bottom) || 
					(el_left >= ly_left && el_bottom >= ly_top && el_right <= ly_right && el_bottom <= ly_bottom) || 
					(el_left >= ly_left && el_left <= ly_right && el_bottom >= ly_top && el_bottom <= ly_bottom) ) 
					*/
					el.style.visibility = 'hidden'; 
				} 
			} 
		} 
	} 

	function selectbox_visible() 
	{ 
		for (i=0; i<document.forms.length; i++) { 
			for (k=0; k<document.forms[i].length; k++) { 
				el = document.forms[i].elements[k]; 
				if (el.type == "select-one" && el.style.visibility == 'hidden') 
				el.style.visibility = 'visible'; 
			} 
		} 
	} 


	cdivstr='\
	<div id="CalendarLayer" style="display:none;z-index:377" onpropertychange="selectbox_hidden(\'CalendarLayer\')"> \
	<form name="CalendarForm"> \
	<table border="0" cellspacing="0" cellpadding="0">\
		<tr>\
			<td rowspan="2" colspan="2">\
	<table border="0" cellspacing="5" cellpadding="0" bgcolor="#FFFFFF" style="border:1px solid #707070"> \
		<tr> \
			<td align="center"> \
			<table border=0 cellspacing=0 cellpadding=2>\
				<tr>\
					<td valign="middle"><span id="CalendarPrevYear"><img src="http://file.wisa.co.kr/_image/common/lt.gif" border="0"></span> <span id="CalendarPrevMonth"><img src="http://file.wisa.co.kr/_image/common/lt.gif" border="0"></span></td>\
					<td> \
					<div id="this_year"></div>\
					</td> \
					<td>³â</td> \
					<td> \
					<div id="this_month"></div>\
					</td> \
					<td>¿ù</td> \
					<td valign="middle"><span id="CalendarNextMonth"><img src="http://file.wisa.co.kr/_image/common/gt.gif" border="0"></span> <span id="CalendarNextYear"><img src="http://file.wisa.co.kr/_image/common/gt.gif" border="0"></span></td>\
				</tr>\
			</table>\
			</td>\
		</tr>\
		<tr>\
			<td align="center">\
			<table border="0" cellspacing="0" cellpadding="1" width="140"> \
			<tr class="cbar"> \
			<td width="20" class="sun1">ÀÏ</font></td> \
			<td width="20">¿ù</td> \
			<td width="20">È­</td> \
			<td width="20">¼ö</td> \
			<td width="20">¸ñ</td> \
			<td width="20">±Ý</td> \
			<td width="20" class="sat1">Åä</td> \
			</tr> \
			<tr align="center" height="18"> \
			<td width="20"><div id="CalendarDay_1_1" class="sun1"></div></td> \
			<td width="20"><div id="CalendarDay_1_2"></div></td> \
			<td width="20"><div id="CalendarDay_1_3"></div></td> \
			<td width="20"><div id="CalendarDay_1_4"></div></td> \
			<td width="20"><div id="CalendarDay_1_5"></div></td> \
			<td width="20"><div id="CalendarDay_1_6"></div></td> \
			<td width="20"><div id="CalendarDay_1_7" class="sat1"></div></td> \
			</tr> \
			<tr align="center" height="18"> \
			<td width="20"><div id="CalendarDay_2_1" class="sun1"></div></td> \
			<td width="20"><div id="CalendarDay_2_2"></div></td> \
			<td width="20"><div id="CalendarDay_2_3"></div></td> \
			<td width="20"><div id="CalendarDay_2_4"></div></td> \
			<td width="20"><div id="CalendarDay_2_5"></div></td> \
			<td width="20"><div id="CalendarDay_2_6"></div></td> \
			<td width="20"><div id="CalendarDay_2_7" class="sat1"></div></td> \
			</tr> \
			<tr align="center" height="18"> \
			<td width="20"><div id="CalendarDay_3_1" class="sun1"></div></td> \
			<td width="20"><div id="CalendarDay_3_2"></div></td> \
			<td width="20"><div id="CalendarDay_3_3"></div></td> \
			<td width="20"><div id="CalendarDay_3_4"></div></td> \
			<td width="20"><div id="CalendarDay_3_5"></div></td> \
			<td width="20"><div id="CalendarDay_3_6"></div></td> \
			<td width="20"><div id="CalendarDay_3_7" class="sat1"></div></td> \
			</tr> \
			<tr align="center" height="18"> \
			<td width="20"><div id="CalendarDay_4_1" class="sun1"></div></td> \
			<td width="20"><div id="CalendarDay_4_2"></div></td> \
			<td width="20"><div id="CalendarDay_4_3"></div></td> \
			<td width="20"><div id="CalendarDay_4_4"></div></td> \
			<td width="20"><div id="CalendarDay_4_5"></div></td> \
			<td width="20"><div id="CalendarDay_4_6"></div></td> \
			<td width="20"><div id="CalendarDay_4_7" class="sat1"></div></td> \
			</tr> \
			<tr align="center" height="18"> \
			<td width="20"><div id="CalendarDay_5_1" class="sun1"></div></td> \
			<td width="20"><div id="CalendarDay_5_2"></div></td> \
			<td width="20"><div id="CalendarDay_5_3"></div></td> \
			<td width="20"><div id="CalendarDay_5_4"></div></td> \
			<td width="20"><div id="CalendarDay_5_5"></div></td> \
			<td width="20"><div id="CalendarDay_5_6"></div></td> \
			<td width="20"><div id="CalendarDay_5_7" class="sat1"></div></td> \
			</tr> \
			<tr align="center" height="18"> \
			<td width="20"><div id="CalendarDay_6_1" class="sun1"></div></td> \
			<td width="20"><div id="CalendarDay_6_2"></div></td> \
			<td width="20"><div id="CalendarDay_6_3"></div></td> \
			<td width="20"><div id="CalendarDay_6_4"></div></td> \
			<td width="20"><div id="CalendarDay_6_5"></div></td> \
			<td width="20"><div id="CalendarDay_6_6"></div></td> \
			<td width="20"><div id="CalendarDay_6_7" class="sat1"></div></td> \
			</tr> \
			</table> \
			</td>\
		</tr>\
		<tr>\
			<td class="cbar">\
			¿À´Ã <div id="CalendarToday" style="display:inline"></div>&nbsp;| \
			<div id="CalendarClose" style="display:inline">´Ý±â</div> \
			</td>\
		</tr>\
	</table> \
			</td>\
			<td style="width:3px;height:3px"></td>\
		</tr>\
		<tr>\
			<td style="width:3px;height:209px;background-color:#C6C6C6"></td>\
		</tr>\
		<tr>\
			<td style="width:3px;height:3px"></td>\
			<td style="width:127px;height:3px;background-color:#C6C6C6"></td>\
			<td style="width:3px;height:3px;background-color:#C6C6C6"></td>\
		</tr>\
	</table> \
	</form> \
	</div>';

	document.write(cdivstr);


	Calendar = function (obj) {
		var IE = document.all ? true : false;

		this.avail = (document.getElementById) ? true : false;
		if (!this.avail) return;

		this._setDateSeperator = "-";   // ³¯Â¥ ±¸ºÐÀÚ

		this._setPrevColor = "#999999"; // ÀÌÀü´Þ ³¯Â¥ »ö
		this._setPrevBackground = "";   // ÀÌÀü´Þ ³¯Â¥ ¹è°æ»ö
		this._setNextColor = "#999999"; // ´ÙÀ½´Þ ³¯Â¥ »ö
		this._setNextBackground = "";   // ´ÙÀ½´Þ ³¯Â¥ ¹è°æ»ö
		this._setNowBold = false;        // ¼±ÅÃ ³¯Â¥ Bold¿©ºÎ
		this._setNowColor = "#FFFFFF";     // ¼±ÅÃ ³¯Â¥ »ö
		this._setNowBackground = "#FF00CC";    // ¼±ÅÃ ³¯Â¥ ¹è°æ»ö
		this._setTodayBold = true;      // ¿À´Ã ³¯Â¥ Bold¿©ºÎ
		this._setTodayColor = "#339900";    // ¿À´Ã ³¯Â¥ »ö
		this._setTodayBackground = "";  // ¿À´Ã ³¯Â¥ ¹è°æ»ö

		var classObj = this;
		this.obj = obj;
		this.layerObj = parent.document.getElementById("CalendarLayer");
		this.layerObj.style.position = 'absolute';
		this.layerObj.style.width = '172px';
		this.layerObj.style.height = '250px';

		this.calForm = document.forms["CalendarForm"];
	/*
		this.calForm.cal_year.onchange = function () {
			classObj.year = parseInt(this[this.selectedIndex].value, 10);
			classObj.setCalendar();
		}
		this.calForm.cal_month.onchange = function () {
			classObj.month = parseInt(this[this.selectedIndex].value, 10);
			classObj.setCalendar();
		}
	*/
		if (document.all) {
			document.getElementById("CalendarPrevMonth").style.cursor = "hand";
			document.getElementById("CalendarNextMonth").style.cursor = "hand";
			document.getElementById("CalendarPrevYear").style.cursor = "hand";
			document.getElementById("CalendarNextYear").style.cursor = "hand";
			document.getElementById("CalendarToday").style.cursor     = "hand";
			document.getElementById("CalendarClose").style.cursor     = "hand";
		} else {
			document.getElementById("CalendarPrevMonth").style.cursor = "pointer";
			document.getElementById("CalendarNextMonth").style.cursor = "pointer";
			document.getElementById("CalendarPrevYear").style.cursor = "pointer";
			document.getElementById("CalendarNextYear").style.cursor = "pointer";
			document.getElementById("CalendarToday").style.cursor     = "pointer";
			document.getElementById("CalendarClose").style.cursor     = "pointer";
		}
		document.getElementById("CalendarPrevMonth").onclick = function () {
			classObj.shiftMonth(-1);
		}
		document.getElementById("CalendarNextMonth").onclick = function () {
			classObj.shiftMonth(+1);
		}
		 document.getElementById("CalendarPrevYear").onclick = function () {
			classObj.shiftYear(-1);
		}
		document.getElementById("CalendarNextYear").onclick = function () {
			classObj.shiftYear(+1);
		}
		var d = new Date();
		document.getElementById("CalendarToday").innerHTML = "(" + this.getDateFormat(d.getFullYear(), d.getMonth(), d.getDate()) + ")";
		document.getElementById("CalendarToday").onclick = function () {
			var d = new Date();
			classObj.setDate(d.getFullYear(), d.getMonth(), d.getDate());
			classObj.destroy();
			selectbox_visible();
		}
		document.getElementById("CalendarClose").onclick = function () {
			classObj.destroy();
			selectbox_visible();
		}
		this.show();
	}

	Calendar.prototype.getDateFormat = function (year, month, day) {
		month++;
		if (month.toString().length == 1) month = "0" + month;
		if (day.toString().length == 1)   day = "0" + day;
		return year + this._setDateSeperator + month + this._setDateSeperator + day;
	}

	Calendar.prototype.shiftMonth = function (val) {
		this.month += val;
		d = new Date(this.year, this.month, this.day);
		this.year  = d.getFullYear();
		this.month = d.getMonth();
		this.day   = d.getDate();
		this.setCalendar();
	}

	Calendar.prototype.shiftYear = function (val) {
		this.year += val;
		d = new Date(this.year, this.month, this.day);
		this.year  = d.getFullYear();
		this.month = d.getMonth();
		this.day   = d.getDate();
		this.setCalendar();
	}

	Calendar.prototype.setDate = function (year, month, day) {
		this.obj.value = this.getDateFormat(year, month, day);
	}

	Calendar.prototype.setCalendar = function () {
		if (this.yearOld != this.year) this.setYear(this.calForm.cal_year);
		this.setMonth(this.calForm.cal_month);

		if (this.yearOld != this.year || this.monthOld != this.month) {
			this.drawCalendar(this.year, this.month, this.day);
		}

		this.yearOld = this.year;
		this.monthOld = this.month;
	}

	Calendar.prototype.drawCalendar = function (year, month, day) {
		var calDate     = new Date(year, month, 1);
		var calWeekday  = calDate.getDay();
		var calDays     = this.getMonthDays(year, month + 1);
		var calPrevDays = this.getMonthDays(year, month);
		var calDay      = 1;
		var calNextDay  = 1;

		for (var i=0; i<6; i++) {  // loop for month-weeks
			for (var j=0; j<7; j++) {  // loop for week-days
				var dayLayer = eval("document.getElementById('CalendarDay_"+ (i+1) +"_"+ (j+1) +"')");
				if (i==0 && j<calWeekday) {
					this.linkDay(dayLayer, year, month - 1, calPrevDays - (calWeekday - j) + 1, 'prev');
				} else if (calDay > calDays) {
					this.linkDay(dayLayer, year, month + 1, calNextDay, 'next');
					calNextDay++;
				} else {
					this.linkDay(dayLayer, year, month, calDay);
					calDay++;
				}
			}
		}
	}

	Calendar.prototype.linkDay = function (layer, year, month, day, monthTab) {
		var classObj = this;
		var d = new Date();
		layer.innerHTML = day;
		if (this.yearSet == year && this.monthSet == month && this.daySet == day) { // ¼±ÅÃ³¯Â¥ È¿°ú
			layer.style.fontWeight = (this._setNowBold == true) ? "bold" : "";
			layer.style.color      = (this._setNowColor) ? this._setNowColor : "";
			layer.style.background = (this._setNowBackground) ? this._setNowBackground : "";
		} else if (d.getFullYear() == year && d.getMonth() == month && d.getDate() == day) { // ¿À´Ã³¯Â¥ È¿°ú
			layer.style.fontWeight = (this._setTodayBold == true) ? "bold" : "";
			layer.style.color      = (this._setTodayColor) ? this._setTodayColor : "";
			layer.style.background = (this._setTodayBackground) ? this._setTodayBackground : "";
		} else if (monthTab == 'prev') {   // ÀÌÀü´Þ È¿°ú
			layer.style.fontWeight = "";
			layer.style.color      = (this._setPrevColor) ?  this._setPrevColor : "";;
			layer.style.background = (this._setPrevBackground) ? this._setPrevBackground : "";
		} else if (monthTab == 'next') { // ´ÙÀ½´Þ È¿°ú
			layer.style.fontWeight = "";
			layer.style.color      = (this._setNextColor) ? this._setNextColor: "";
			layer.style.background = (this._setNextBackground) ? this._setNextBackground : "";
		} else {
			layer.style.fontWeight = "";
			layer.style.color      = "";
			layer.style.background = "";
		}
		layer.style.cursor = (document.all) ? "hand" : "pointer";
		layer.onclick = function () {
			var d = new Date(year, month, day);
			classObj.setDate(d.getFullYear(), d.getMonth(), d.getDate());
			classObj.destroy();
			selectbox_visible();
		}
	}

	Calendar.prototype.setYear = function (yearObj) {
		document.getElementById('this_year').innerHTML=this.year;
	}

	Calendar.prototype.setMonth = function (monthObj) {
		document.getElementById('this_month').innerHTML=this.month+1;
	}


	Calendar.prototype.show = function () {
		var classObj = this;
		var objTmp = this.obj;
		var layerX = 0;
		var layerY = 0;
		while (objTmp) {
			layerX += objTmp.offsetLeft;
			layerY += objTmp.offsetTop;
			objTmp = objTmp.offsetParent;
		}
		this.layerObj.style.left = layerX;
		this.layerObj.style.top  = layerY + 20;
		this.layerObj.style.display = "block";

		var datePattern = /^([0-9]{4})[\-\.]?([01][0-9])[\-\.]?([0-3][0-9])$/;
		if (datePattern.test(this.obj.value)) {
			datePattern.exec(this.obj.value);
			var d = new Date(parseInt(RegExp.$1, 10), parseInt(RegExp.$2, 10) - 1, parseInt(RegExp.$3, 10));
		} else {
			var d = new Date();
		}
		this.year  = d.getFullYear();
		this.month = d.getMonth();
		this.day   = d.getDate();
		this.yearSet  = this.year;
		this.monthSet = this.month;
		this.daySet   = this.day;
		this.setCalendar();
	}

	Calendar.prototype.getMonthDays = function (year, month) {
		var d = new Date(year, month, 0);
		return d.getDate();
	}

	Calendar.prototype.destroy = function () {
		this.layerObj.style.display = "none";
		this.obj = null;
		this.yearOld = null;
		this.monthOld = null;
	}