/****************************************************************************************************************************************/
/* File Name             : calendar_for_reservation.js                                                                                  */
/* Title                 : Reservation Calendar                                                                                         */
/* Creater               : Platform Development 4 Team By Dong Su Kim                                                                   */
/* Creation Date         : 2009-08-05                                                                                                   */
/* Subscript             : International Air And Domestic Air Calendar, RTS Hotel Calendar, International And Domestic Lodging Claendar */
/* Alteration Date       :                                                                                                              */
/* Modifier              :                                                                                                              */
/* Alteration Subscript  :                                                                                                              */
/****************************************************************************************************************************************/

var bLoadCalendar = false;
var sCalendarTemplate = "";

// ±¹Á¦¼±, ±¹³»¼±, È£ÅÚ, ÇØ¿Ü¼÷¹Ú, ±¹³»¼÷¹Ú
var bIntAirFirstCal = false, bDomAirFirstCal = false, bHotelFirstCal = false, bIntLodgingFirstCal = false, bDomLodgingFirstCal = false;
var sIntAirStartDate = "", sDomAirStartDate = "", sHotelStartDate = "", sIntLodgingStartDate = "", sDomLodgingStartDate = "";

var sReservationDelimiter = "";
var nDelimiterLength = sReservationDelimiter.length;
var sSelectedMonth = "";

var sChoiceBgColor = "#ADFF2F";
var sSundayBgColor = "#F8E9D4";
var sSaturdayBgColor = "#CAE6EC";
var sNormaldayBgColor = "#FFFFFF";
var sConfirmPriceYBgColor = "#C5DBFC";
var sConfirmPriceNBgColor = "#FEC5BA";

var sChoiceFontColor = "#444444";
var sSundayFontColor = "#C03D23";
var sSaturdayFontColor = "#1889A5";
var sNormaldayFontColor = "#444444";
var sConfirmPriceYFontColor = "#0156C2";
var sConfirmPriceNFontColor = "#F71808";


// ÀÔ·Â¹ÞÀº Ãâ¹ßÀÏ ¸®½ºÆ®¸¦ ÆÄ½ÌÇÏ¿© ¹è¿­¿¡ ´ã¾ÆµÎ±â À§ÇØ...
var nTgdinvNoCnts = 0;
var sBkngGrpNoArr = new Array();
var sTgdinvNoArr = new Array();
var sTgdinvDateArr = new Array();
var sTgdinvRemainAmtArr = new Array();
var sTgdinvFixPriceYNArr = new Array();

// °¡°ÝÁ¤º¸¸¦ ¹è¿­¿¡ ´ã¾ÆµÎ±â À§ÇØ...
var nPinvSeqnoCnt = 0;
var sPinvTgdinvNoArr = new Array();
var sPinvSeqnoArr = new Array();
var sPinvSelNameArr = new Array();
var sPinvSelValueArr = new Array();
var sPinvPriceArr = new Array();

// ±×·ìÁ¤º¸¸¦ ¹è¿­¿¡ ´ã¾ÆµÎ±â À§ÇØ...
var nTotalBkngGrpCnts = 0;
var sTotalBkngGrpNoArr = new Array();
var sTotalBkngGrpNmArr = new Array();
var sTotalGrpStDtArr = new Array();
var sTotalGrpEdDtArr = new Array();
var sTotalGrpPriceArr = new Array();
var sGrpMonthDateArr = new Array();

function memorialDay(name, month, day, solarLunar, holiday, type)
{
	this.name = name;
	this.month = month;
	this.day = day;
	this.solarLunar = solarLunar;
	this.holiday = holiday;	/* true : »¡°£³¯ false : ¾È»¡°£³¯ */
	this.type = type;	/* true : real time setting */
	this.techneer = true;
}

var memorialDays = Array (
new memorialDay("½ÅÁ¤", 1, 1, 1, true),
new memorialDay("", 12, 0, 2, true, true),	/* ½Ç½Ã°£À¸·Î Á¤ÇØÁü */
new memorialDay("¼³³¯", 1, 1, 2, true),
new memorialDay("", 1, 2, 2, true),
new memorialDay("»ïÀÏÀý", 3, 1, 1, true),
new memorialDay("¼®°¡Åº½ÅÀÏ", 4, 8, 2, true),
new memorialDay("¾î¸°ÀÌ³¯", 5, 5, 1, true),
new memorialDay("ÇöÃæÀÏ", 6, 6, 1, true),
new memorialDay("±¤º¹Àý", 8, 15, 1, true),
new memorialDay("", 8, 14, 2, true),
new memorialDay("Ãß¼®", 8, 15, 2, true),
new memorialDay("", 8, 16, 2, true),
new memorialDay("°³ÃµÀý", 10, 3, 1, true),
new memorialDay("¼ºÅºÀý", 12, 25, 1, true),

new memorialDay("Á¤¿ù´ëº¸¸§", 1, 15, 2, false),
new memorialDay("½Ä¸ñÀÏ", 4, 5, 1, false),
new memorialDay("´Ü¿À", 5, 5, 2, false),
new memorialDay("±¹±ºÀÇ³¯", 10, 1, 1, false),
new memorialDay("ÇÑ±Û³¯", 10, 9, 1, false),
new memorialDay("625ÀüÀïÀÏ", 6, 25, 1, false),
new memorialDay("»ïÁù³¯", 3, 3, 2, false),
new memorialDay("¹°ÀÇ³¯", 3, 22, 1, false),
new memorialDay("¸¸¿ìÀý", 4, 1, 1, false),
new memorialDay("Àå¾ÖÀÎÀÇ³¯", 4, 20, 1, false),
new memorialDay("°úÇÐÀÇ³¯", 4, 21, 1 , false),
new memorialDay("Ãæ¹«°øÅº½ÅÀÏ", 4, 28, 1, false),
new memorialDay("±Ù·ÎÀÚÀÇ³¯¡¤¹ýÀÇ³¯", 5, 1, 1, false),
new memorialDay("¾î¹öÀÌ³¯", 5, 8, 1, false),
new memorialDay("½º½ÂÀÇ³¯", 5, 15, 1, false),
new memorialDay("¹ß¸íÀÇ³¯", 5, 19, 1, false),
new memorialDay("¹Ù´ÙÀÇ³¯", 5, 31, 1, false),
new memorialDay("È¯°æÀÇ³¯", 6, 5, 1, false),
new memorialDay("À¯µÎ", 6, 15, 2, false),
new memorialDay("Ä¥¿ùÄ¥¼®", 7, 7, 2, false),
new memorialDay("Á¦ÇåÀý", 7, 17, 1, false),
new memorialDay("Áß¾çÀý", 9, 9, 2, false),
new memorialDay("Ã¶µµÀÇ³¯", 9, 18, 1, false),
new memorialDay("¼Ò¹æÀÇ³¯", 11, 9, 1, false));

// À½·Â µ¥ÀÌÅÍ (Æò´Þ - ÀÛÀº´Þ :1,  Å«´Þ:2 )
// (À±´ÞÀÌ ÀÖ´Â ´Þ - Æò´ÞÀÌ ÀÛ°í À±´Þµµ ÀÛÀ¸¸é :3 , Æò´ÞÀÌ ÀÛ°í À±´ÞÀÌ Å©¸é : 4)
// (À±´ÞÀÌ ÀÖ´Â ´Þ - Æò´ÞÀÌ Å©°í À±´ÞÀÌ ÀÛÀ¸¸é :5,  Æò´Þ°ú À±´ÞÀÌ ¸ðµÎ Å©¸é : 6)
var lunarMonthTable = [
[2, 1, 2, 1, 2, 1, 2, 2, 1,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 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2],
[2, 2, 1, 2, 1, 4, 1, 1, 2, 2, 1, 2],
[2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2],
[2, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1],
[2, 2, 1, 2, 5, 2, 1, 2, 1, 2, 1, 1],
[2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1],
[2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2],   /* 2041 */
[1, 5, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2],
[1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2]];

// ³¯Â¥ °´Ã¼ Ãß°¡ 2009-07-17 By Dskim
Number.prototype.to2 = function() { return (this > 9 ? "" : "0")+this; };
Date.ENGMONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
Date.HANMONTHS = ["01¿ù", "02¿ù", "03¿ù", "04¿ù", "05¿ù", "06¿ù", "07¿ù", "08¿ù", "09¿ù", "10¿ù", "11¿ù", "12¿ù"];
Date.ENGDAYS   = ["Sun", "Mon", "Tue", "Wed", "Tur", "Fri", "Sat"];
Date.HANDAYS   = ["ÀÏ", "¿ù", "È­", "¼ö", "¸ñ", "±Ý", "Åä"];
Date.prototype.getDateString = function(dateFormat) {
  var result = "";

  dateFormat = dateFormat == 8 && "YYYY.MM.DD" ||
               dateFormat == 6 && "hh:mm:ss" ||
               dateFormat ||
               "YYYY.MM.DD hh:mm:ss";
  for (var i = 0; i < dateFormat.length; i++) {
    result += dateFormat.indexOf("YYYY", i) == i ? (i+=3, this.getFullYear()                     ) :
              dateFormat.indexOf("YY",   i) == i ? (i+=1, String(this.getFullYear()).substring(2)) :
              dateFormat.indexOf("EMM",  i) == i ? (i+=2, Date.ENGMONTHS[this.getMonth()]        ) :
              dateFormat.indexOf("HMM",  i) == i ? (i+=2, Date.HANMONTHS[this.getMonth()]        ) :
              dateFormat.indexOf("MM",   i) == i ? (i+=1, (this.getMonth()+1).to2()              ) :
              dateFormat.indexOf("M",    i) == i ? (      this.getMonth()+1                      ) :
              dateFormat.indexOf("EDD",  i) == i ? (i+=2, Date.ENGDAYS[this.getDay()]            ) :
              dateFormat.indexOf("HDD",  i) == i ? (i+=2, Date.HANDAYS[this.getDay()]            ) :
              dateFormat.indexOf("DD",   i) == i ? (i+=1, this.getDate().to2()                   ) :
              dateFormat.indexOf("D"   , i) == i ? (      this.getDate()                         ) :
              dateFormat.indexOf("hh",   i) == i ? (i+=1, this.getHours().to2()                  ) :
              dateFormat.indexOf("h",    i) == i ? (      this.getHours()                        ) :
              dateFormat.indexOf("mm",   i) == i ? (i+=1, this.getMinutes().to2()                ) :
              dateFormat.indexOf("m",    i) == i ? (      this.getMinutes()                      ) :
              dateFormat.indexOf("ss",   i) == i ? (i+=1, this.getSeconds().to2()                ) :
              dateFormat.indexOf("s",    i) == i ? (      this.getSeconds()                      ) :
                                                   (dateFormat.charAt(i)                         ) ;
  }
  return result;
};

/*
now.getDateString();
now.getDateString(8);
now.getDateString(6);
now.getDateString("YYYY³â MM¿ù DDÀÏ");
now.getDateString("YYYY/MM/DD hh:mm:ss");
now.getDateString("MMM D, YYYY");
*/


function memorialDayCheck(solarDate, lunarDate)
{
	var i;
	var memorial;

	for (i = 0; i < memorialDays.length; i++)
	{
		if (memorialDays[i].month == solarDate.month &&
			memorialDays[i].day == solarDate.day &&
			memorialDays[i].solarLunar == 1)
		{
			return memorialDays[i];
		}

		if (memorialDays[i].month == lunarDate.month &&
			memorialDays[i].day == lunarDate.day &&
			memorialDays[i].solarLunar == 2 &&
			!memorialDays[i].leapMonth)
		{
			return memorialDays[i];
		}
	}

	return null;
}



/* ¾ç·Â <-> À½·Â º¯È¯ ÇÔ¼ö
 * type : 1 - ¾ç·Â -> À½·Â
 *        2 - À½·Â -> ¾ç·Â
 * leapmonth : 0 - Æò´Þ
 *             1 - À±´Þ (type = 2 ÀÏ¶§¸¸ À¯È¿)
*/ 
function lunarCalc(year, month, day, type, leapmonth)
{
	var solYear, solMonth, solDay;
	var lunYear, lunMonth, lunDay;
	var lunLeapMonth, lunMonthDay;
	var i, lunIndex;

	var solMonthDay = [31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

	/* range check */
	if (year < 1900 || year > 2040)
	{
		alert('1900³âºÎÅÍ 2040³â±îÁö¸¸ Áö¿øÇÕ´Ï´Ù');
		return;
	}

	/* ¼Óµµ °³¼±À» À§ÇØ ±âÁØ ÀÏÀÚ¸¦ ¿©·¯°³·Î ÇÑ´Ù */
	if (year >= 2000)
	{
		/* ±âÁØÀÏÀÚ ¾ç·Â 2000³â 1¿ù 1ÀÏ (À½·Â 1999³â 11¿ù 25ÀÏ) */
		solYear = 2000;
		solMonth = 1;
		solDay = 1;
		lunYear = 1999;
		lunMonth = 11;
		lunDay = 25;
		lunLeapMonth = 0;

		solMonthDay[1] = 29;	/* 2000 ³â 2¿ù 28ÀÏ */
		lunMonthDay = 30;	/* 1999³â 11¿ù */
	}
	else if (year >= 1970)
	{
		/* ±âÁØÀÏÀÚ ¾ç·Â 1970³â 1¿ù 1ÀÏ (À½·Â 1969³â 11¿ù 24ÀÏ) */
		solYear = 1970;
		solMonth = 1;
		solDay = 1;
		lunYear = 1969;
		lunMonth = 11;
		lunDay = 24;
		lunLeapMonth = 0;

		solMonthDay[1] = 28;	/* 1970 ³â 2¿ù 28ÀÏ */
		lunMonthDay = 30;	/* 1969³â 11¿ù */
	}
	else if (year >= 1940)
	{
		/* ±âÁØÀÏÀÚ ¾ç·Â 1940³â 1¿ù 1ÀÏ (À½·Â 1939³â 11¿ù 22ÀÏ) */
		solYear = 1940;
		solMonth = 1;
		solDay = 1;
		lunYear = 1939;
		lunMonth = 11;
		lunDay = 22;
		lunLeapMonth = 0;

		solMonthDay[1] = 29;	/* 1940 ³â 2¿ù 28ÀÏ */
		lunMonthDay = 29;	/* 1939³â 11¿ù */
	}
	else
	{
		/* ±âÁØÀÏÀÚ ¾ç·Â 1900³â 1¿ù 1ÀÏ (À½·Â 1899³â 12¿ù 1ÀÏ) */
		solYear = 1900;
		solMonth = 1;
		solDay = 1;
		lunYear = 1899;
		lunMonth = 12;
		lunDay = 1;
		lunLeapMonth = 0;

		solMonthDay[1] = 28;	/* 1900 ³â 2¿ù 28ÀÏ */
		lunMonthDay = 30;	/* 1899³â 12¿ù */
	}

	lunIndex = lunYear - 1899;

	while (true)
	{
		if (type == 1 &&
			year == solYear &&
			month == solMonth &&
			day == solDay)
		{
			return new myDate(lunYear, lunMonth, lunDay, lunLeapMonth);
		}
		else if (type == 2 &&
				year == lunYear &&
				month == lunMonth &&
				day == lunDay && 
				leapmonth == lunLeapMonth)
		{
			return new myDate(solYear, solMonth, solDay, 0);
		}

		/* add a day of solar calendar */
		if (solMonth == 12 && solDay == 31)
		{
			solYear++;
			solMonth = 1;
			solDay = 1;

			/* set monthDay of Feb */
			if (solYear % 400 == 0)
			{
				solMonthDay[1] = 29;
			}
			else if (solYear % 100 == 0)
			{
				solMonthDay[1] = 28;
			}
			else if (solYear % 4 == 0)
			{
				solMonthDay[1] = 29;
			}
			else
			{
				solMonthDay[1] = 28;
			}
		}
		else if (solMonthDay[solMonth - 1] == solDay)
		{
			solMonth++;
			solDay = 1;
		}
		else
		{
			solDay++;
		}

		/* add a day of lunar calendar */
		if (lunMonth == 12 &&
			((lunarMonthTable[lunIndex][lunMonth - 1] == 1 && lunDay == 29) ||
			(lunarMonthTable[lunIndex][lunMonth - 1] == 2 && lunDay == 30)))
		{
			lunYear++;
			lunMonth = 1;
			lunDay = 1;

			if (lunYear > 2043)
			{
				alert("ÀÔ·ÂÇÏ½Å ´ÞÀº ¾ø½À´Ï´Ù.");
				break;
			}

			lunIndex = lunYear - 1899;

			if (lunarMonthTable[lunIndex][lunMonth - 1] == 1)
			{
				lunMonthDay = 29;
			}
			else if (lunarMonthTable[lunIndex][lunMonth - 1] == 2)
			{
				lunMonthDay = 30;
			}
		}
		else if (lunDay == lunMonthDay)
		{
			if (lunarMonthTable[lunIndex][lunMonth - 1] >= 3
				&& lunLeapMonth == 0)
			{
				lunDay = 1;
				lunLeapMonth = 1;
			}
			else
			{
				lunMonth++;
				lunDay = 1;
				lunLeapMonth = 0;
			}

			if (lunarMonthTable[lunIndex][lunMonth - 1] == 1)
			{
				lunMonthDay = 29;
			}
			else if (lunarMonthTable[lunIndex][lunMonth - 1] == 2)
			{
				lunMonthDay = 30;
			}
			else if (lunarMonthTable[lunIndex][lunMonth - 1] == 3)
			{
				lunMonthDay = 29;
			}
			else if (lunarMonthTable[lunIndex][lunMonth - 1] == 4 &&
					lunLeapMonth == 0)
			{
				lunMonthDay = 29;
			}
			else if (lunarMonthTable[lunIndex][lunMonth - 1] == 4 &&
					lunLeapMonth == 1)
			{
				lunMonthDay = 30;
			}
			else if (lunarMonthTable[lunIndex][lunMonth - 1] == 5 &&
					lunLeapMonth == 0)
			{
				lunMonthDay = 30;
			}
			else if (lunarMonthTable[lunIndex][lunMonth - 1] == 5 &&
					lunLeapMonth == 1)
			{
					lunMonthDay = 29;
			}
			else if (lunarMonthTable[lunIndex][lunMonth - 1] == 6)
			{
				lunMonthDay = 30;
			}
		}
		else
		{
			lunDay++;
		}
	}
}



function myDate(year, month, day, leapMonth)
{
	this.year = year;
	this.month = month;
	this.day = day;
	this.leapMonth = leapMonth;
}



// ³¯Â¥Â÷ÀÌ¸¦ ±¸ÇÏ±â 1
function dayDiff1(str)
{
	var count = 0;

	var now = new Date();
	var y1 = now.getYear();
	var m1 = (now.getMonth() + 1);
	var d1 = now.getDate();

	var y2 = str.substr(0, 4);
	var m2 = str.substr(4, 2);
	var d2 = str.substr(6, 2);

	m2 = parseInt(m2) - 1;

	var date1 = new Date(y1, m1, d1);
	var date2 = new Date(y2, m2, d2);

	count = Math.ceil((date2 - date1) / 1000 / 24 / 60 / 60); 
	return count;
}



// ³¯Â¥Â÷ÀÌ¸¦ ±¸ÇÏ±â 2
function dayDiff2(str1, str2)
{
	var count = 0;

	if(str1 == str2)
	{
		return count;
	}

	var y1 = str1.substr(0, 4);
	var m1 = str1.substr(4, 2);
	var d1 = str1.substr(6, 2);

	m1 = parseInt(m1) - 1;

	var y2 = str2.substr(0, 4);
	var m2 = str2.substr(4, 2);
	var d2 = str2.substr(6, 2);

	m2 = parseInt(m2) - 1;

	var date1 = new Date(y1, m1, d1);
	var date2 = new Date(y2, m2, d2);

	count = Math.ceil((date2 - date1) / 1000 / 24 / 60 / 60); 
	return count;
}



// ÀÔ·ÂµÈ ³¯Â¥ÀÇ ´ÙÀ½³¯Â¥¸¦ °¡Á®¿À´Â ÇÔ¼ö
function getNextDate(sDate)
{
	var nYear = 0, nMonth = 0, nDate = 0, sResult = "";

	nYear = getStringToInteger(sDate.substring(0, 4));
	nMonth = getStringToInteger(sDate.substring(4, 6));
	nDate = getStringToInteger(sDate.substring(6, 8));

	nDate = nDate + 1;

	if (nMonth == 1 || nMonth == 3 || nMonth == 5 || nMonth == 7 || nMonth == 8 || nMonth == 10 || nMonth == 12)
	{
		if (nDate > 31)
		{
			if (nMonth == 12)
			{
				sResult = getIntegerToString(nYear + 1, 4) + "01" + "01";
			}
			else
			{
				sResult = getIntegerToString(nYear, 4) + getIntegerToString(nMonth + 1, 2) + "01";
			}
		}
		else
		{
			sResult = getIntegerToString(nYear, 4) + getIntegerToString(nMonth, 2) + getIntegerToString(nDate, 2);
		}
	}
	else if (nMonth == 2)
	{
		if ((nYear % 4) == 0)
		{
			if (nDate > 29)
			{
				sResult = getIntegerToString(nYear, 4) + getIntegerToString(nMonth + 1, 2) + "01";
			}
			else
			{
				sResult = getIntegerToString(nYear, 4) + getIntegerToString(nMonth, 2) + getIntegerToString(nDate, 2);
			}
		}
		else
		{
			if (nDate > 28)
			{
				sResult = getIntegerToString(nYear, 4) + getIntegerToString(nMonth + 1, 2) + "01";
			}
			else
			{
				sResult = getIntegerToString(nYear, 4) + getIntegerToString(nMonth, 2) + getIntegerToString(nDate, 2);
			}
		}
	}
	else
	{
		if (nDate > 30)
		{
			sResult = getIntegerToString(nYear, 4) + getIntegerToString(nMonth + 1, 2) + "01";
		}
		else
		{
			sResult = getIntegerToString(nYear, 4) + getIntegerToString(nMonth, 2) + getIntegerToString(nDate, 2);
		}
	}

	return sResult;
}



function getDeleteComma(sNumber)
{
	var sResult = "", xx1 = 0, nLen = 0, sChar = "";

	nLen = sNumber.length;

	for (xx1 = 0; xx1 <= nLen - 1; xx1++)
	{
		sChar = sNumber.substring(xx1, xx1 + 1);

		if (!isNaN(sChar))
		{
			sResult = sResult + sChar;
		}
		else
		{
			// Comma(,)ÀÌ¸é °Ç³Ê¶Ù°í, ÀÌ»óÇÑ ¹®ÀÚ¸é "0" °ªÀ» ¸®ÅÏ...
			if (sChar != ",")
			{
				break;
			}
		}
	}

	return sResult;
}



function getCurrencyNumber(sNumber)
{
	var sResult = "", xx1 = 0, xCnt = 0, nLen = 0;

	// À¯È¿ÇÏÁö ¾ÊÀº °ªÀÌ µé¾î¿À´Â°ÍÀ» º¸Á¤ÇØÁÖ±â À§ÇØ¼­...
	var nNumber = getStringToInteger(sNumber);
	sNumber = nNumber.toString();
	nLen = sNumber.length;

	if (nLen > 3)
	{
		for (xx1 = nLen - 1; xx1 >= 0; xx1--)
		{
			if (xCnt > 0)
			{
				if ((xCnt % 3) == 0)
				{
					sResult = sNumber.substring(xx1, xx1+1) + "," + sResult
				}
				else
				{
					sResult = sNumber.substring(xx1, xx1+1) + sResult
				}
			}
			else
			{
				sResult = sNumber.substring(xx1, xx1+1) + sResult
			}

			xCnt = xCnt + 1;
		}
	}
	else
	{
		sResult = sNumber;
	}

	return sResult;
}



function getCurrencyNumberForObject(vObject)
{
	var sRet = "";
	var sResult = vObject.value;

	if(sResult != "")
	{
		sResult = getDeleteComma(sResult)
	}

	if (sResult == "" || isNaN(sResult))
	{
		vObject.value = "";
		return;
	}

	sResult = getCurrencyNumber(sResult);

	vObject.value = sResult;
}



function getIntegerToString(nInt, nDigit)
{
	var i = 0, sStringResult = "", nDiffer = 0;

	sStringResult = nInt.toString();
	nDiffer = nDigit - sStringResult.length;

	if (nDiffer > 0)
	{
		for (i = 0; i <= nDiffer - 1; i++)
		{
			sStringResult = "0" + sStringResult;
		}
	}

	return sStringResult;
}



function getStringToInteger(sValue)
{
	var i = 0, nLen = sValue.length;

	// ¼ýÀÚ·Î¸¸ ±¸¼ºµÇ¾î ÀÖ´ÂÁö Ã¼Å©...
	if(sValue == "" || isNaN(sValue))
	{
		return 0;
	}

	for (i = 0; i <= nLen - 1; i++)
	{
		if (sValue.indexOf("0") == 0)
		{
			// "0"ÀÌ µé¾î¿ÔÀ» °æ¿ì¸¦ Ã¼Å©ÇÏ±â À§ÇØ¼­...
			if (sValue.length > 1)
			{
				sValue = sValue.substring(1, nLen);
			}
			else
			{
				sValue = "0";
			}
		}
		else
		{
			break;
		}
	}

	return parseInt(sValue);
}



function getGroupMinStDt()
{
	var xx1 = 0, sResult = "", sToday = "";

	for (xx1 = 0; xx1 <= nTgdinvNoCnts - 1; xx1++)
	{
		if (sResult == "" || sResult > sTgdinvDateArr[xx1])
		{
			sResult = sTgdinvDateArr[xx1];
		}
	}

	return sResult;
}



function getGroupMaxEdDt()
{
	var xx1 = 0, xx2 = 0, sResult = "";

	for (xx1 = 0; xx1 <= nTotalBkngGrpCnts - 1; xx1++)
	{
		if (sResult == "" || sResult < sTotalGrpEdDtArr[xx1])
		{
			sResult = sTotalGrpEdDtArr[xx1];
		}
	}

	for (xx2 = 0; xx2 <= nTgdinvNoCnts - 1; xx2++)
	{
		if (sResult == "" || sResult < sTgdinvDateArr[xx2])
		{
			sResult = sTgdinvDateArr[xx2];
		}
	}

	return sResult;
}



function getLastDateOfMonth(sYear, sMonth)
{
	var nYear = 0, nMonth = 0, nReturn = 0;

	nYear = getStringToInteger(sYear);
	nMonth = getStringToInteger(sMonth);

	if (nMonth == 2)
	{
		// À±³âÀÌ¸é
		if ((nYear % 4) == 0)
		{
			nReturn = 29;
		}
		else
		{
			nReturn = 28;
		}
	}
	else if (nMonth == 1 || nMonth == 3 || nMonth == 5 || nMonth == 7 || nMonth == 8 || nMonth == 10 || nMonth == 12)
	{
		nReturn = 31;
	}
	else if (nMonth == 4 || nMonth == 6 || nMonth == 9 || nMonth == 11)
	{
		nReturn = 30;
	}
	else
	{
		nReturn = 0;
	}

	return nReturn;
}



function getCheckValidDate(sDateString)
{
	var nYear = 0, nMonth = 0, nDate = 0;
	var nNowYear = 0, nNowMonth = 0, nNowDate = 0;

	if (getIsDate(sDateString) == false)
	{
		return false;
	}

	nYear = getStringToInteger(sDateString.substring(0, 4));
	nMonth = getStringToInteger(sDateString.substring(4, 6));
	nDate = getStringToInteger(sDateString.substring(6, 8));

	var d = new Date();

	nNowYear = d.getYear();
	nNowMonth = d.getMonth()+1;	// ÀÚ¹Ù¿¡¼­´Â ¿ùÀº +1À» ÇØÁà¾ßÇÑ´Ù(ÀÌ»óÇÑ ³ðµéÀÓ)
	nNowDate = d.getDate();

	// ÇöÀç ³âµµº¸´Ù ÀÛÀ¸¸é...
	if (nYear < nNowYear)
	{
		return false;
	}

	// ÇöÀç ¿ùº¸´Ù ÀÛÀ¸¸é...
	if (nYear == nNowYear && nMonth < nNowMonth)
	{
		return false;
	}

	// ÇöÀç ÀÏº¸´Ù ÀÛÀ¸¸é...
	if (nYear == nNowYear && nMonth == nNowMonth && nDate <= nNowDate)
	{
		return false;
	}

	return true;
}



function getIsDate(sDateString)
{
	// ³¯Â¥ ¹®ÀÚ¿­ÀÇ ±æÀÌ°¡ 8ÀÚÀÎÁö¸¦ Ã¼Å©
	if (sDateString.length != 8)
	{
		return false;
	}
	else
	{
		// ¼ýÀÚ·Î¸¸ ±¸¼ºµÇ¾î ÀÖ´ÂÁö Ã¼Å©...
		if (getStringToInteger(sDateString) <= 0)
		{
			return false;
		}
	}

	var nDate = 0;
	nDate = getStringToInteger(sDateString.substring(6, 8));

	// ±× ´ÞÀÇ ¸¶Áö¸· ³¯Â¥º¸´Ù Å«Áö ¶Ç´Â 1º¸´Ù ÀÛÀºÁö Ã¼Å©....
	if (nDate < 1 || nDate > getLastDateOfMonth(sDateString.substring(0, 4), sDateString.substring(4, 6)))
	{
		return false;
	}

	return true;
}



function DateCheck(vYear, vMonth, vDay)
{
	//³âµµ °Ë»ç
	if(!( 1800 <= vYear && vYear <= 4000 )){
		return false;
	}

	//´Þ °Ë»ç
	if(!( 0 < vMonth &&  vMonth < 13))
	{
		return false;
	}

	// ÇØ´ç ³âµµ ¿ùÀÇ ¸¶Áö¸· ³¯
	var tempDate = new Date(vYear, vMonth, 0);
	var endDay = tempDate.getDate();

	//ÀÏ °Ë»ç
	if(!( 0 < vDay && vDay <= endDay ))
	{
		return false;
	}

	return true;
}



function Convert_String_To_DateFormat(vDate, vAMPM, vTime, vFormat)
{
	var strDate = vDate;
	var strTime = vTime;
	var strAMPM = vAMPM;
	var arrTime = new Array();
	var strRet = "";
	var iYear = 0, iMonth = 0, iDay = 0;
	var iHour = 0, iMinute = 0, iSeconds = 0;

	if(strDate == "")
	{
		return strRet;
	}

	if(isNaN(strDate))
	{
		return strRet;
	}

	if(strDate.length != 8)
	{ // Year Month Day 20090717 == 2009³â 7¿ù 17ÀÏ
		return strRet;
	}

	if(strTime != "")
	{ // Hour Minute Seconds 11:11:11 == 11½Ã 11ºÐ 11ÃÊ
		arrTime = strTime.split(":");

		for(var i = 0; i < arrTime.length; i++)
		{
			if(isNaN(arrTime[i]))
			{
				return strRet;
			}

			if(arrTime[i].length < 0 || arrTime[i].length > 2)
			{
				return strRet;
			}
		}

		if(parseInt(arrTime[0]) < 0 || parseInt(arrTime[0]) > 12)
		{
			return strRet;
		}
		if(parseInt(arrTime[1]) < 0 || parseInt(arrTime[1]) > 60)
		{
			return strRet;
		}
		if(parseInt(arrTime[2]) < 0 || parseInt(arrTime[2]) > 60)
		{
			return strRet;
		}

		iHour = getStringToInteger(arrTime[0]);
		if(strAMPM == "PM" && iHour != 12)
		{
			iHour += 12;
		}

		iMinute = getStringToInteger(arrTime[1]);
		iSeconds = getStringToInteger(arrTime[2]);
	}


	iYear = getStringToInteger(strDate.substr(0,4));
	iMonth = getStringToInteger(strDate.substr(4,2)) - 1;
	iDay = getStringToInteger(strDate.substr(6,2));
	
	if(!DateCheck(iYear, iMonth+1, iDay))
	{
		return strRet;
	}

	var objDate = new Date(iYear, iMonth, iDay, iHour, iMinute, iSeconds);
	strRet = objDate.getDateString(vFormat);

	return strRet;
}



// ´Þ·ÂÀ» ¸¸µé±â À§ÇÑ ±âº»Á¤º¸¸¦ Ãß°¡·Î »ý¼º
function GetCalendarInfo(sYear, sMonth)
{
	var nWeekdayOfFirstDate = 0;
	var nLastDay = 0, sLastDay = "";

	nLastDay = getLastDateOfMonth(sYear, sMonth);
	sLastDay = nLastDay.toString();

	var now = new Date();
	now.setFullYear(getStringToInteger(sYear), getStringToInteger(sMonth)-1, 1);
	nWeekdayOfFirstDate = now.getDay();

	return sYear + "_" + sMonth + "_01_" + sLastDay + "_" + nWeekdayOfFirstDate.toString() + "";
}



// ÇöÀç ´ÙÀ½¿ùÀ» °è»êÇØ¼­ ¸®ÅÏÇØÁÖ´Â ÇÔ¼ö...
function getNextYearMonth(sNowYearFlag, sNowMonthFlag)
{
	var sResultYearMonth = "";
	var nNowYear = 0, nNowMonth = 0;
	var nNextYear = 0, nNextMonth = 0;
	var nNMok = 0, nNNamuge = 0;

	nNowYear = getStringToInteger(sNowYearFlag);
	nNowMonth = getStringToInteger(sNowMonthFlag);
	nNextMonth = nNowMonth + 1;

	if (nNextMonth > 12)
	{
		nNMok = parseInt(Math.abs(nNextMonth / 12));
		nNNamuge = nNextMonth % 12;
		nNextYear = nNowYear + nNMok;
		nNextMonth = nNNamuge;

		sResultYearMonth = nNextYear.toString() + getIntegerToString(nNextMonth, 2);
	}
	else
	{
		sResultYearMonth = sNowYearFlag + getIntegerToString(nNextMonth, 2);
	}

	return sResultYearMonth;
}



function getPreYearMonth(sNowYearFlag, sNowMonthFlag)
{
	var sResultYearMonth = "";
	var nNowYear = 0, nNowMonth = 0;
	var nPreYear = 0, nPreMonth = 0;
	var nNMok = 0, nNNamuge = 0;

	nNowYear = getStringToInteger(sNowYearFlag);
	nNowMonth = getStringToInteger(sNowMonthFlag);
	nPreMonth = nNowMonth - 1;

	if (nPreMonth < 1)
	{
		nPreYear = nNowYear-1;
		nPreMonth = 12;

		sResultYearMonth = nPreYear.toString() + getIntegerToString(nPreMonth, 2);
	}
	else
	{
		sResultYearMonth = sNowYearFlag + getIntegerToString(nPreMonth, 2);
	}

	return sResultYearMonth;
}



function goPrevCalendar(type, sPreYearMonth)
{
	var xx1 = 0, nFirstViewIndex = 0, nSecondViewIndex = 0;
	var sGetElementId, Obg_TdCalendarTemplete, Obg_DivPrevBtn, Obg_DivNextBtn;
	 
	var sPreYearMonthDate = sPreYearMonth + "01";
	var sIntDomSDate_C = "";

	if(type == "AIR_S" || type == "AIR_E" || type == "AIR_SE")
	{ // Air
		if(document.getElementById("div_IntAir").style.display == "block")
		{ // International AirLine
			if(sIntAirStartDate.substring(0, 6) > sPreYearMonthDate.substring(0, 6))
			{
				alert("ÇöÀç Àü½ÃµÈ ´Þ·ÂÀÌ ¿¹¾àÀÌ °¡´ÉÇÑ Ã¹ ´Þ·ÂÀÔ´Ï´Ù.");
				return;
			}

			sIntDomSDate_C = document.frmIntSearch.SDate_C.value;

			if(sIntAirStartDate.substring(0,6) == sPreYearMonthDate.substring(0,6))
			{
				if(type == "AIR_S")
				{
					sPreYearMonthDate = sIntAirStartDate;
				}
				else
				{
					if(sIntDomSDate_C != "")
					{
						sPreYearMonthDate = sIntDomSDate_C;
					}
					else
					{
						sPreYearMonthDate = sIntAirStartDate;
					}
				}
			}
		}
		else
		{ // Domestic AirLine
			if(sDomAirStartDate.substring(0, 6) > sPreYearMonthDate.substring(0, 6))
			{
				alert("ÇöÀç Àü½ÃµÈ ´Þ·ÂÀÌ ¿¹¾àÀÌ °¡´ÉÇÑ Ã¹ ´Þ·ÂÀÔ´Ï´Ù.");
				return;
			}

			sIntDomSDate_C = document.frmDomSearch.SDate_C.value;

			if(sDomAirStartDate.substring(0,6) == sPreYearMonthDate.substring(0,6))
			{
				if(type == "AIR_S")
				{
					sPreYearMonthDate = sDomAirStartDate;
				}
				else
				{
					if(sIntDomSDate_C != "")
					{
						sPreYearMonthDate = sIntDomSDate_C;
					}
					else
					{
						sPreYearMonthDate = sDomAirStartDate;
					}
				}
			}
		}

		if(type != "AIR_S")
		{
			if(sIntDomSDate_C.substring(0, 6) == sPreYearMonthDate.substring(0, 6))
			{
				if(sIntDomSDate_C != "")
				{
					sPreYearMonthDate = sIntDomSDate_C;
				}
			}
			else if(sIntDomSDate_C.substring(0, 6) > sPreYearMonthDate.substring(0, 6))
			{
				return;
			}
		}

		if(document.getElementById("div_IntAir").style.display == "block")
		{ // International AirLine
			sGetElementId = "td_calendar_templete_" + type + "_INT_" + getNextYearMonth(sPreYearMonth.substring(0, 4), sPreYearMonth.substring(4, 6));
			Obg_TdCalendarTemplete = document.getElementById(sGetElementId);
			Obg_TdCalendarTemplete.style.display = "none";

			if(type == "AIR_S")
			{
				document.getElementById("div_int_air_stdt_calendar_tab").innerHTML = CreateCalendar(sPreYearMonthDate, "", type);
			}
			else
			{
				document.getElementById("div_int_air_eddt_calendar_tab").innerHTML = CreateCalendar(sPreYearMonthDate, "", "AIR_SE");
			}
		}
		else
		{ // Domestic AirLine
			sGetElementId = "td_calendar_templete_" + type + "_DOM_" + getNextYearMonth(sPreYearMonth.substring(0, 4), sPreYearMonth.substring(4, 6));
			Obg_TdCalendarTemplete = document.getElementById(sGetElementId);
			Obg_TdCalendarTemplete.style.display = "none";

			if(type == "AIR_S")
			{
				document.getElementById("div_dom_air_stdt_calendar_tab").innerHTML = CreateCalendar(sPreYearMonthDate, "", type);
			}
			else
			{
				document.getElementById("div_dom_air_eddt_calendar_tab").innerHTML = CreateCalendar(sPreYearMonthDate, "", "AIR_SE");
			}
		}
	}
	else if(type == "HOTEL")
	{ // Hotel
		if(sHotelStartDate.substring(0, 6) > sPreYearMonthDate.substring(0, 6))
		{
			alert("ÇöÀç Àü½ÃµÈ ´Þ·ÂÀÌ ¿¹¾àÀÌ °¡´ÉÇÑ Ã¹ ´Þ·ÂÀÔ´Ï´Ù.");
			return;
		}

		if(sHotelStartDate.substring(0, 6) == sPreYearMonthDate.substring(0, 6))
		{
			sPreYearMonthDate = sHotelStartDate;
		}

		sGetElementId = "td_calendar_templete_" + type + "_" + getNextYearMonth(sPreYearMonth.substring(0, 4), sPreYearMonth.substring(4, 6));
		Obg_TdCalendarTemplete = document.getElementById(sGetElementId);
		Obg_TdCalendarTemplete.style.display = "none";

		document.getElementById("div_hotel_stdt_calendar_tab").innerHTML = CreateCalendar(sPreYearMonthDate, "", type);
	}
	else if(type == "LODGING_S" || type == "LODGING_E" || type == "LODGING_SE")
	{ // Lodging
		if(document.getElementById("div_IntLogding").style.display == "block")
		{ // International Lodging
			if(sIntLodgingStartDate.substring(0, 6) > sPreYearMonthDate.substring(0, 6))
			{
				alert("ÇöÀç Àü½ÃµÈ ´Þ·ÂÀÌ ¿¹¾àÀÌ °¡´ÉÇÑ Ã¹ ´Þ·ÂÀÔ´Ï´Ù.");
				return;
			}

			sIntDomSDate_C = document.frmIntSearchLodging.SDate_C.value;

			if(sIntLodgingStartDate.substring(0,6) == sPreYearMonthDate.substring(0,6))
			{
				if(type == "LODGING_S")
				{
					sPreYearMonthDate = sIntLodgingStartDate;
				}
				else
				{
					if(sIntDomSDate_C != "")
					{
						sPreYearMonthDate = sIntDomSDate_C;
					}
					else
					{
						sPreYearMonthDate = sIntLodgingStartDate;
					}
				}
			}
		}
		else
		{ // Domestic Lodging
			if(sDomLodgingStartDate.substring(0, 6) > sPreYearMonthDate.substring(0, 6))
			{
				alert("ÇöÀç Àü½ÃµÈ ´Þ·ÂÀÌ ¿¹¾àÀÌ °¡´ÉÇÑ Ã¹ ´Þ·ÂÀÔ´Ï´Ù.");
				return;
			}

			sIntDomSDate_C = document.frmDomSearchLodging.SDate_C.value;

			if(sDomLodgingStartDate.substring(0,6) == sPreYearMonthDate.substring(0,6))
			{
				if(type == "LODGING_S")
				{
					sPreYearMonthDate = sDomLodgingStartDate;
				}
				else
				{
					if(sIntDomSDate_C != "")
					{
						sPreYearMonthDate = sIntDomSDate_C;
					}
					else
					{
						sPreYearMonthDate = sDomLodgingStartDate;
					}
				}
			}
		}

		if(type != "LODGING_S")
		{
			if(sIntDomSDate_C.substring(0, 6) == sPreYearMonthDate.substring(0, 6))
			{
				if(sIntDomSDate_C != "")
				{
					sPreYearMonthDate = sIntDomSDate_C;
				}
			}
			else if(sIntDomSDate_C.substring(0, 6) > sPreYearMonthDate.substring(0, 6))
			{
				return;
			}
		}

		if(document.getElementById("div_IntLogding").style.display == "block")
		{ // International Lodging
			sGetElementId = "td_calendar_templete_" + type + "_INT_" + getNextYearMonth(sPreYearMonth.substring(0, 4), sPreYearMonth.substring(4, 6));
			Obg_TdCalendarTemplete = document.getElementById(sGetElementId);
			Obg_TdCalendarTemplete.style.display = "none";

			if(type == "LODGING_S")
			{
				document.getElementById("div_int_logding_stdt_calendar_tab").innerHTML = CreateCalendar(sPreYearMonthDate, "", type);
			}
			else
			{
				document.getElementById("div_int_logding_eddt_calendar_tab").innerHTML = CreateCalendar(sPreYearMonthDate, "", "LODGING_SE");
			}
		}
		else
		{ // Domestic Lodging
			sGetElementId = "td_calendar_templete_" + type + "_DOM_" + getNextYearMonth(sPreYearMonth.substring(0, 4), sPreYearMonth.substring(4, 6));
			Obg_TdCalendarTemplete = document.getElementById(sGetElementId);
			Obg_TdCalendarTemplete.style.display = "none";

			if(type == "LODGING_S")
			{
				document.getElementById("div_dom_logding_stdt_calendar_tab").innerHTML = CreateCalendar(sPreYearMonthDate, "", type);
			}
			else
			{
				document.getElementById("div_dom_logding_eddt_calendar_tab").innerHTML = CreateCalendar(sPreYearMonthDate, "", "LODGING_SE");
			}
		}
	}
}



function goNextCalendar(type, sNextYearMonth)
{
	var xx1 = 0, nFirstViewIndex = 0, nSecondViewIndex = 0;
	var sGetElementId, Obg_TdCalendarTemplete, Obg_TdCalendarDivide, Obg_DivPrevBtn, Obg_DivNextBtn;

	var sNextYearMonthDate =  sNextYearMonth + "01";

	if(type == "AIR_S" || type == "AIR_E" || type == "AIR_SE")
	{ // Air
		if(document.getElementById("div_IntAir").style.display == "block")
		{ // International AirLine
			sGetElementId = "td_calendar_templete_" + type + "_INT_" + getPreYearMonth(sNextYearMonth.substring(0, 4), sNextYearMonth.substring(4, 6));
			Obg_TdCalendarTemplete = document.getElementById(sGetElementId);
			Obg_TdCalendarTemplete.style.display = "none";

			if(type == "AIR_S")
			{
				document.getElementById("div_int_air_stdt_calendar_tab").innerHTML = CreateCalendar(sNextYearMonthDate, "", type);
			}
			else
			{
				document.getElementById("div_int_air_eddt_calendar_tab").innerHTML = CreateCalendar(sNextYearMonthDate, "", "AIR_SE");
			}
		}
		else
		{ // Domestic AirLine
			sGetElementId = "td_calendar_templete_" + type + "_DOM_" + getPreYearMonth(sNextYearMonth.substring(0, 4), sNextYearMonth.substring(4, 6));
			Obg_TdCalendarTemplete = document.getElementById(sGetElementId);
			Obg_TdCalendarTemplete.style.display = "none";

			if(type == "AIR_S")
			{
				document.getElementById("div_dom_air_stdt_calendar_tab").innerHTML = CreateCalendar(sNextYearMonthDate, "", type);
			}
			else
			{
				document.getElementById("div_dom_air_eddt_calendar_tab").innerHTML = CreateCalendar(sNextYearMonthDate, "", "AIR_SE");
			}
		}
	}
	else if(type == "HOTEL")
	{ // Hotel
		sGetElementId = "td_calendar_templete_" + type + "_" + getPreYearMonth(sNextYearMonth.substring(0, 4), sNextYearMonth.substring(4, 6));
		Obg_TdCalendarTemplete = document.getElementById(sGetElementId);
		Obg_TdCalendarTemplete.style.display = "none";

		document.getElementById("div_hotel_stdt_calendar_tab").innerHTML = CreateCalendar(sNextYearMonthDate, "", type);
	}
	else if(type == "LODGING_S" || type == "LODGING_E" || type == "LODGING_SE")
	{ // Lodging
		if(document.getElementById("div_IntLogding").style.display == "block")
		{ // International Lodging
			sGetElementId = "td_calendar_templete_" + type + "_INT_" + getPreYearMonth(sNextYearMonth.substring(0, 4), sNextYearMonth.substring(4, 6));
			Obg_TdCalendarTemplete = document.getElementById(sGetElementId);
			Obg_TdCalendarTemplete.style.display = "none";

			if(type == "LODGING_S")
			{
				document.getElementById("div_int_logding_stdt_calendar_tab").innerHTML = CreateCalendar(sNextYearMonthDate, "", type);
			}
			else
			{
				document.getElementById("div_int_logding_eddt_calendar_tab").innerHTML = CreateCalendar(sNextYearMonthDate, "", "LODGING_SE");
			}
		}
		else
		{ // Domestic Lodging
			sGetElementId = "td_calendar_templete_" + type + "_DOM_" + getPreYearMonth(sNextYearMonth.substring(0, 4), sNextYearMonth.substring(4, 6));
			Obg_TdCalendarTemplete = document.getElementById(sGetElementId);
			Obg_TdCalendarTemplete.style.display = "none";

			if(type == "LODGING_S")
			{
				document.getElementById("div_dom_logding_stdt_calendar_tab").innerHTML = CreateCalendar(sNextYearMonthDate, "", type);
			}
			else
			{
				document.getElementById("div_dom_logding_eddt_calendar_tab").innerHTML = CreateCalendar(sNextYearMonthDate, "", "LODGING_SE");
			}
		}
	}
}



function GetCalendar(sYear, sMonth, sPeriodStartDate, type)
{
	var i = 0;
	var nYear = 0, nMonth = 0, nLastDay = 0, nWeekdayOfFirstDate = 0;
	var sType = type, idType = "";
	var sCalendarDateInfoArray = GetCalendarInfo(sYear, sMonth).split("_");
	var sNextYearMonthFlag, sNextYearFlag, sNextMonthFlag;
	var sChoiceDate = "";

	nYear = getStringToInteger(sCalendarDateInfoArray[0]);
	nMonth = getStringToInteger(sCalendarDateInfoArray[1]);
	nLastDay = getStringToInteger(sCalendarDateInfoArray[3]);
	nWeekdayOfFirstDate = getStringToInteger(sCalendarDateInfoArray[4]);

	sNextYearMonthFlag = getNextYearMonth(sYear, sMonth);
	sNextYearFlag = sNextYearMonthFlag.substring(0, 4);
	sNextMonthFlag = sNextYearMonthFlag.substring(4, 6);

	sPreYearMonthFlag = getPreYearMonth(sYear, sMonth);
	sPreYearFlag = sPreYearMonthFlag.substring(0, 4);
	sPreMonthFlag = sPreYearMonthFlag.substring(4, 6);

	var j1 = 0, j2 = 0, nLoopCnt = 0;

	/* set the day before ¼³³¯ */
	//if (lunarMonthTable[sYear - 1 - 1899][11] == 1)
	//	memorialDays[1].day = 29;
	//else if (lunarMonthTable[sYear - 1 - 1899][11] == 2)
	//	memorialDays[1].day = 30;

	var nMonthTableArray = new Array();
	var sBgColorArray = new Array();
	var sFontColorArray = new Array();
	var sDateArray = new Array();
	var sTagStart = new Array();
	var sTagEnd = new Array();
	var sTagStart1 = new Array();
	var sTagEnd1 = new Array();
	var solarDate ;
	var lunarDate;
	var memorial;

	for (j1 = 0; j1 <= 5; j1++)
	{
		nMonthTableArray[j1] = new Array();
		sBgColorArray[j1] = new Array();
		sFontColorArray[j1] = new Array();
		sDateArray[j1] = new Array();
		sTagStart[j1] = new Array();
		sTagEnd[j1] = new Array();
		sTagStart1[j1] = new Array();
		sTagEnd1[j1] = new Array();
	}

	for (j1 = 0; j1 <= 5; j1++)
	{
		for (j2 = 0; j2 <= 6; j2++)
		{
			nMonthTableArray[j1][j2] = "0";
			sDateArray[j1][j2] = "";
			sTagStart[j1][j2] = "";
			sTagEnd[j1][j2] = "";
			sTagStart1[j1][j2] = "";
			sTagEnd1[j1][j2] = "";

			if ((j2 % 7) == 0)
			{
				sBgColorArray[j1][j2] = sNormaldayBgColor;
				sFontColorArray[j1][j2] = "white";
			}
			else if ((j2 % 7) == 6)
			{
				sBgColorArray[j1][j2] = sNormaldayBgColor;
				sFontColorArray[j1][j2] = "white";
			}
			else
			{
				sBgColorArray[j1][j2] = sNormaldayBgColor;
				sFontColorArray[j1][j2] = "white";
			}
		}
	}

	nLoopCnt = 0;

	if(type == "AIR_S" || type == "AIR_E" || type == "AIR_SE")
	{ // Air
		if(document.getElementById("div_IntAir").style.display == "block")
		{ // International AirLine
			idType = "_INT_";
		}
		else
		{ // Domestic AirLine
			idType = "_DOM_";
		}

		if(type == "AIR_SE")
		{
			sType = "AIR_E";
		}
	}
	else if(type == "HOTEL")
	{ // Hotel
		idType = "_";
	}
	else if(type == "LODGING_S" || type == "LODGING_E" || type == "LODGING_SE")
	{ // Lodging
		if(document.getElementById("div_IntLogding").style.display == "block")
		{ // International Lodging
			idType = "_INT_";
		}
		else
		{ // Domestic Lodging
			idType = "_DOM_";
		}

		if(type == "LODGING_SE")
		{
			sType = "LODGING_E";
		}
	}

	for (j1 = 0; j1 <= 5; j1++)
	{
		for (j2 = 0; j2 <= 6; j2++)
		{
			if (j1 > 0)
			{
				if (nLoopCnt <= nLastDay - 1)
				{
					nLoopCnt = nLoopCnt + 1
					nMonthTableArray[j1][j2] = nLoopCnt;

					sDateArray[j1][j2] = sYear + sMonth + getIntegerToString(nMonthTableArray[j1][j2].toString(), 2);
					solarDate = new myDate(sYear, sMonth, getIntegerToString(nMonthTableArray[j1][j2].toString(), 2));
					lunarDate = lunarCalc(sYear, sMonth, getIntegerToString(nMonthTableArray[j1][j2].toString(), 2), 1);
					memorial = memorialDayCheck(solarDate, lunarDate);

					if (sChoiceDate == sDateArray[j1][j2])
					{
						sBgColorArray[j1][j2] = sChoiceBgColor;
						sFontColorArray[j1][j2] = sChoiceFontColor;
					}
					else
					{
						if ((j2 % 7) == 0 || (memorial && memorial.holiday))
						{
							sBgColorArray[j1][j2] = sSundayBgColor;
							sFontColorArray[j1][j2] = sSundayFontColor;
						}
						else if ((j2 % 7) == 6)
						{
							sBgColorArray[j1][j2] = sSaturdayBgColor;
							sFontColorArray[j1][j2] = sSaturdayFontColor;
						}
						else
						{
							sBgColorArray[j1][j2] = sNormaldayBgColor;
							sFontColorArray[j1][j2] = sNormaldayFontColor;
						}
					}

					if (sPeriodStartDate <= sDateArray[j1][j2])
					{
						if(type == "AIR_S" || type == "AIR_SE")
						{
							sTagStart[j1][j2] = "<a href=\"javascript:air_setValueOfSelectedDate('" + sDateArray[j1][j2] + "','" + sType + "');\" style=\"color:" + sFontColorArray[j1][j2] + "\">";
							sTagEnd[j1][j2] = "</a>";
							sTagStart1[j1][j2] = "<strong>";
							sTagEnd1[j1][j2] = "</strong>";
						}
						else if(type == "HOTEL")
						{
							sTagStart[j1][j2] = "<a href=\"javascript:hotel_setValueOfSelectedDate('" + sDateArray[j1][j2] + "','" + sType + "');\" style=\"color:" + sFontColorArray[j1][j2] + "\">";
							sTagEnd[j1][j2] = "</a>";
							sTagStart1[j1][j2] = "<strong>";
							sTagEnd1[j1][j2] = "</strong>";
						}
						else if(type == "LODGING_S" || type == "LODGING_SE")
						{
							sTagStart[j1][j2] = "<a href=\"javascript:lodging_setValueOfSelectedDate('" + sDateArray[j1][j2] + "','"+sType+"');\" style=\"color:" + sFontColorArray[j1][j2] + "\">";
							sTagEnd[j1][j2] = "</a>";
							sTagStart1[j1][j2] = "<strong>";
							sTagEnd1[j1][j2] = "</strong>";
						}
					}
					else
					{
						sTagStart[j1][j2] = "";
						sTagEnd[j1][j2] = "";
						sTagStart1[j1][j2] = "";
						sTagEnd1[j1][j2] = "";
						sBgColorArray[j1][j2] = sNormaldayBgColor;
						sFontColorArray[j1][j2] = sNormaldayFontColor;
					}
				}
			}
			else
			{
				if (j2 >= nWeekdayOfFirstDate)
				{
					if (nLoopCnt <= nLastDay-1)
					{
						nLoopCnt = nLoopCnt + 1
						nMonthTableArray[j1][j2] = nLoopCnt;

						sDateArray[j1][j2] = sYear + sMonth + getIntegerToString(nMonthTableArray[j1][j2].toString(), 2);
						solarDate = new myDate(sYear, sMonth, getIntegerToString(nMonthTableArray[j1][j2].toString(), 2));
						lunarDate = lunarCalc(sYear, sMonth, getIntegerToString(nMonthTableArray[j1][j2].toString(), 2), 1);

						/* memorial day */
						memorial = memorialDayCheck(solarDate, lunarDate);

						if (sChoiceDate == sDateArray[j1][j2])
						{
							sBgColorArray[j1][j2] = sChoiceBgColor;
							sFontColorArray[j1][j2] = sChoiceFontColor;
						}
						else
						{
							if ((j2 % 7) == 0 || (memorial && memorial.holiday))
							{
								sBgColorArray[j1][j2] = sSundayBgColor;
								sFontColorArray[j1][j2] = sSundayFontColor;
							}
							else if ((j2 % 7) == 6)
							{
								sBgColorArray[j1][j2] = sSaturdayBgColor;
								sFontColorArray[j1][j2] = sSaturdayFontColor;
							}
							else
							{
								sBgColorArray[j1][j2] = sNormaldayBgColor;
								sFontColorArray[j1][j2] = sNormaldayFontColor;
							}
						}

						if (sPeriodStartDate <= sDateArray[j1][j2])
						{
							if(type == "AIR_S" || type == "AIR_SE")
							{
								sTagStart[j1][j2] = "<a href=\"javascript:air_setValueOfSelectedDate('" + sDateArray[j1][j2] + "','" + sType + "');\" style=\"color:" + sFontColorArray[j1][j2] + "\">";
								sTagEnd[j1][j2] = "</a>";
								sTagStart1[j1][j2] = "<strong>";
								sTagEnd1[j1][j2] = "</strong>";
							}
							else if(type == "HOTEL")
							{
								sTagStart[j1][j2] = "<a href=\"javascript:hotel_setValueOfSelectedDate('" + sDateArray[j1][j2] + "','" + sType + "');\" style=\"color:" + sFontColorArray[j1][j2] + "\">";
								sTagEnd[j1][j2] = "</a>";
								sTagStart1[j1][j2] = "<strong>";
								sTagEnd1[j1][j2] = "</strong>";
							}
							else if(type == "LODGING_S" || type == "LODGING_SE")
							{
								sTagStart[j1][j2] = "<a href=\"javascript:lodging_setValueOfSelectedDate('" + sDateArray[j1][j2] + "','"+sType+"');\" style=\"color:" + sFontColorArray[j1][j2] + "\">";
								sTagEnd[j1][j2] = "</a>";
								sTagStart1[j1][j2] = "<strong>";
								sTagEnd1[j1][j2] = "</strong>";
							}
						}
						else
						{
							sTagStart[j1][j2] = "";
							sTagEnd[j1][j2] = "";
							sTagStart1[j1][j2] = "";
							sTagEnd1[j1][j2] = "";
							sBgColorArray[j1][j2] = sNormaldayBgColor;
							sFontColorArray[j1][j2] = sNormaldayFontColor;
						}
					}
				}
			}
		}
	}

	var sReturnString = new Array();

	if(type == "AIR_S" || type == "AIR_E" || type == "AIR_SE")
	{
		sReturnString.push("<table width=\"181\" height=\"136\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"e1c2b8\" align=\"center\">");
		sReturnString.push("<tbody>")
		sReturnString.push("<tr>");
		sReturnString.push("<td bgcolor=\"#FFFFFF\" style=\"padding:5px 5px 5px 5px\">");
	}
	sReturnString.push("<table cellspacing=\"0\" cellpadding=\"0\" width=\"171\" border=\"0\">");
	sReturnString.push("<tbody>");
	sReturnString.push("<tr>");
	sReturnString.push("<td height=\"19\"><table cellspacing=\"0\" cellpadding=\"0\" width=\"171\" border=\"0\">");
	sReturnString.push("<tbody>");
	sReturnString.push("<tr>");
	sReturnString.push("<input type=\"hidden\" name=\"calendar_templete_info_" + sType + idType  + sYear + sMonth + "\" value=\"" + sYear + sMonth + "\">");

	if(type == "AIR_S" || type == "AIR_SE" || type == "HOTEL" || type == "LODGING_S" || type == "LODGING_SE")
	{
		sReturnString.push("<td width=\"10\" style=\"padding:0 0 2px 0;\"><a href=\"javascript:goPrevCalendar('" + sType + "','" + sPreYearMonthFlag + "');\"><img src=\"" + NEO_IMAGE_SERVER_URL + "neo_reservation/airfare/air_new/btn_cal_arrow01.gif\" border=\"0\" name=\"div_prev_btn_" + sType + idType  + sYear + sMonth + "\"></a></td>");
	}
	else
	{
		sReturnString.push("<td width=\"10\" style=\"padding:0 0 2px 0;\"><img src=\"" + NEO_IMAGE_SERVER_URL + "neo_reservation/airfare/air_new/btn_cal_arrow01.gif\" border=\"0\" name=\"div_prev_btn_" + sType + idType + "\"></td>");
	}

	sReturnString.push("<td width=\"151\" align=\"center\"><font color=\"333333\"><b>" + sYear + "³â&nbsp;" + sMonth + "¿ù </b></font></td>");

	if(type == "AIR_S" || type == "AIR_SE" || type == "HOTEL" || type == "LODGING_S" || type == "LODGING_SE")
	{
		sReturnString.push("<td width=\"10\" style=\"padding:0 0 2px 0;\"><a href=\"javascript:goNextCalendar('" + sType + "','" + sNextYearMonthFlag + "');\"><img src=\"" + NEO_IMAGE_SERVER_URL + "neo_reservation/airfare/air_new/btn_cal_arrow02.gif\" border=\"0\" name=\"div_next_btn_" + sType + idType  + sYear + sMonth + "\"></a></td>");
	}
	else
	{
		sReturnString.push("<td width=\"10\" style=\"padding:0 0 2px 0;\"><img src=\"" + NEO_IMAGE_SERVER_URL + "neo_reservation/airfare/air_new/btn_cal_arrow02.gif\" border=\"0\" name=\"div_next_btn_" + sType + idType + "\"></td>");
	}

	sReturnString.push("</tr>");
	sReturnString.push("</tbody>");
	sReturnString.push("</table></td>");
	sReturnString.push("</tr>");
	sReturnString.push("<tr>");
	sReturnString.push("<td><img src=\"" + NEO_IMAGE_SERVER_URL + "neo_reservation/airfare/air_new/img_cal01.gif\"></td>");
	sReturnString.push("</tr>");
	sReturnString.push("<tr>");
	sReturnString.push("<td style=\"padding:3px 1px 1px 1px;\">");
	sReturnString.push("<table cellspacing=\"1\" cellpadding=\"0\" width=\"169\" border=\"0\">");
	sReturnString.push("<tbody>");

	for (j1 = 0; j1 <= 5; j1++)
	{
		sReturnString.push("<tr>");

		for (j2 = 0; j2 <= 6; j2++)
		{
			if (sPeriodStartDate <= sDateArray[j1][j2])
			{
				sReturnString.push("<td align=\"center\" width=\"23\" bgcolor=\"#ededed\" height=\"16\" class=\"fs_11 b\">");
			}
			else
			{
				sReturnString.push("<td align=\"center\" width=\"23\" height=\"16\" class=\"fs_11 b\">");
			}
			sReturnString.push("<strong><font color=\"" + sFontColorArray[j1][j2] + "\">" + sTagStart[j1][j2] + nMonthTableArray[j1][j2].toString() + sTagEnd[j1][j2] + "</font></strong>");
			sReturnString.push("<input type=\"hidden\" name=\"nMonthTableArray_" + sType + idType + sYear + sMonth + "_" + j1.toString() + "_" + j2.toString() + "\" value=\"" + sDateArray[j1][j2] + "\">");
			sReturnString.push("</td>");
		}

		sReturnString.push("</tr>");
	}

	sReturnString.push("</tbody>");
	sReturnString.push("</table></td>");
	sReturnString.push("</tr>");
	sReturnString.push("</tbody>");
	sReturnString.push("</table>");
	if(type == "AIR_S" || type == "AIR_E" || type == "AIR_SE")
	{
		sReturnString.push("</td>");
		sReturnString.push("</tr>");
		sReturnString.push("</tbody>");
		sReturnString.push("</table>");
	}

	return sReturnString.join('');
}



function CreateCalendar(sPeriodStartDate, sPeriodEndDate, type)
{
	var sType = type, idType = "";
	var sNowYearMonthFlag = "", sNowYearFlag = "", sNowMonthFlag = "";
	var sSpanContext = new Array();

	if(bLoadCalendar)
	{
		if(sCalendarTemplate == "")
		{
			return;
		}

		if(type == "AIR_S" || type == "AIR_E" || type == "AIR_SE")
		{
			if(sCalendarTemplate == "INT_AIR")
			{ // International AirLine
				if(!bIntAirFirstCal)
				{
					sIntAirStartDate = sPeriodStartDate;
					bIntAirFirstCal = true;
				}

				idType = "_INT_";
			}
			else
			{ // Domestic AirLine
				if(!bDomAirFirstCal)
				{
					sDomAirStartDate = sPeriodStartDate;
					bDomAirFirstCal = true;
				}

				idType = "_DOM_";
			}

			if(type == "AIR_SE")
			{
				sType = "AIR_E";
			}
		}
		else if(type == "HOTEL")
		{ // Hotel
			if(!bHotelFirstCal)
			{
				sHotelStartDate = sPeriodStartDate;
				bHotelFirstCal = true;
			}

			idType = "_";
		}
		else if(type == "LODGING_S" || type == "LODGING_E" || type == "LODGING_SE")
		{ // Lodging
			if(sCalendarTemplate == "INT_LODGING")
			{ // International Lodging
				if(!bIntLodgingFirstCal)
				{
					sIntLodgingStartDate = sPeriodStartDate;
					bIntLodgingFirstCal = true;
				}

				idType = "_INT_";
			}
			else
			{ // Domestic Lodging
				if(!bDomLodgingFirstCal)
				{
					sDomLodgingStartDate = sPeriodStartDate;
					bDomLodgingFirstCal = true;
				}

				idType = "_DOM_";
			}

			if(type == "LODGING_SE")
			{
				sType = "LODGING_E";
			}
		}
	}
	else
	{
		if(type == "AIR_S" || type == "AIR_E" || type == "AIR_SE")
		{
			if(document.getElementById("div_IntAir").style.display == "block")
			{ // International AirLine
				if(!bIntAirFirstCal)
				{
					sIntAirStartDate = sPeriodStartDate;
					bIntAirFirstCal = true;
				}

				idType = "_INT_";
			}
			else
			{ // Domestic AirLine
				if(!bDomAirFirstCal)
				{
					sDomAirStartDate = sPeriodStartDate;
					bDomAirFirstCal = true;
				}

				idType = "_DOM_";
			}

			if(type == "AIR_SE")
			{
				sType = "AIR_E";
			}
		}
		else if(type == "HOTEL")
		{ // Hotel
			if(!bHotelFirstCal)
			{
				sHotelStartDate = sPeriodStartDate;
				bHotelFirstCal = true;
			}

			idType = "_";
		}
		else if(type == "LODGING_S" || type == "LODGING_E" || type == "LODGING_SE")
		{ // Lodging
			if(document.getElementById("div_IntLogding").style.display == "block")
			{ // International Lodging
				if(!bIntLodgingFirstCal)
				{
					sIntLodgingStartDate = sPeriodStartDate;
					bIntLodgingFirstCal = true;
				}

				idType = "_INT_";
			}
			else
			{ // Domestic Lodging
				if(!bDomLodgingFirstCal)
				{
					sDomLodgingStartDate = sPeriodStartDate;
					bDomLodgingFirstCal = true;
				}

				idType = "_DOM_";
			}

			if(type == "LODGING_SE")
			{
				sType = "LODGING_E";
			}
		}
	}

	if (getIsDate(sPeriodStartDate) == false)
	{
		sPeriodStartDate = "";
	}

	if (getIsDate(sPeriodEndDate) == false)
	{
		sPeriodEndDate = "";
	}

	if(bLoadCalendar)
	{
		bLoadCalendar = false;
		sCalendarTemplate = "";
	}

	sNowYearMonthFlag = sPeriodStartDate.substring(0, 6);
	sNowYearFlag = sNowYearMonthFlag.substring(0, 4);
	sNowMonthFlag = sNowYearMonthFlag.substring(4, 6);

	if(type == "AIR_S" || type == "AIR_E" || type == "AIR_SE")
	{
		sSpanContext.push("<table width=\"181\" height=\"136\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">");
		sSpanContext.push("<tbody>");
		sSpanContext.push("<tr>");
		if(type == "AIR_S")
		{
			sSpanContext.push("<td height=\"36\" align=\"center\">Ãâ¹ßÀÏ");
			sSpanContext.push("<input type=\"text\" name=\"SDate_C\" style=\"width:138; height:20; font-family:µ¸¿ò; font-size:12px; color:#c03d23; margin:0 0 -1px 4px; border:1px solid #e1c2b8; padding:3px 0 0 3px\" readonly>");
			sSpanContext.push("</td>");
		}
		else
		{
			if(type == "AIR_SE")
			{
				sSpanContext.push("<td height=\"36\" align=\"center\">µµÂøÀÏ");
				sSpanContext.push("<input type=\"text\" name=\"EDate_C\" style=\"width:138; height:20; font-family:µ¸¿ò; font-size:12px; color:#c03d23; margin:0 0 -1px 4px; border:1px solid #e1c2b8; padding:3px 0 0 3px\" readonly>");
				sSpanContext.push("</td>");
			}
			else
			{
				sSpanContext.push("<td height=\"36\" align=\"center\">µµÂøÀÏ");
				sSpanContext.push("<input type=\"text\" name=\"EDate_C\" style=\"width:138; height:20; font-family:µ¸¿ò; font-size:12px; color:#c03d23; margin:0 0 -1px 4px; border:1px solid #e1c2b8; padding:3px 0 0 3px\" readonly>");
				sSpanContext.push("</td>");
			}
		}
		sSpanContext.push("</tr>");
		sSpanContext.push("<tr>");
		sSpanContext.push("<td height=\"162\" id=\"td_calendar_templete_" + sType + idType + sNowYearMonthFlag + "\" valign=\"top\">");
		sSpanContext.push(GetCalendar(sNowYearFlag, sNowMonthFlag, sPeriodStartDate, type));
		sSpanContext.push("</td>");
		sSpanContext.push("</tr>");
		sSpanContext.push("</tbody>");
		sSpanContext.push("</table>");
	}
	else
	{
		sSpanContext.push("<table width=\"181\" height=\"136\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"eee0c7\" align=\"center\">");
		sSpanContext.push("<tbody>");
		sSpanContext.push("<tr>");
		sSpanContext.push("<td height=\"32\" bgcolor=\"FFFFFF\" id=\"td_calendar_templete_" + sType + idType + sNowYearMonthFlag + "\" style=\"padding:5px 5px 5px 5px\">");
		sSpanContext.push("<input type=\"hidden\" id=\"SDate_C\" name=\"SDate_C\">");
		sSpanContext.push("<input type=\"hidden\" id=\"EDate_C\" name=\"EDate_C\">");
		sSpanContext.push(GetCalendar(sNowYearFlag, sNowMonthFlag, sPeriodStartDate, type));
		sSpanContext.push("</td>");
		sSpanContext.push("</tr>");
		sSpanContext.push("</tbody>");
		sSpanContext.push("</table>");
	}

	return sSpanContext.join('');
}


function onLoadCalendar(sPeriodStartDate, sPeriodEndDate, type, sTemplate)
{
	bLoadCalendar = true;
	sCalendarTemplate = sTemplate;

	var sCalendar = CreateCalendar(sPeriodStartDate, sPeriodEndDate, type);

	return sCalendar;
}

