/******************************************************** 
   ÆÄÀÏ¸í : lib.date.js
   ¼³  ¸í : ³¯Â¥¿Í ½Ã°£°ü·Ã °øÅë ÇÔ¼ö ¸ðÀ½
   ÀÛ¼ºÀÚ : ±èÇö¹è 
   ÀÛ¼ºÀÏ : 2008.08.18 
   ¼öÁ¤ÀÏ : 2008.08.18 
*********************************************************/ 

/**
	ÇÔ¼ö¸í : getYear
	¼³  ¸í : ¿À´Ã³¯Â¥ÀÇ ³âµµ¸¦ ¾ò´Â´Ù.
	ÀÎ  ÀÚ : 
	¸®  ÅÏ : ¿À´Ã³¯Â¥ÀÇ ³âµµ
	»ç¿ë¹ý : 
		var year = getYear();
 */
function getYear() {
	var date = new Date();
	return date.getFullYear();
}

/**
	ÇÔ¼ö¸í : getMonth
	¼³  ¸í : ¿À´Ã³¯Â¥ÀÇ ¿ùÀ» ¾ò´Â´Ù.
	ÀÎ  ÀÚ : isFormater : true, false
	¸®  ÅÏ : ¿À´Ã³¯Â¥ÀÇ ¿ù
	»ç¿ë¹ý : 
		var month = getMonth(true);	//9ÀÌÇÏ´Â ¾Õ¿¡ 0À» Ãß°¡ÇÏ¿© "09"ÇüÅÂÀÇ µÎÀÚ¸®·Î ¸®ÅÏ
		var month = getMonth(false);	//9ÀÌÇÏ´Â ÇÑÀÚ¸®·Î ¸®ÅÏ
 */
function getMonth(isFormater) {
	var date = new Date();
	var month = date.getMonth()+1;
	//µÎÀÚ¸® ÇüÅÂ·Î ¸®ÅÏ
	if(isFormater){
		if(parseInt(month, 10) < 10){
			month = "0" + month;
		}
	}
	return month;
}

/**
	ÇÔ¼ö¸í : getDate
	¼³  ¸í : ¿À´Ã³¯Â¥ÀÇ ÀÏÀ» ¾ò´Â´Ù.
	ÀÎ  ÀÚ : isFormater : true, false
	¸®  ÅÏ : ¿À´Ã³¯Â¥ÀÇ ÀÏ
	»ç¿ë¹ý : 
		var date = getDate(true);	//9ÀÌÇÏ´Â ¾Õ¿¡ 0À» Ãß°¡ÇÏ¿© "09"ÇüÅÂÀÇ µÎÀÚ¸®·Î ¸®ÅÏ
		var date = getDate(false);	//9ÀÌÇÏ´Â ÇÑÀÚ¸®·Î ¸®ÅÏ
 */
function getDate(isFormater) {
	var date = new Date();
	var nDate = date.getDate();
	//µÎÀÚ¸® ÇüÅÂ·Î ¸®ÅÏ
	if(isFormater){
		if(parseInt(nDate, 10) < 10){
			nDate = "0" + nDate;
		}
	}
	return nDate;
}

/**
	ÇÔ¼ö¸í : getHours
	¼³  ¸í : ÇöÀç ½Ã°£À» ¾ò´Â´Ù.
	ÀÎ  ÀÚ : isFormater : true, false
	¸®  ÅÏ : ÇöÀç½Ã°£
	»ç¿ë¹ý : 
		var Hours = getHours(true);	//9ÀÌÇÏ´Â ¾Õ¿¡ 0À» Ãß°¡ÇÏ¿© "09"ÇüÅÂÀÇ µÎÀÚ¸®·Î ¸®ÅÏ
		var Hours = getHours(false);//9ÀÌÇÏ´Â ÇÑÀÚ¸®·Î ¸®ÅÏ
 */
function getHours(isFormater) {
	var date = new Date();
	var nDate = date.getHours();
	//µÎÀÚ¸® ÇüÅÂ·Î ¸®ÅÏ
	if(isFormater){
		if(parseInt(nDate, 10) < 10){
			nDate = "0" + nDate;
		}
	}
	return nDate;
}

/**
	ÇÔ¼ö¸í : getMinutes
	¼³  ¸í : ÇöÀç ºÐÀ» ¾ò´Â´Ù.
	ÀÎ  ÀÚ : isFormater : true, false
	¸®  ÅÏ : ÇöÀçºÐ
	»ç¿ë¹ý : 
		var Minutes = getMinutes(true);	//9ÀÌÇÏ´Â ¾Õ¿¡ 0À» Ãß°¡ÇÏ¿© "09"ÇüÅÂÀÇ µÎÀÚ¸®·Î ¸®ÅÏ
		var Minutes = getMinutes(false);//9ÀÌÇÏ´Â ÇÑÀÚ¸®·Î ¸®ÅÏ
 */
function getMinutes(isFormater) {
	var date = new Date();
	var nDate = date.getMinutes();
	//µÎÀÚ¸® ÇüÅÂ·Î ¸®ÅÏ
	if(isFormater){
		if(parseInt(nDate, 10) < 10){
			nDate = "0" + nDate;
		}
	}
	return nDate;
}

/**
	ÇÔ¼ö¸í : getSeconds
	¼³  ¸í : ÇöÀç ÃÊÀ» ¾ò´Â´Ù.
	ÀÎ  ÀÚ : isFormater : true, false
	¸®  ÅÏ : ÇöÀçºÐ
	»ç¿ë¹ý : 
		var Minutes = getSeconds(true);	//9ÀÌÇÏ´Â ¾Õ¿¡ 0À» Ãß°¡ÇÏ¿© "09"ÇüÅÂÀÇ µÎÀÚ¸®·Î ¸®ÅÏ
		var Minutes = getSeconds(false);//9ÀÌÇÏ´Â ÇÑÀÚ¸®·Î ¸®ÅÏ
 */
function getSeconds(isFormater) {
	var date = new Date();
	var nDate = date.getSeconds();
	//µÎÀÚ¸® ÇüÅÂ·Î ¸®ÅÏ
	if(isFormater){
		if(parseInt(nDate, 10) < 10){
			nDate = "0" + nDate;
		}
	}
	return nDate;
}

/**
	ÇÔ¼ö¸í : getToday
	¼³  ¸í : ¿À´Ã³¯Â¥¸¦ YYYYMMDDÆ÷¸äÀ¸·Î ¸®ÅÏÇÑ´Ù.
	ÀÎ  ÀÚ : 
	¸®  ÅÏ : ¿À´Ã³¯Â¥
	»ç¿ë¹ý : 
		var today = getToday();
 */
function getToday() {
	return getYear() + "" + getMonth(true) + "" + getDate(true);
}

/**
	ÇÔ¼ö¸í : getTodayHours
	¼³  ¸í : ¿À´Ã³¯Â¥¸¦ YYYYMMDDHHmmÆ÷¸äÀ¸·Î ¸®ÅÏÇÑ´Ù.
	ÀÎ  ÀÚ : 
	¸®  ÅÏ : ¿À´Ã³¯Â¥
	»ç¿ë¹ý : 
		var today = getTodayHours();
 */
function getTodayHours() {
	return getYear() + "" + getMonth(true) + "" + getDate(true) + "" + getHours(true) + "" + getMinutes(true) + "" + getSeconds(true);
}


/**
	ÇÔ¼ö¸í : isValidDate
	¼³  ¸í : ³¯Â¥ÀÇ Æ÷¸äÀÌ ¿Ã¹Ù¸¥Áö È®ÀÎÇÑ´Ù.
	ÀÎ  ÀÚ : str1:year, str2:month, str3:day
	¸®  ÅÏ : ³¯Â¥ÀÇ À¯È¿¼º : true or false;
	»ç¿ë¹ý : 
		if(isValidDate("2008", "02", "31")){
			alert("³¯Â¥°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù");
		}

		È¤Àº

		if(isValidDate("20080231")){
			alert("³¯Â¥°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù");
		}

		È¤Àº

		if(isValidDate("2008-02-31")){
			alert("³¯Â¥°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù");
		}
 */
function isValidDate(str1, str2, str3)
{
	if(str2 == null && str3 == null){
		str1 = replaceAll(str1, "-", "");
		str2 = str1.substring(4, 6);
		str3 = str1.substring(6, 8);
		str1 = str1.substring(0, 4);
	}
	var year = parseInt(alltrim(str1), 10);
	var month = parseInt(alltrim(str2), 10) - 1;
	var day = parseInt(alltrim(str3), 10);


	if(!ValidYear(str1))
	{
		return false;
	}

	if(!ValidMonth(str2))
	{
		return false;
	}
	
	var endDay = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	
	if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
	{
		endDay[1] = 29;
	}

	if(!Number(str3) || !(day >= 1 && day <= endDay[month]))
	{
		return false;
	}

	return true;
}

/**
	ÇÔ¼ö¸í : isMoreToday
	¼³  ¸í : ÀÔ·ÂÇÑ °ªÀÌ ¿À´Ã³¯Â¥ °°°Å³ª  Å«Áö ¿©ºÎ ÆÇ´Ü.
	ÀÎ  ÀÚ : Ã¼Å©°¡ ÇÊ¿äÇÑ ÀÏÀÚ
	¸®  ÅÏ : ¿À´Ã³¯Â¥¿Í °°°Å³ª ´ÙÀ½³¯Â¥ÀÏ°æ¿ì true
	»ç¿ë¹ý : 
		isMoreToday("20080101");
 */
function isMoreToday(value){
	value = replaceAll(value, "-", "");
	value = replaceAll(value, ".", "");
	var date = new Date();

	var year = date.getFullYear(); 
	var month = date.getMonth() + 1;
	var day = date.getDate();
	if(parseInt(month, 10) < 10){
		month = "0" + month;
	}
	if(parseInt(day, 10) < 10){
		day = "0" + day;
	}
	if(parseInt(year + "" + month + "" + day, 10) <= parseInt(value, 10)){
		return true;
	}
	return false;
}

/**
	ÇÔ¼ö¸í : isDirectTime
	¼³  ¸í : ´ÙÀÌ·ºÆ® À¥»çÀÌÆ®ÀÇ ¿µ¾÷½Ã°£À» Ã¼Å©ÇÑ´Ù.
	ÀÎ  ÀÚ : 
	¸®  ÅÏ : ÇöÀç ½Ã°£ÀÌ ´ÙÀÌ·ºÆ® À¥»çÀÌÆ®ÀÇ ¿µ¾÷½Ã°£ÀÎÁö ¿©ºÎ
	»ç¿ë¹ý : 
		if(isDirectTime()){
			//´ÙÀÌ·ºÆ® ¿µ¾÷½Ã°£
		}
 */
function isDirectTime(){
	return true;
}

/**
	ÇÔ¼ö¸í : yearSelect
	¼³  ¸í : ³¯Â¥ ¼¿·ºÆ® ¹Ú½º¸¦ ¸¸µë(¿¬µµ)
	ÀÎ  ÀÚ : ¼¿·ºÆ®¹Ú½º ÀÌ¸§ : yy
	¸®  ÅÏ : 
	»ç¿ë¹ý : 
		yearSelect("birth_yy"); //¼¿·ºÆ® ¹Ú½º ÀÌ¸§À» ÀÎÀÚ·Î ÁÖ°í function¼±¾ð

		<div id="birth_yy"></div> //ÀÎÀÚ°ª°ú µ¿ÀÏÇÑ div³ª spanÀ» ¸¸µé¾î¾ßÇÔ
 */
function yearSelect(yy, value, width) {
	var now = new Date();
	var cur_year = now.getFullYear(); 
	var str = "<select name='"+yy+"' style='width:"+width+"'>";
    str += "<option value=''>¼±ÅÃ</option>";
	for (var i=cur_year ; i > cur_year-90; i--) {
		var selectStr = "";
		if(i == value){
			str += "<option value="+i+" "+selectStr+" selected>"+i+"</option>";
		}else{
			str += "<option value="+i+" "+selectStr+">"+i+"</option>";
		}
	}
	str +="</select>";
	document.getElementById(yy).innerHTML = str;	//ÀÎÀÚ°ª°ú °°Àº idÀÌ¸§ÀÇ div³ª span¿¡ 
													//innerHTMLÀ¸·Î ¸¸µé¾îÁø selectbox¸¦ ±×·ÁÁÜ
}

/**
	ÇÔ¼ö¸í : monthSelect
	¼³  ¸í : ³¯Â¥ ¼¿·ºÆ® ¹Ú½º¸¦ ¸¸µë(´Þ)
	ÀÎ  ÀÚ : ¼¿·ºÆ®¹Ú½º ÀÌ¸§ : mm
	¸®  ÅÏ : 
	»ç¿ë¹ý : 
		yearSelect("birth_mm"); //¼¿·ºÆ® ¹Ú½º ÀÌ¸§À» ÀÎÀÚ·Î ÁÖ°í function¼±¾ð

		<div id="birth_mm"></div> //ÀÎÀÚ°ª°ú µ¿ÀÏÇÑ div³ª spanÀ» ¸¸µé¾î¾ßÇÔ
 */
function monthSelect(mm , value, width) {
	var str = "<select name='"+mm+"' style='width:"+width+"'>";
	str += "<option value=''>¼±ÅÃ</option>";
	for (var i = 1 ; i < 13 ; i++) {
		if(parseInt(i, 10) < 10){
			i = "0" + i;
		}
		if(i == value){
			str += "<option value="+i+" selected>"+i+"</option>";
		}else{
			str += "<option value="+i+">"+i+"</option>";
		}
	}
	str +="</select>";
	document.getElementById(mm).innerHTML = str;	//ÀÎÀÚ°ª°ú °°Àº idÀÌ¸§ÀÇ div³ª span¿¡ 
													//innerHTMLÀ¸·Î ¸¸µé¾îÁø selectbox¸¦ ±×·ÁÁÜ
}

/**
	ÇÔ¼ö¸í : daySelect
	¼³  ¸í : ³¯Â¥ ¼¿·ºÆ® ¹Ú½º¸¦ ¸¸µë(ÀÏ)
	ÀÎ  ÀÚ : ¼¿·ºÆ®¹Ú½º ÀÌ¸§ : dd
	¸®  ÅÏ : 
	»ç¿ë¹ý : 
		yearSelect("birth_dd"); //¼¿·ºÆ® ¹Ú½º ÀÌ¸§À» ÀÎÀÚ·Î ÁÖ°í function¼±¾ð

		<div id="birth_dd"></div> //ÀÎÀÚ°ª°ú µ¿ÀÏÇÑ div³ª spanÀ» ¸¸µé¾î¾ßÇÔ
 */
function daySelect(dd , value, width) {
	var str = "<select name='"+dd+"' style='width:"+width+"'>";
	str += "<option value=''>¼±ÅÃ</option>";
	for (var i = 1 ; i < 32 ; i++) {
		var selectStr = "";
		if(parseInt(i, 10) < 10){
			i = "0" + i;
		}
		if(i == value){
			str += "<option value="+i+" "+selectStr+" selected>"+i+"</option>";
		}else{
			str += "<option value="+i+" "+selectStr+">"+i+"</option>";
		}
	}
	str +="</select>";
	document.getElementById(dd).innerHTML = str;	//ÀÎÀÚ°ª°ú °°Àº idÀÌ¸§ÀÇ div³ª span¿¡ 
													//innerHTMLÀ¸·Î ¸¸µé¾îÁø selectbox¸¦ ±×·ÁÁÜ
}

/**
	ÇÔ¼ö¸í : hourSelect
	¼³  ¸í : ½Ã°£ ¼¿·ºÆ® ¹Ú½º¸¦ ¸¸µë(ÀÏ)
	ÀÎ  ÀÚ : ¼¿·ºÆ®¹Ú½º ÀÌ¸§ : hh
	¸®  ÅÏ : 
	»ç¿ë¹ý : 
		hourSelect("send_hh"); //¼¿·ºÆ® ¹Ú½º ÀÌ¸§À» ÀÎÀÚ·Î ÁÖ°í function¼±¾ð

		<div id="send_hh"></div> //ÀÎÀÚ°ª°ú µ¿ÀÏÇÑ div³ª spanÀ» ¸¸µé¾î¾ßÇÔ
 */
function hourSelect(hh , value, width) {
	var str = "<select name='"+hh+"' style='width:"+width+"'>";
	str += "<option value=''>-½Ã-</option>";
	for (var i = 0 ; i < 24; i++) {
		var selectStr = "";
		if(parseInt(i, 10) < 10){
			i = "0" + i;
		}
		if(i == value){
			str += "<option value="+i+" "+selectStr+" selected>"+i+"</option>";
		}else{
			str += "<option value="+i+" "+selectStr+">"+i+"</option>";
		}
	}
	str +="</select>";
	document.getElementById(hh).innerHTML = str;	//ÀÎÀÚ°ª°ú °°Àº idÀÌ¸§ÀÇ div³ª span¿¡ 
													//innerHTMLÀ¸·Î ¸¸µé¾îÁø selectbox¸¦ ±×·ÁÁÜ
}

/**
	ÇÔ¼ö¸í : minSelect
	¼³  ¸í : ½Ã°£ ¼¿·ºÆ® ¹Ú½º¸¦ ¸¸µë(ÀÏ)
	ÀÎ  ÀÚ : ¼¿·ºÆ®¹Ú½º ÀÌ¸§ :  mm
	¸®  ÅÏ : 
	»ç¿ë¹ý : 
		minSelect("send_mm"); //¼¿·ºÆ® ¹Ú½º ÀÌ¸§À» ÀÎÀÚ·Î ÁÖ°í function¼±¾ð

		<div id="send_mm"></div> //ÀÎÀÚ°ª°ú µ¿ÀÏÇÑ div³ª spanÀ» ¸¸µé¾î¾ßÇÔ
 */
function minSelect(mm , value, width) {
	var str = "<select name='"+mm+"' style='width:"+width+"'>";
	str += "<option value=''>-ºÐ-</option>";
	for (var i = 0 ; i < 61 ; i++) {
		var selectStr = "";
		if(parseInt(i, 10) < 10){
			i = "0" + i;
		}
		if(i == value){
			str += "<option value="+i+" "+selectStr+" selected>"+i+"</option>";
		}else{
			str += "<option value="+i+" "+selectStr+">"+i+"</option>";
		}
	}
	str +="</select>";
	document.getElementById(mm).innerHTML = str;	//ÀÎÀÚ°ª°ú °°Àº idÀÌ¸§ÀÇ div³ª span¿¡ 
													//innerHTMLÀ¸·Î ¸¸µé¾îÁø selectbox¸¦ ±×·ÁÁÜ
}

/**
	ÇÔ¼ö¸í : endDays
	¼³  ¸í : ÇØ´ç ³â, ¿ù, ÀÏÀÇ ¸¶Áö¸· ÀÏÀÚ°ª °¡Á®¿À±â
	ÀÎ  ÀÚ : ³â,¿ù,ÀÏ
	¸®  ÅÏ : ÇØ´ç ³â, ¿ù, ÀÏÀÇ ¸¶Áö¸· ÀÏÀÚ°ª
	»ç¿ë¹ý : 
		endDays(y, m, d);
 */
function endDays(y, m, d) {
    var MonthTable = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); // ¾ç·Â °¢´ÞÀÇ ÀÏ¼ö¸¦ ÀúÀåÇÑ ¹è¿­
    var endday = "";
    
    if (((Number(y) % 4 == 0) && (Number(y) % 100 != 0)) || (Number(y) % 400 == 0)) MonthTable[1] = 29;
    else MonthTable[1] = 28;
    endday = endday + y ;
    if ( m.length == 1 ) endday = endday + "0" + parseInt(m) ;
    else endday = endday + "" + m ;
    endday = endday + "" + MonthTable[Number(m)-1] ;
    return endday ;
}


//³¯Â¥ À¯È¿¼º °Ë»ç
function compDateChk(start_date_ctl, end_date_ctl, msg){
	var start_time = parseInt(replaceAll(start_date_ctl.value, ".", ""));
	var end_time = parseInt(replaceAll(end_date_ctl.value, ".", ""));
	var dur = start_time - end_time;
	if(dur > 0){	
		alert(msg+" Á¾·áÀÏÀÚ°¡ "+msg+" ½ÃÀÛÀÏÀÚº¸´Ù ÀÌÀüÀÔ´Ï´Ù.");
		end_date_ctl.value = "";
		end_date_ctl.focus();
		return true;
	}
	return false;
}


//¿À´Ã º¸´Ù ³¯Â¥°¡ ÀÛÀºÁö ¿©ºÎÃ¼Å©
function isLessToday(ctl){
	if(ctl == null){
		alert("ctl°ªÀÌ ¾ø½À´Ï´Ù");
		return true;
	}
	var compareValue = ctl.value;
	compareValue = replaceAll(compareValue, ".", "");
	compareValue = replaceAll(compareValue, "-", "");
	compareValue = replaceAll(compareValue, "/", "");

	if(parseInt(getToday(), 10) > parseInt(compareValue, 10)){
		return true;
	}
	return false;
}

var divIndex = 0;
var objectMap = new Object;
function moveYear(duration, targetId){
	document.getElementById("cal_year_" + targetId).innerHTML = parseInt(document.getElementById("cal_year_" + targetId).innerHTML, 10) + duration;
}

function setCalMonth(month, targetId, controlId){
	var tempMonth = month;
	var returnValue = "";
	if(tempMonth < 10){
		returnValue = document.getElementById("cal_year_" + targetId).innerHTML + ".0" + month; 
	} else {
		returnValue = document.getElementById("cal_year_" + targetId).innerHTML + "." + month;
	}
	objectMap[targetId].value = returnValue;
	global_targetId = targetId;
	setTimeout("timerClose()", 50);
	//closeMonthCal(targetId);
}
var global_targetId;
function timerClose(){
	closeMonthCal(global_targetId);
}

function closeMonthCal(targetId){
	document.getElementById("month_div_" + targetId).style.display = "none";
	document.getElementById("month_div_" + targetId).style.visibility = "hidden";
}

function clearMonth(targetId){
	objectMap[targetId].value = "";
	closeMonthCal(targetId);
}

function createMonthCal(targetCtl, openerCtl){
	for(var i = 0;i < divIndex; i++){
		if(document.getElementById("month_div_" + i) != null) {
			document.getElementById("month_div_" + i).style.display = "none";
			document.getElementById("month_div_" + i).style.visibility = "hidden";
		}
	}
	objectMap[divIndex] = openerCtl;
	var inStr = "";
	inStr = inStr + ("<table width=\"140\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\r\n");
	inStr = inStr + ("  <tr>\r\n");
	inStr = inStr + ("    <td bgcolor=\"b7b6b6\"><table width=\"140\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">\r\n");
	inStr = inStr + ("        <tr align=\"center\"> \r\n");
	inStr = inStr + ("          <td height=\"18\" bgcolor=\"f0f0f0\" colspan=\"3\"><a href=\"javascript:moveYear(-1, " + divIndex + ")\"><<</a>\r\n");
	inStr = inStr + ("            &nbsp;&nbsp;<span id=\"cal_year_" + divIndex + "\" name=\"cal_year" + divIndex + "\">2009</span>³â&nbsp;&nbsp;\r\n");
	inStr = inStr + ("            <a href=\"javascript:moveYear(1, " + divIndex + ")\">>></a>\r\n");
	inStr = inStr + ("			</td>\r\n");
	inStr = inStr + ("        </tr>\r\n");
	inStr = inStr + ("        <tr align=\"center\" valign=\"middle\" bgcolor=\"ffffff\"> \r\n");
	inStr = inStr + ("          <td height=\"18\" style=\"cursor:hand\" onClick=\"setCalMonth(1, " + divIndex + ", '" + targetCtl.id + "')\"><a href=\"javascript:setCalMonth(1, " + divIndex + ", '" + targetCtl.id + "')\">1¿ù</a></td>\r\n");
	inStr = inStr + ("          <td height=\"18\" style=\"cursor:hand\" onClick=\"setCalMonth(2, " + divIndex + ", '" + targetCtl.id + "')\"><a href=\"javascript:setCalMonth(2, " + divIndex + ", '" + targetCtl.id + "')\">2¿ù</a></td>\r\n");
	inStr = inStr + ("          <td height=\"18\" style=\"cursor:hand\" onClick=\"setCalMonth(3, " + divIndex + ", '" + targetCtl.id + "')\"><a href=\"javascript:setCalMonth(3, " + divIndex + ", '" + targetCtl.id + "')\">3¿ù</a></td>\r\n");
	inStr = inStr + ("        </tr>\r\n");
	inStr = inStr + ("        <tr align=\"center\" valign=\"middle\" bgcolor=\"ffffff\"> \r\n");
	inStr = inStr + ("          <td height=\"18\" style=\"cursor:hand\" onClick=\"setCalMonth(4, " + divIndex + ", '" + targetCtl.id + "')\"><a href=\"javascript:setCalMonth(4, " + divIndex + ", '" + targetCtl.id + "')\">4¿ù</a></td>\r\n");
	inStr = inStr + ("          <td height=\"18\" style=\"cursor:hand\" onClick=\"setCalMonth(5, " + divIndex + ", '" + targetCtl.id + "')\"><a href=\"javascript:setCalMonth(5, " + divIndex + ", '" + targetCtl.id + "')\">5¿ù</a></td>\r\n");
	inStr = inStr + ("          <td height=\"18\" style=\"cursor:hand\" onClick=\"setCalMonth(6, " + divIndex + ", '" + targetCtl.id + "')\"><a href=\"javascript:setCalMonth(6, " + divIndex + ", '" + targetCtl.id + "')\">6¿ù</a></td>\r\n");
	inStr = inStr + ("        </tr>\r\n");
	inStr = inStr + ("        <tr align=\"center\" valign=\"middle\" bgcolor=\"ffffff\"> \r\n");
	inStr = inStr + ("          <td height=\"18\" style=\"cursor:hand\" onClick=\"setCalMonth(7, " + divIndex + ", '" + targetCtl.id + "')\"><a href=\"javascript:setCalMonth(7, " + divIndex + ", '" + targetCtl.id + "')\">7¿ù</a></td>\r\n");
	inStr = inStr + ("          <td height=\"18\" style=\"cursor:hand\" onClick=\"setCalMonth(8, " + divIndex + ", '" + targetCtl.id + "')\"><a href=\"javascript:setCalMonth(8, " + divIndex + ", '" + targetCtl.id + "')\">8¿ù</a></td>\r\n");
	inStr = inStr + ("          <td height=\"18\" style=\"cursor:hand\" onClick=\"setCalMonth(9, " + divIndex + ", '" + targetCtl.id + "')\"><a href=\"javascript:setCalMonth(9, " + divIndex + ", '" + targetCtl.id + "')\">9¿ù</a></td>\r\n");
	inStr = inStr + ("        </tr>\r\n");
	inStr = inStr + ("        <tr align=\"center\" valign=\"middle\" bgcolor=\"ffffff\"> \r\n");
	inStr = inStr + ("          <td height=\"18\" style=\"cursor:hand\" onClick=\"setCalMonth(10, " + divIndex + ", '" + targetCtl.id + "')\"><a href=\"javascript:setCalMonth(10, " + divIndex + ", '" + targetCtl.id + "')\">10¿ù</a></td>\r\n");
	inStr = inStr + ("          <td height=\"18\" style=\"cursor:hand\" onClick=\"setCalMonth(11, " + divIndex + ", '" + targetCtl.id + "')\"><a href=\"javascript:setCalMonth(11, " + divIndex + ", '" + targetCtl.id + "')\">11¿ù</a></td>\r\n");
	inStr = inStr + ("          <td height=\"18\" style=\"cursor:hand\" onClick=\"setCalMonth(12, " + divIndex + ", '" + targetCtl.id + "')\"><a href=\"javascript:setCalMonth(12, " + divIndex + ", '" + targetCtl.id + "')\">12¿ù</a></td>\r\n");
	inStr = inStr + ("        </tr>\r\n");
	inStr = inStr + ("        <tr align=\"center\"> \r\n");
	inStr = inStr + ("          <td height=\"18\" bgcolor=\"f0f0f0\" colspan=\"3\" style=\"cursor:hand\"onClick=\"clearMonth(" + divIndex + ")\">³¯Â¥Áö¿ì±â\r\n");
	inStr = inStr + ("            <input name=\"button2\" type='button' style='font-size:8pt;color:#808080; background-color:#EFEFEF; border-width:1; border-color:#808080; border-style:solid;cursor:hand;height:18px;' title='´Ý±â' onfocus='this.blur()' onClick='javascript:closeMonthCal(" + divIndex + ")' onMouseover=\"this.className='cnj_input3';window.status='´Ý±â'\" onMouseout=\"this.className='cnj_input2';window.status=''\" value='X'>\r\n");
	inStr = inStr + ("			</td>\r\n");
	inStr = inStr + ("        </tr>		\r\n");
	inStr = inStr + ("      </table></td>\r\n");
	inStr = inStr + ("  </tr>\r\n");
	inStr = inStr + ("</table>\r\n");
	var div = document.createElement('DIV');
	div.id = "month_div_" + divIndex++;
	div.innerHTML = inStr;
	div.style.zIndex = 100000;
	document.body.appendChild(div);
	div.style.position = 'absolute';
	div.style.visibility = 'visible';
	div.style.top = event.y + document.body.scrollTop;
	div.style.left = event.x + document.body.scrollLeft;
}

/**
 * ÀÌÁ¤È¯ Ãß°¡ 2010-02-23
ÇÔ¼ö¸í : yearSelectStart
¼³  ¸í : ³¯Â¥ ¼¿·ºÆ® ¹Ú½º¸¦ ¸¸µë(¿¬µµ)
ÀÎ  ÀÚ : ¼¿·ºÆ®¹Ú½º ÀÌ¸§ : yy
¸®  ÅÏ : 
»ç¿ë¹ý : 
	yearSelect("birth_yy"); //¼¿·ºÆ® ¹Ú½º ÀÌ¸§À» ÀÎÀÚ·Î ÁÖ°í function¼±¾ð

	<div id="birth_yy"></div> //ÀÎÀÚ°ª°ú µ¿ÀÏÇÑ div³ª spanÀ» ¸¸µé¾î¾ßÇÔ
*/
function yearSelectStart(yy, value, width, startYear) {
var now = new Date();
var cur_year = now.getFullYear(); 
var str = "<select name='"+yy+"' style='width:"+width+"'>";
str += "<option value=''>¼±ÅÃ</option>";
for (var i=cur_year ; i >= startYear; i--) {
	if(i == value){
		str += "<option value="+i+" selected>"+i+"</option>";
	}else{
		str += "<option value="+i+">"+i+"</option>";
	}
}
str +="</select>";
document.getElementById(yy).innerHTML = str;	//ÀÎÀÚ°ª°ú °°Àº idÀÌ¸§ÀÇ div³ª span¿¡ 
												//innerHTMLÀ¸·Î ¸¸µé¾îÁø selectbox¸¦ ±×·ÁÁÜ
}


//±â°£¼³Á¤ - ´çÀÏ, 2ÁÖÀÏ, ÇÑ´Þ, 3°³¿ù, 6°³¿ù, 1³â. ±â°£ÇØÁ¦
function setDate(ctl1, ctl2, type) {
	var year = getYear();
	var month = getMonth(true);
	var day = getDate(true);
	
	if(type == 1) { // ´çÀÏ
		ctl1.value = year+"."+month+"."+day;
		ctl2.value = year+"."+month+"."+day;
	} else if (type == "2") {    // ÀÌÁÖÀÏ
		ctl2.value = year+"."+month+"."+day;
		var objDate = new Date(Date.parse(new Date()) - 14 * 1000 * 60 * 60 * 24);
		year = objDate.getFullYear();
		month = addZero(objDate.getMonth()+1);
		day = addZero(objDate.getDate());

		ctl1.value = year + "." + month + "." + day;	
	} else if(type == "3") { //ÇÑ´Þ
		ctl2.value = year+"."+month+"."+day;
		month = getMonth(false);
		month = parseInt(month);
		month = month - 1;
		if(month <= 0) { 
			year = year - 1;
			month = 12 + month; 
		}
		if(month < 10) { month = "0" + month; }
		ctl1.value = year+"."+month+"."+day;
	} else if(type == "4") { //3°³¿ù
		ctl2.value = year+"."+month+"."+day;
		month = getMonth(false);
		month = parseInt(month);
		month = month - 3;
		if(month <= 0) { 
			year = year - 1;
			month = 12 + month; 
		}
		if(month < 10) { month = "0" + month; }
		ctl1.value = year+"."+month+"."+day;
	} 
	else if(type == "5") { //6°³¿ù
		ctl2.value = year+"."+month+"."+day;
		month = getMonth(false);
		month = parseInt(month);
		month = month - 6;
		if(month <= 0) { 
			year = year - 1;
			month = 12 + month; 
		}
		if(month < 10) { month = "0" + month; }
		ctl1.value = year+"."+month+"."+day;
	} else if(type == "6") { //1³â
		ctl2.value = year+"."+month+"."+day;
		year = year - 1;
		ctl1.value = year+"."+month+"."+day;
	} else {	// ±â°£ÇØÁ¦
		ctl1.value = "";
		ctl2.value = "";
	}
}

//³¯Â¥¿¡ '0' ºÙÀÌ±â   ¿¹) 5¿ù 3ÀÏ --> 05¿ù 03ÀÏ
function addZero(date) {
	if(parseInt(date, 10) < 10){
		date = "0" + date;
	}
	return date;
}

