function InputTimeAtom (strVarName, nScriptIndex, bScroll, strScrollName, bSureInputScroll, 
						strTableName, strFieldName, nFieldLen,
						strDateType, strDateFormat, nYearKind,
						bRange, nRangeType, nDateLine, bNotUseDefaultDate, bDateValid, 
						strMinDate, strMaxDate, strHelp, nFontSize, strFontFamily, nBindType, 
						bVanish, bDisabled, bDefaultKey, bAutoLoad, bRelatedOperation, strTabID, bFocusVisible,
						strFieldType)
{
	this.Atom (strVarName, "", strScrollName, -1, nScriptIndex, -1, -1, bVanish);
	
	//////////////////////////////
	// 날짜 입력란 속성 
	this.m_strDataTypeOrigin = strDateType;
	this.m_arDateType = strDateType.split("$");
	this.m_strDateFormat = strDateFormat;
	this.m_nYearKind = nYearKind;
	this.m_bRange = bRange;
	this.m_nRangeType = nRangeType;
	this.m_nDateLine = nDateLine;
	this.m_bNotUseDefaultDate = bNotUseDefaultDate;
	this.m_bDateValid = bDateValid;
	this.m_strMinDate = strMinDate;
	this.m_strMaxDate = strMaxDate;
	this.m_nFontSize = nFontSize;
	this.m_strFontFamily = strFontFamily;
	this.m_strTabID = strTabID;
	
	this.m_strTableName = strTableName;
	this.m_strFieldName = strFieldName;
	this.m_nFieldLen = nFieldLen;
	this.m_strFieldType	= strFieldType;		// 자료형태
	
	this.m_bDefaultKey =	bDefaultKey;
	this.m_bAutoLoad = bAutoLoad;
	
	// 날짜의 Valid 체크를 위해 년도, 월 의 타입을 저장해 둔다
	this.m_strYearType = null;
	this.m_strMonthType = null;
	
	///////////////////////////////
	// DB에 저장하기 위한 날짜 원본  
	this.m_strDBTypeDate = "";
	
	this.m_strOldValue = ""; // onChanee 이벤트를 강제로 발생시키기 위해 이전값을 저장합니다.

	// 현재 선택된 날짜박스가 Range인지 아닌지를 판별한다. 
	this.m_bSelectedRange = false;

	///////////////////////////////
	// Scroll 관련 멤버  
	this.m_bScroll = bScroll;
	this.m_bSureInputScroll = bSureInputScroll;

	///////////////////////////////
	// 멤버 HTML
	this.m_heAtom = document.getElementById(InputTimeAtom.DEFAULT_ID + this.m_strVarName);
	this.m_heAtomHeader = document.getElementById(InputTimeAtom.DEFAULT_ID + "HEADER_"+ this.m_strVarName);
	this.m_heAtomCalendarButton = null;

	// 날짜 
	this.m_heAtomYear = document.getElementById(InputTimeAtom.DEFAULT_ID + "YEAR_" + this.m_strVarName);
	this.m_heAtomMonth = document.getElementById(InputTimeAtom.DEFAULT_ID + "MONTH_" + this.m_strVarName);
	this.m_heAtomDay = document.getElementById(InputTimeAtom.DEFAULT_ID + "DAY_" + this.m_strVarName);

	// Range 날짜
	this.m_heAtomYearRange = null;
	this.m_heAtomMonthRange = null;
	this.m_heAtomDayRange = null;

	// 날짜 포멧(년, 월, 일, - 등)
	this.m_heAtomYearFormat = document.getElementById(InputTimeAtom.DEFAULT_ID + "YEAR_FORMAT_" + this.m_strVarName);
	this.m_heAtomMonthFormat = document.getElementById(InputTimeAtom.DEFAULT_ID + "MONTH_FORMAT_" + this.m_strVarName);
	this.m_heAtomDayFormat = document.getElementById(InputTimeAtom.DEFAULT_ID + "DAY_FORMAT_" + this.m_strVarName);
	
	// 날짜 Range 포멧(년, 월, 일, - 등)
	this.m_heAtomYearRangeFormat = null;
	this.m_heAtomMonthRangeFormat = null;
	this.m_heAtomDayRangeFormat = null;

	// 날짜 Edit박스
	this.m_heAtomYearEdit = document.getElementById(InputTimeAtom.DEFAULT_ID + "YEAR_EDIT_" + this.m_strVarName);
	this.m_heAtomMonthEdit = document.getElementById(InputTimeAtom.DEFAULT_ID + "MONTH_EDIT_" + this.m_strVarName);
	this.m_heAtomDayEdit = document.getElementById(InputTimeAtom.DEFAULT_ID + "DAY_EDIT_" + this.m_strVarName);
	// 날짜 Range Edit박스
	this.m_heAtomYearRangeEdit = null;
	this.m_heAtomMonthRangeEdit = null;
	this.m_heAtomDayRangeEdit = null;

	this.m_htMemberElement = new Hashtable();

	this.m_strHelp = strHelp;
	this.m_strSaveType = "";

	this.m_nBindType = nBindType;		// 묶여있는 아톰 종류 (0:일반, 1:스크롤, 2:그리드, 3:수행조건)
	this.m_nRowIndex = -1;
	this.m_bDisabled = bDisabled;
	
	this.m_bAtomHasFocus = false;
	this.m_bCalendarSelect = false
	this.m_heGridCell = null;
	
	this.m_strCalendarImageSource = IsWPQModel() ? "./ups/sys/image/pq/atom/inputtime/calendar.png" : "/ups/sys/image/pq/atom/inputtime/calendar.png";
	// 달력 이미지 세팅 여부, 한번 세팅하고 안하기 위함
	this.m_bSetCalendarImageSource = false;
	
 	this.m_bOperation = true; // 연산식을 발생시킬것인가?
 	this.m_bRelatedOperation = bRelatedOperation; // 이 아톰이 연산식과 연관되어 있는가?
 	
 	this.m_bTabKeyDown = false;	// 탭키가 눌러 졌는지를 나타냄	
 	
 	this.m_bFocusVisible = bFocusVisible;
	
	this.m_heAtomTable = document.getElementById(InputTimeAtom.DEFAULT_ID + "TABLE_" + this.m_strVarName);
}

InputTimeAtom.prototype = new Atom ();
InputTimeAtom.prototype.constructor = InputTimeAtom;

/**
 * 아톰리스트에 추가
 */
InputTimeAtom.prototype.putAtom = function ()
{
	InputTimeAtom._atoms[this.m_strVarName] = this;
}

InputTimeAtom.prototype.getAtomType = function ()
{
	return "InputTime";
}

InputTimeAtom.prototype.getTableName = function ()
{
	return this.m_strTableName;
}

InputTimeAtom.prototype.getFieldName = function ()
{
	return this.m_strFieldName;
}

InputTimeAtom.prototype.getFieldType = function ()
{
	return this.m_strFieldType;
}

InputTimeAtom.prototype.isDefaultKey = function ()
{
	return this.m_bDefaultKey;
}

InputTimeAtom.prototype.isAutoLoad = function ()
{
	return this.m_bAutoLoad;
}

InputTimeAtom.prototype.getValue = function ()
{
	var arDateValue = this._getValueToArray(this.m_strDBTypeDate);
	var strResult = "";
	var nLen = this.m_arDateType.length;
	var nLoop = 0;
	while (nLoop <= nLen)
	{
		if (arDateValue.length > nLoop)
		{
			strResult += arDateValue[nLoop];			
		}
		
		nLoop++;
	}
	//서버로 전송시
	//1. 날짜형식에 맞게 데이터를 잘라내고
	//2. 필드길이만큼 전송한다.
	
	return strResult.substr(0, this.m_nFieldLen);
}

// 스크롤에서만 호출됨.
InputTimeAtom.prototype.displayValue = function ()
{
	if ("" != this.m_strDBTypeDate)
	{
		this.setValue(this.m_strDBTypeDate);
	}
	else
	{
		if (this.m_bNotUseDefaultDate)
		{
			this._setInitValue();
		}
		this._setFocusVisibility(false);
	}	
}
	
InputTimeAtom.prototype.getDisplayValue = function (strDateValue)
{
	var arDateValue = null;
	
	if (null != strDateValue)
	{
		arDateValue = this._getValueToArray(strDateValue);
	}
	else
	{
		arDateValue = this._getValueToArray(this.m_strDBTypeDate);
	}
	
	return this._getFormattedDateValue(arDateValue);
}

InputTimeAtom.prototype.getHTML = function ()
{
	return this.m_heAtom;
}

InputTimeAtom.prototype.setHTML = function (heAtom)
{
	this.m_heAtom = heAtom;
	
	// 스크롤에서 보이지 않는 아톰은 HTML Element를 null로 설정해야 한다.
	if (null == heAtom)
	{
		this.m_heAtomHeader = null;
		this.m_heAtomCalendarButton = null;
		this.m_heAtomYear = null;
		this.m_heAtomMonth = null;
		this.m_heAtomDay = null;
		this.m_heAtomYearRange = null;
		this.m_heAtomMonthRange = null;
		this.m_heAtomDayRange = null;
		this.m_heAtomYearFormat = null;
		this.m_heAtomMonthFormat = null;
		this.m_heAtomDayFormat = null;
		this.m_heAtomYearRangeFormat = null;
		this.m_heAtomMonthRangeFormat = null;
		this.m_heAtomDayRangeFormat = null;
		this.m_heAtomYearEdit = null;
		this.m_heAtomMonthEdit = null;
		this.m_heAtomDayEdit = null;
		this.m_heAtomYearRangeEdit = null;
		this.m_heAtomMonthRangeEdit = null;
		this.m_heAtomDayRangeEdit = null;
		this.m_heAtomTable = null;
	}
	else
	{
		this._resetMemberElement();
	}
}

/**
 * 그리드에서 날짜입력란 TD를 입력란 엘리먼트로 설정한다.
 */
InputTimeAtom.prototype.setGridHtmlElement = function (heAtom, heCell)
{
	this.m_heAtom = heAtom;
	this.m_heGridCell = heCell;
}

InputTimeAtom.prototype.getRowIndex = function ()
{
	return this.m_nRowIndex;
}

InputTimeAtom.prototype.setRowIndex = function (nIndex)
{
	this.m_nRowIndex = nIndex;
}

InputTimeAtom.prototype.setIsOperation = function (bOperation)
{
	this.m_bOperation = bOperation;
}

InputTimeAtom.prototype.isOperation = function ()
{
	return this.m_bOperation;
}

InputTimeAtom.prototype.isScroll = function ()
{
	return this.m_bScroll;
}

InputTimeAtom.prototype.isRelatedOperation = function ()
{
	return this.m_bRelatedOperation;
}

////////////////////////////////////////////////////////////
// public 메서드

InputTimeAtom.prototype.init = function ()
{
	this._initRange();
	this._initDateFormat();
	this._initRangeFormat();

	this._setDateType();
	this._setInitValue();

	// 수행조건의 Row인 경우 크기와 위치를 조절 한다. 
	if (3 == this.m_nBindType)
	{
		this._resizeEditBox();
		this.reArrangeDatePosition();
	}
	
	this._setFocusVisibility(false);
}

/**
* 요청정보를 만든다.
* @param xnRequest
* @param isScroll 스크롤 아톰의 묶여있다면 true. 그 외에는 undefined
*/
InputTimeAtom.prototype.makeRequest = function (xnRequest, isScroll)
{
	var strVarName = this.getVarName();
	var strValue = this.getValue();

	var xnAtom = XmlLib.createChild(xnRequest, "InputTime");
	
	xnAtom.setAttribute("SaveType", this.m_strSaveType);
	xnAtom.setAttribute("VarName", strVarName);
	XmlLib.setTextValue(xnAtom, strValue);
	
	xnAtom.setAttribute("TableName", this.getTableName());
	xnAtom.setAttribute("FieldName", this.getFieldName());
}

InputTimeAtom.prototype.setValue = function (strValue, nOccurEventType)
{
	strValue = strValue.replace(new RegExp("[^0-9]", 'g'), "");
	
	var arValue = this._getValueToArray(strValue);

	if (false == this._checkValidRange(arValue))
	{
		this._showHelpDialog();
		return;
	}
	
	this._setDateValue(arValue);
	
	this._updateDBTypeDate(arValue, nOccurEventType);
	
	this._occurOnChangeEvent(nOccurEventType);
	
	if ((null == strValue || 0 == strValue.length) && nOccurEventType != undefined)
	{
		this._setFocusVisibility(false);
	}
	else
	{
		this._setFocusVisibility(true);
	}
	
}

InputTimeAtom.prototype.getSaveType = function (strSaveType)
{
	this.m_strSaveType = strSaveType;
}

InputTimeAtom.prototype.setSaveType = function (strSaveType)
{
	this.m_strSaveType = strSaveType;
}

/**
 * 선택표시 (f9 기능)
 */
InputTimeAtom.prototype.vanish = function ()
{
	if (this.m_bVanish && null != this.m_heAtom)
	{
		// 현재 감춤 상태이면 표시한다.
		if ("none" == this.m_heAtom.style.display)
		{
			this.m_heAtomTable.style.display = "block";
			this.m_heAtom.style.display = "block";
		}
		else
		{
			// 표시된 상태이면 감춘다.
			this.m_heAtomTable.style.display = "none";
			this.m_heAtom.style.display = "none";
		}
	}
}

InputTimeAtom.prototype.isVisible = function ()
{
	var strVisibility = this.m_heAtom.style.visibility;
	if ("hidden" == strVisibility)
	{
		return false;
	}
	else if ("visible" == strVisibility)
	{
		return true;
	}
	else
	{
		// 탭뷰 안에 있는 경우
		var heTabView = this.m_heAtom.parentElement;
		if (this.isScroll())
		{
			heTabView = this.m_heAtom.parentElement.parentElement.parentElement;
		}
		
		if (null != heTabView && heTabView.tagName == "DIV")
		{
			if ("none" == heTabView.style.display)
			{
				return false;
			}
		}
	}
	return true;
}

/**
 * 커서 포커스를 가질수 있는지 여부
 */
InputTimeAtom.prototype.isFocusable = function ()
{
	if (null == this.m_heAtom || this.m_heAtom.readOnly || this.m_heAtom.disabled)
	{
		return false;
	}
	
	if (this.m_heAtom.offsetLeft > GetWindowWidth() || this.m_heAtom.offsetHeight > GetWindowHeight())
	{
		// 폼 영역을 벗어난경우
		return false;
	}
	
	if (this.isScroll())
	{
		// 스크롤 영역을 벗어난경우
		var heScrollDiv = this.m_heAtom.parentElement.parentElement;
		if (this.m_heAtom.offsetLeft > heScrollDiv.offsetWidth || this.m_heAtom.offsetHeight > heScrollDiv.offsetHeight)
		{
			return false;
		}
	}
	
	return this.isVisible();
}

InputTimeAtom.prototype.setFocus = function ()
{
	if (null != this.m_heAtom)
	{
		this.focusFirstEdit();
		
		return true;
	}
	return false;
}

/**
 * 달력 버튼을 감춘다
 * 배준배 2006. 09 .23
 */
InputTimeAtom.prototype.hideCalendaButton = function ()
{
	this._hideElement(this.m_heAtomCalendarButton);
}

/**
 * 아톰을 구성하는 Element들의 위치를 다시 정의 한다. 
 * 배준배 
 */
InputTimeAtom.prototype.reArrangeDatePosition = function ()
{
	// DateType순서로 돌아야 한다. 
	/*
	var nPreRightPos = 0;
	var nYPos = this._makeYPosition();

	for (var i = 0; i < this.m_arDateType.length; i++)
	{
		if (this._isYear(this.m_arDateType[i]))
		{
			nPreRightPos = this._setYearPosition(i, nPreRightPos, nYPos);
		}
		else if (this._isMonth(this.m_arDateType[i]))
		{
			nPreRightPos = this._setMonthPosition(i, nPreRightPos, nYPos);
		}
		else
		{
			nPreRightPos = this._setDayPosition(i, nPreRightPos, nYPos);
		}

		// 날짜의 오른쪽 값에 날짜 사이 간격 을 더한다. 
		if (i < this.m_arDateType.length - 1)
		{
			 nPreRightPos += this._getBetweenWidth();
		}
	}

	this._setCalendarButtonPosition(nPreRightPos, nYPos);

	this.m_heAtomHeader.style.pixelTop = nYPos;
	*/
}

/**
 * 인자로 받은 값만큼 top을 변경시킨다
 * 
 * @param nRepositionValue (top 변경 값)
 */
InputTimeAtom.prototype.repositionYPos = function (nRepositionValue)
{
	var nTop = this.m_heAtom.offsetTop;
	
	this.m_heAtom.style.top = (nTop + nRepositionValue) + "px";
}

/**
 * 인자로 받은 값만큼 left를 변경시킨다
 * 
 * @param nRepositionValue (left 변경 값)
 */
InputTimeAtom.prototype.repositionXPos = function (nRepositionValue)
{
	var nLeft = this.m_heAtom.offsetLeft;
	
	this.m_heAtom.style.left = (nLeft + nRepositionValue) + "px";
}

///////////////////////////////////
// Scroll 관련 메서드 

InputTimeAtom.prototype.isSureInputScroll = function ()
{
	return this.m_bSureInputScroll;
}

InputTimeAtom.prototype.isSureInput = function ()
{
	//TODO: 필수 입력인지 아닌지 확인, sureInput xml 속성을 멤버로 가져와서 필수입력이 올바른지 확인 하는 작업이 필요
	return false;
}

/**
 * 객체 clone 메소드 입니다.
 */
InputTimeAtom.prototype.clone = function (bIsHtml)
{
	var objAtom = new InputTimeAtom(this.m_strVarName, this.m_nScriptIndex, this.m_bScroll, this.m_strScrollName, this.m_bSureInputScroll, 
					this.m_strTableName, this.m_strFieldName, this.m_nFieldLen,
					this.m_strDataTypeOrigin, this.m_strDateFormat, this.m_nYearKind,
					this.m_bRange, this.m_nRangeType, this.m_nDateLine, this.m_bNotUseDefaultDate, this.m_bDateValid, 
					this.m_strMinDate, this.m_strMaxDate, this.m_strHelp, this.m_nFontSize, this.m_strFontFamily, this.m_nBindType,
					this.m_bVanish, this.m_bDisabled, this.m_bDefaultKey, this.m_bAutoLoad, this.m_bRelatedOperation, this.m_strTabID, this.m_bFocusVisible,
					this.m_strFieldType);
	
	if (false != bIsHtml && null != this.m_heAtom)
	{
		objAtom.setHTML(this.m_heAtom.cloneNode(true));
	}
	else
	{
		objAtom.setHTML(null);
	}

	return objAtom;
}

/**
 * 날짜 입력란의 필수입력을 체크한다.
 * 필수입력인데 공백이면 예외 throw
 */
InputTimeAtom.prototype.checkSureInput = function ()
{
	var strValue = this.getValue();
		if (null == strValue || 0 == strValue.length)
		{
			if ((true == this.m_bScroll && true == this.m_bSureInputScroll))
				return false;
				
			var strErrChar = this.m_strHelp;
			if (null == strErrChar || 0 == strErrChar.length)
			{
				strErrChar = this.m_strVarName;
			}
			throw new SureInputException (strErrChar + "을(를) 입력해 주십시오.");
		}
		return true;
}

InputTimeAtom.prototype.checkSureInputScroll = function ()
{
	if (this.getValue())
	{	
		return true;
	}
	
	return false;
}

InputTimeAtom.prototype.setReadOnly = function (bReadOnly)
{
	this.m_bDisabled = bReadOnly;
}


////////////////////////////////////////////////////////////
// event handler

InputTimeAtom.prototype.onClickCalendarButton = function (objEvent)
{	
	this.m_bTabKeyDown = false;
	this.hideCalendaButton();
	
	var nYPos = objEvent.screenY;
	var nXPos = objEvent.screenX;

	var strDefault = this._getSelectedDate();
	
	var arDefaultDate = this._getValueToArray(strDefault);
	
	var strHtmlPath = IsWPQModel() ? "./ups/sys/html/support/Calendar_WPQ.html" : g_strServerURL + "sys/html/support/Calendar.html";
	var strReturnValue = Utils.showModalDialog(strHtmlPath, arDefaultDate, nXPos, nYPos, 182, 180);
		
	// 달력 객체로 부터 달력을 Show한다. 
	// 달력이 닫히면, 얻어온 값으로 부터 
	// setValue를 실시한다. 
	this._handleResult(strReturnValue);
	
	this._setUnClickedButtonStyle(this.m_heAtomCalendarButton.firstChild);
	
	if (2 == this.m_nBindType)
	{
		var strDisplay = this.getDisplayValue();
		this.m_heGridCell.childNodes[0].innerText = strDisplay;
		this.m_heAtom.style.display = "none";
	}
	
	//달력에서 값이 새로 선택이되면 기본검색기능을 수행한다.
	if (this.m_bAutoLoad)
	{
		this._defaultKeyAction();
	}
}

InputTimeAtom.prototype.onMousedownCalendarButton = function (heButton)
{
	this.m_bAtomHasFocus = true;
	this.m_bCalendarSelect = true;
	
	this._setClickedButtonStyle(heButton.firstChild);
}

InputTimeAtom.prototype.onClickDate = function (heDate)
{
	switch (heDate)
	{
		case this.m_heAtomYear :
		{
			this._handleOnClickDate(heDate, this.m_heAtomYearEdit);
			break;
		}
		case this.m_heAtomYearRange : 
		{
			this._handleOnClickDate(heDate, this.m_heAtomYearRangeEdit);
			break;
		}
		case this.m_heAtomMonth : 
		{
			this._handleOnClickDate(heDate, this.m_heAtomMonthEdit);
			break;
		}
		case this.m_heAtomMonthRange : 
		{
			this._handleOnClickDate(heDate, this.m_heAtomMonthRangeEdit);
			break;
		}
		case this.m_heAtomDay : 
		{
			this._handleOnClickDate(heDate, this.m_heAtomDayEdit);
			break;
		}
		case this.m_heAtomDayRange : 
		{
			this._handleOnClickDate(heDate, this.m_heAtomDayRangeEdit);
			break;
		}
	}
	
	this._checkSelectedRange(heDate);
	
	if (!this.m_bDisabled)
	{
		this._showCalendaButton(heDate);
	}
}

InputTimeAtom.prototype._checkSelectedRange = function (heDate)
{
	switch (heDate)
	{
		case this.m_heAtomYear :
		case this.m_heAtomMonth : 
		case this.m_heAtomDay : 
		{
			this.m_bSelectedRange = false;
			break;
		}
		case this.m_heAtomYearRange :
		case this.m_heAtomMonthRange :
		case this.m_heAtomDayRange :   
		{
			this.m_bSelectedRange = true; 
			break;
		}
	}
}

/**
 * 초점 잃음 이벤트
 * Edit는 촛점을 잃음과 동시에, tab이동일 경우 다음 Edit로 Cursor가 이동한다. 
 * @param heEdit(날짜 수정 edit, objEvent)
 * 배준배 2006. 09. 22
 */
InputTimeAtom.prototype.onBlurEdit = function (heEdit, objEvent)
{
	if (!this.m_bCalendarSelect)
	{
		this.m_bAtomHasFocus = false;
	}
	
	if (Utils.isEmpty(this.m_strDBTypeDate))
	{
		// 기본값 없음일 경우에, 수정이 일어나면 현재날짜를 먼저 넣어준뒤에 수정 사항을 반영한다.
		var strToday = this._getTodayYear() + this._getTodayMonth() + this._getTodayDate();
		if (this.m_bRange)
		{
			this.m_strDBTypeDate = strToday + strToday;
		}
		else
		{
			this.m_strDBTypeDate = strToday;
		}
	}
	
	switch (heEdit)
	{
		case this.m_heAtomYearEdit :
		{
			this._handleOnBlurYearEdit(heEdit, this.m_heAtomYear); break;
		}
		case this.m_heAtomYearRangeEdit : 
		{
			this._handleOnBlurYearEdit(heEdit, this.m_heAtomYearRange); break;
		}
		case this.m_heAtomMonthEdit :
		{
			this._handleOnBlurMonthEdit(heEdit, this.m_heAtomMonth); break;
		}
		case this.m_heAtomMonthRangeEdit :
		{
			this._handleOnBlurMonthEdit(heEdit, this.m_heAtomMonthRange); break;
		}
		case this.m_heAtomDayEdit :
		{
			this._handleOnBlurDayEdit(heEdit, this.m_heAtomDay); break;
		}
		case this.m_heAtomDayRangeEdit :
		{
			this._handleOnBlurDayEdit(heEdit, this.m_heAtomDayRange); break;
		}
	}
	if (!this.m_bDisabled && !this.m_bAtomHasFocus)
	{
		this._hideElement(this.m_heAtomCalendarButton);
	}
	this.m_bCalendarSelect = false;
	
	return this.m_bTabKeyDown;
}

InputTimeAtom.prototype.onKeyDown = function (heEdit, objEvent)
{
	var nKeyCode = objEvent.keyCode;
	this.m_bTabKeyDown = false;
	
	this._checkSelectedRange(heEdit.parentElement.childNodes[1]);
	
	if (HTMLLib.isCharacterKeyDown(nKeyCode))
	{
		objEvent.returnValue = false;
	}
	else
	{
		// Tab키일때 다음 에디트로 이동한다. 다음 에디트로 이동하는 특정 기능을 코딩하지 않는다.
		// Tab키를 누르면 다음으로 자동 이동되는데 이때 다음 에디터에 값을 넣고 보이게 한다.
		// KeyDown이 먼저 발생하고 다음 에디트로 이동하면서 현재 에디터는 onBlurEdit를 타게 된다.
		if (9 == nKeyCode)
		{
			var heNextEdit = this._getNextTabAtom(heEdit);
			
			if (null != heNextEdit)
			{
				this.m_bTabKeyDown = true;
				
				var heNext = this._getTextAtom(heNextEdit);
				
				this._setValueToDateEdit(heNextEdit, CrossBrowsing.getInnerText(heNext));
				
				heNextEdit.style.visibility = "visible";
				
				if (!this.m_bDisabled)
				{
					// Tab으로 다시 다음 에디트로 가므로 달력버튼이 유지되어야 한다.
					this.m_bCalendarSelect = true;
					this._showCalendaButton(heNextEdit);
				}
			}
			else	// 입력란을 벗어나는 탭이동
			{
				this._onTabKeyDown(heEdit, objEvent);
			}
		}
		
		// 엔터키 동작
		if (13 == nKeyCode)
		{
			this.onBlurEdit(heEdit, objEvent);
			// 엔터키가 눌러지면 기본검색키 동작이 일어납니다.
			this._defaultKeyAction();
		}
		return;
	}
}

InputTimeAtom.prototype.onMouseDown = function ()
{
	this.setValue(this.m_strDBTypeDate);

	if (this.isScroll() && this.m_bFocusVisible)
	{
		this._handleOnClickDate(this.m_heAtomYear,this.m_heAtomYearEdit);
	}
	this.m_bAtomHasFocus = true;		
	this.m_bTabKeyDown = false;
	
	// _누름
	if (-1 != ScriptAtomEvent.onClick(this.m_nScriptIndex))
	{
		ScriptAtomEvent.onClickAfter(this.m_nScriptIndex);
	}
}

InputTimeAtom.prototype.onBlurNotEdit = function ()
{
	if (!this.m_bCalendarSelect)
	{
		this.m_bAtomHasFocus = false;
	}
	else
	{
		this.m_bAtomHasFocus = true;
	}
}

InputTimeAtom.prototype.onBlurCalendarButton = function ()
{
	this.m_bCalendarSelect = false;
	this._setUnClickedButtonStyle(this.m_heAtomCalendarButton.firstChild);
}

InputTimeAtom.prototype.onDblClick = function (objEvent)
{
	// _두번누름
	this.m_bAtomHasFocus = true;
	if (-1 != ScriptAtomEvent.onDblClick(this.m_nScriptIndex))
	{
		ScriptAtomEvent.onDblClickAfter(this.m_nScriptIndex);
	}
}

InputTimeAtom.prototype.onFocus = function (heEdit, objEvent)
{
	this.setValue(this.m_strDBTypeDate);

	if (this.isScroll() && this.m_bFocusVisible && heEdit == this.m_heAtomYearEdit)
	{
		this.onClickDate(this.m_heAtomYear);
	}
	else
	{
		this.onClickDate(heEdit);
	}
	
	this.m_bTabKeyDown = false;
	// _초점얻음
	if (-1 != ScriptAtomEvent.onFocus(this.m_nScriptIndex))
	{
		ScriptAtomEvent.onFocusAfter(this.m_nScriptIndex);
	}
}

InputTimeAtom.prototype.onChange = function (nOccurEventType)
{
	_bTabKeyDown = false;
	
	if (Define.isOccurEvent(nOccurEventType))
	{
		if (this.m_bScroll)
 		{
 			var objScrollAtom = ScrollAtom.getAtom(this.m_strScrollName);
 			
 			// modifyRow에서 스크롤에 관련된 연산식이 수행됨
 			if (this.isOperation())
			{
 				objScrollAtom.modifyRow(this.m_nRowIndex, nOccurEventType, this.m_strVarName);
 			}
 			// 이 아톰의 값 변경 시 연산식 수행이 필요 없을 시 수행됨
 			// Applet에서 이미 연산식 수행을 했을 때
 			else
 			{
 				objScrollAtom.modifyRowExcludeOperation(this.m_nRowIndex, nOccurEventType);
 			}
 		}
 		else
 		{
 			if (this.isOperation())
			{
				PQOperation.execute(this);
			}
		}
	}
}

/**
 * 날짜 입력란에서 가장 좌측에 있는 에디터가 선택되도록 한다.
 * 그리드에서 호출함
 */
InputTimeAtom.prototype.focusFirstEdit = function ()
{
	var nXPos = 999;
	var heFirst = null;
	
	if (null != this.m_heAtomYearEdit && this.m_heAtomYearEdit.offsetLeft < nXPos)
	{
		nXPos = this.m_heAtomYearEdit.offsetLeft;
		heFirst = this.m_heAtomYear;
	}
	if (null != this.m_heAtomMonthEdit && this.m_heAtomMonthEdit.offsetLeft < nXPos)
	{
		nXPos = this.m_heAtomMonthEdit.offsetLeft;
		heFirst = this.m_heAtomMonth;
	}
	if (null != this.m_heAtomDayRangeEdit && this.m_heAtomDayRangeEdit.offsetLeft < nXPos)
	{
		nXPos = this.m_heAtomDayRangeEdit.offsetLeft;
		heFirst = this.m_heAtomDayRange;
	}
	
	this.onClickDate(heFirst);
}

////////////////////////////////////////////////////////////
// private 메서드 
InputTimeAtom.prototype._setInitValue = function ()
{		
	if (this.isScroll())
	{
		this.m_strDBTypeDate = "";
		this._setElementData(this.m_heAtomYear, "");
		this._setElementData(this.m_heAtomMonth, "");
		this._setElementData(this.m_heAtomDay, "");
	}
	else
	{
		var arValue = this._getValueToArray("");

		if (false == this._checkValidRange(arValue))
		{
			this._showHelpDialog();
			return;
		}
		
		this._setDateValue(arValue);
		
		this._updateDBTypeDate(arValue);
	}	
}

InputTimeAtom.prototype._handleResult = function (strValue)
{
	if (null == strValue || 0 == strValue.length)
	{
		return;
	}
	
	if (this.m_bRange)
	{
		var strDBTypeDate = this.m_strDBTypeDate;
		
		var strFromValue = strDBTypeDate.substr(0, 8);
		var strToValue = strDBTypeDate.substr(8, 16);
		
		if (this.m_bSelectedRange)
		{			
			strValue =  strFromValue + strValue;
		}
		else
		{
			strValue = strValue + strToValue; 
		}
	}
	this.setValue(strValue);	
}

/**
 * Tab Key
 *
 * onChange 이벤트 -> _탭이동 스크립트 -> _스크롤내이동 스크립트 -> 기본키동작
 */
InputTimeAtom.prototype._onTabKeyDown = function (heAtom, objEvent)
{
	this._occurOnChangeEvent();
	
	if (-1 == ScriptAtomEvent.onMoveTab(this.m_nScriptIndex))
	{
		objEvent.returnValue = false;
		return;
	}
	else
	{
		ScriptAtomEvent.onMoveTabAfter(this.m_nScriptIndex);
	}
	
	if (this.isScroll())
	{
		if (-1 == ScriptAtomEvent.onMoveScroll(this.m_nScriptIndex))
		{
			objEvent.returnValue = false;
			return ;
		}
		else
		{
			ScriptAtomEvent.onMoveScrollAfter(this.m_nScriptIndex);
		}
	}
	
	// 탭이동후 기본키 동작을 한다.
	this._defaultKeyAction();
	
	var nType = TabOrderManager.ATOMKIND_DATE;
	if (this.isScroll())
	{
		nType = TabOrderManager.ATOMKIND_SCROLLDATE; 
	}
	if (g_objTabOrderManager.moveNextFocus(nType, this.m_strVarName, this.m_strScrollName, this.m_strTabID))
	{
		// 항목 순서에 의한 포커스 이동이 성공하면, 원래의 tab key 이벤트는 무효화 시킨다.
		objEvent.returnValue = false;
	}
}

/**
 * 엘리먼트의 포인터를 다시 연결해 줍니다. 
 * 스크롤에 묶여 있을 경우, clone메서드를 실행하여 아톰(this.m_heAtom)이 복사되면
 * 아톰의 멤버 HTML들의 포인터가 기존의 아톰을 계속 가리키고 있는 문제 가 생깁니다.
 * 멤버HTML들이 새로운 아톰의 HTML멤버를 가리키게 하기위해
 * 아톰의 Element들을 가져와 하나씩 포인터를 이어 줍니다
 * @param heElement(현재 아톰의 엘리먼트)
 */
InputTimeAtom.prototype._repointingElement = function (heElement)
{	
	for (var i=0; i < heElement.length; i++ )
	{
		var heFirst = heElement[i];
		if (heFirst.tagName == "DIV" || heFirst.tagName == "INPUT" || heFirst.tagName == "TABLE")
		{
			strID = heFirst.getAttribute("id");

			strSubID = strID.substring(InputTimeAtom.DEFAULT_ID.length, strID.lastIndexOf(this.m_strVarName));

			switch (strSubID)
			{
				case "HEADER_" : this.m_heAtomHeader = heElement[i]; break;
				case "CALENDARBUTTON_" : this.m_heAtomCalendarButton = heElement[i]; break;

				case "YEAR_" : this.m_heAtomYear = heElement[i]; break;
				case "MONTH_" : this.m_heAtomMonth = heElement[i]; break;
				case "DAY_" : this.m_heAtomDay = heElement[i]; break;
				case "YEAR_RANGE_" : this.m_heAtomYearRange = heElement[i]; break;
				case "MONTH_RANGE_" : this.m_heAtomMonthRange = heElement[i]; break;
				case "DAY_RANGE_" : this.m_heAtomDayRange = heElement[i]; break;

				case "YEAR_FORMAT_" : this.m_heAtomYearFormat = heElement[i]; break;
				case "MONTH_FORMAT_" : this.m_heAtomMonthFormat = heElement[i]; break;
				case "DAY_FORMAT_" : this.m_heAtomDayFormat = heElement[i]; break;

				case "YEAR_RANGE_FORMAT_" : this.m_heAtomYearRangeFormat = heElement[i]; break;
				case "MONTH_RANGE_FORMAT_" : this.m_heAtomMonthRangeFormat = heElement[i]; break;
				case "DAY_RANGE_FORMAT_" : this.m_heAtomDayRangeFormat = heElement[i]; break;

				case "YEAR_EDIT_" : this.m_heAtomYearEdit = heElement[i]; break;
				case "MONTH_EDIT_" : this.m_heAtomMonthEdit = heElement[i]; break;
				case "DAY_EDIT_" : this.m_heAtomDayEdit = heElement[i]; break;
				case "YEAR_RANGE_EDIT_" : this.m_heAtomYearRangeEdit = heElement[i]; break;
				case "MONTH_RANGE_EDIT_" : this.m_heAtomMonthRangeEdit = heElement[i]; break;
				case "DAY_RANGE_EDIT_" : this.m_heAtomDayRangeEdit = heElement[i]; break;
				case "TABLE_" : this.m_heAtomTable =  heElement[i]; break;
			}
		}
		this._repointingElement(heFirst.childNodes);
	}
}

InputTimeAtom.prototype._resetMemberElement = function ()
{
	if ((null == this.m_strScrollName || "" == this.m_strScrollName) && 3 != this.m_nBindType)
	{
		return;
	}

	var heFirstLayerChilds = this.m_heAtom.childNodes;
	this._repointingElement(heFirstLayerChilds);

	this._hideElement(this.m_heAtomCalendarButton);
}

/**
 * 도움말 창을 띄운다. 
 * 배준배
 */
InputTimeAtom.prototype._showHelpDialog = function ()
{
	if (0 < this.m_strHelp.length)
	{
		alert(this.m_strHelp);
	}
}

/**
 * 날짜의 유효 범위를 체크한다. 
 * @param arValue(날짜정보 Array)
 * 배준배 
 */
InputTimeAtom.prototype._checkValidRange = function (arValue)
{	
	// 유효 범위 체크를 하지 않는 경우는 항상 참
	if (false == this.m_bDateValid)
	{
		return true;
	}

	var arStartDate = arValue.slice(0, 3);
	var arEndDate = null

	var bStartDateValid = this._inRange(arStartDate);
	var bEndDateValid = true;

	if (this.m_bRange)
	{
		arEndDate = arValue.slice(3, 6);
		bEndDateValid = this._inRange(arEndDate);
	}

	return bStartDateValid && bEndDateValid;
}

/**
 * 날짜가 MaxDate 와 MinDate사이에 있는가??
 * @parse arDate
 * @return boolean
 * 배준배 2006. 09. 22
 */
InputTimeAtom.prototype._inRange = function (arDate)
{
	var strDate = arDate.join("");

	if (parseFloat(this.m_strMinDate) <= parseFloat(strDate) &&
		parseFloat(this.m_strMaxDate) >= parseFloat(strDate))
	{
		return true;
	}
	return false;
}

/**
 * 년도의 날짜 포멧을 저장해 둔다. 
 * 날짜 포멧의 종류에 따라 날짜의 유효를 체크하는 범위가 달라진다. 
 * 배준배 2006. 09. 22
 */ 
InputTimeAtom.prototype._setDateType = function ()
{
	var nLen = this.m_arDateType.length;

	if (this.m_bRange)
	{
		nLen = nLen / 2;
	}

	for (var i = 0; i < nLen; i=i+1)
	{
		var strType = this.m_arDateType[i];

		if (this._isYear(strType))
		{
			this.m_strYearType = strType;	
		}
		else if (this._isMonth(strType))
		{
			this.m_strMonthType = strType;
		}
	}
}

/**
 * 달력 버튼을 보이게 한다.
 * 달력 버튼은 폼에서 하나의 엘리먼트만 생성되며, 보이기 전에 위치를 설정해 준다.
 * 묶인 아톰의 구조가 변경되면, 여기도 바꿔야 한다.
 */
InputTimeAtom.prototype._showCalendaButton = function (heDate)
{
	g_objInputTimeCalendar.setAtom(this);
	
	if (this.m_bScroll)
	{
		var nScrollTop = this.m_heAtom.parentElement.parentElement.offsetTop;
		var nScrollLeft = this.m_heAtom.parentElement.parentElement.offsetLeft;
		
		var objScrollAtom = ScrollAtom.getAtom(this.m_strScrollName);
		if (null != objScrollAtom)
		{
			var nRowTop = this.getRowIndex() * objScrollAtom.getRowHeight();
			var nNewTop = (this.m_heAtom.offsetTop + this.m_heAtom.offsetHeight / 2 - 8) + nScrollTop + nRowTop;
			
			var nNewLeft = (this.m_heAtom.offsetLeft + this.m_heAtom.offsetWidth - 8) + nScrollLeft;
			
			g_objInputTimeCalendar.setPosition(nNewTop, nNewLeft);
		}
	}
	else if (2 == this.m_nBindType)
	{
		// 그리드 묶인경우
		var nScrollTop = this.m_heAtom.parentElement.offsetTop;
		var nScrollLeft = this.m_heAtom.parentElement.offsetLeft;
		
		var nNewTop = (this.m_heAtom.style.pixelTop + this.m_heAtom.style.pixelHeight / 2 - 8) + nScrollTop;
		var nNewLeft = (this.m_heAtom.style.pixelLeft + this.m_heAtom.style.pixelWidth - 8) + nScrollLeft;
		g_objInputTimeCalendar.setPosition(nNewTop, nNewLeft);
	}
	else if (3 == this.m_nBindType)
	{
		// 수행조건 묶인경우
		var nScrollTop = this.m_heAtom.parentElement.parentElement.parentElement.offsetTop;
		var nScrollLeft = this.m_heAtom.parentElement.parentElement.parentElement.offsetLeft;
		
		var nNewTop = (this.m_heAtom.offsetTop + this.m_heAtom.offsetHeight / 2 - 8) + nScrollTop;
		var nNewLeft = (this.m_heAtom.offsetLeft + this.m_heAtom.offsetWidth - 8) + nScrollLeft;
		g_objInputTimeCalendar.setPosition(nNewTop, nNewLeft);
	}
	
	this.m_heAtomCalendarButton = g_objInputTimeCalendar.getHTML();
	
	// 달력 버튼의 src를 넣어준다.
	if (false == this.m_bSetCalendarImageSource)
	{
		this.m_heAtomCalendarButton.firstChild.src = this.m_strCalendarImageSource;
		this.m_bSetCalendarImageSource = true;
	}
	
	this._showElement(this.m_heAtomCalendarButton);
}

/**
 * 날짜를 클릭한경우, 수정 Edit가 나타나면서, 이후 행동 
 * @param heDate, heEdit
 * 배준배 2006.09.21
 */
InputTimeAtom.prototype._handleOnClickDate = function (heDate, heEdit)
{
	if (this.m_bDisabled)
	{
		return;		
	}
	
	var strDate = this._getElementData(heDate);

	/*heEdit.value = isNaN(parseFloat(strDate)) ? strDate : parseFloat(strDate);
	
	this._showElement(heEdit);*/
	
	this._setValueToDateEdit(heEdit, strDate);
	
	this._showElement(heEdit);

	if (this.m_heAtom.style.display!="none")
	{
		heEdit.focus();
		heEdit.select();
	}
}

InputTimeAtom.prototype._setValueToDateEdit = function (heEdit, strDate)
{
	heEdit.value = isNaN(parseFloat(strDate)) ? strDate : parseFloat(strDate);
}

/**
 * Edit를 통해서 수정된 날짜는 유효성을 체크한후 갱신한다. 
 * @param heEdit(년도 Edit), heDate(년도 Tag)
 * 배준배 2006.09.21
 */
InputTimeAtom.prototype._handleOnBlurYearEdit = function (heEdit, heYear)
{
	// 날짜의 유효성을 체크한다
	this._hideElement(heEdit);

	if (false == this._isVaildYear(heEdit, parseFloat(heEdit.value)))
	{
		return;
	}
	
	var strYear = Utils.makeValidCiphers(this.m_strYearType == "0" ? 4 : 2, heEdit.value);
	
	if (1 == this.m_nYearKind)
	{
		strYear = this._makeChristianEra(strYear);
	}

	this._handleResult(this._getFrontYear() + strYear + this._makeEnglishToNumber(this._getMonthDate()) + this._getDayDate());
}

/**
 * Edit를 통해서 수정된 날짜는 유효성을 체크한후 갱신한다. 
 * @param heEdit(월 Edit), heDate(월 Tag)
 * 배준배 2006.09.21
 */
InputTimeAtom.prototype._handleOnBlurMonthEdit = function (heEdit, heMonth)
{
	this._hideElement(heEdit);

	// 날짜의 유효성을 체크한다 
	if (false == this._isVaildMonth(heEdit.value))
	{
		return;
	}

	var strMonth = Utils.makeValidCiphers(2, heEdit.value);

	this._handleResult(this._getFrontYear() + this._getYearDate() + strMonth + this._getDayDate());
}

/**
 * Edit를 통해서 수정된 날짜는 유효성을 체크한후 갱신한다. 
 * @param heEdit(일 Edit), heDate(일 Tag)
 * 배준배 2006.09.21
 */
InputTimeAtom.prototype._handleOnBlurDayEdit = function (heEdit, heDay)
{
	this._hideElement(heEdit);
	// 날짜의 유효성을 체크한다
	if (false == this._isValidDay(this._getFrontYear() + this._getYearDate(), 
		parseFloat(this._makeEnglishToNumber(this._getMonthDate())), parseFloat(heEdit.value)))
	{
		return;
	}

	var strDay = Utils.makeValidCiphers(2, heEdit.value);

	this._handleResult(this._getFrontYear() + this._getYearDate() + this._makeEnglishToNumber(this._getMonthDate()) + strDay);
}

/**
 * 해당 날짜 Tag에 대해 값을 설정한다. 
 * @param heDate(Tag, input Tag제외) strValue
 * 배준배 2009. 09. 22
 */
InputTimeAtom.prototype._setElementData = function (heDate, strValue)
{
	if (null == heDate)
	{
		return;
	}
	
	CrossBrowsing.setInnerText(heDate, strValue);
}

/**
 * 해당 날짜 Tag에 대한 값을 가져온다. 
 * @param heDate (Tag, input Tag제외)
 * @return heDate.innerText;
 */
InputTimeAtom.prototype._getElementData = function (heDate)
{
	if (null == heDate)
	{
		return null;
	}

	return CrossBrowsing.getInnerText(heDate);
}

/**
 * 수정되고 있는 날짜가 기간 타입의 두번째 날짜 데이터 인지 아닌지를 
 * 판별하여, 수정되고 있는 날짜 부분의 Data를 반환한다. 
 * @return strDate
 * 배준배 2006. 09. 27
 */
InputTimeAtom.prototype._getSelectedDate = function () 
{
	var strSelectedDate = this._getTodayYear() + this._getTodayMonth() + this._getTodayDate();

	if (null != this.m_strDBTypeDate && 0 != this.m_strDBTypeDate.length)
	{
		var strFormValue = this.m_strDBTypeDate.substr(0, 8);
		var strToValue = this.m_strDBTypeDate.substr(8, 16);

		if (this.m_bSelectedRange)
		{
			strSelectedDate =  strToValue;
		}
		else
		{
			strSelectedDate = strFormValue;
		}
	}

	return strSelectedDate
}

/**
 * 년도 의 유효성을 체크한다. 
 * @param strYear
 * @return boolaen
 * 배준배 2006.09.21
 */
InputTimeAtom.prototype._isVaildYear = function(heEdit, nYear)
{	
	if ("0" == this.m_strYearType)
	{
		if (InputTimeAtom.REGULAREXPRESSION_NUMBER.test(nYear))
		{
			return true;
		}
	}
	else
	{
		if (InputTimeAtom.REGULAREXPRESSION_NUMBER.test(nYear) && 
			2 >= nYear.toString().length)
		{
			return true;
		}
	}
	
	return false;
}

/**
 * 월 의 유효성을 체크한다. 
 * @param str nMonth
 * @return boolaen
 */
InputTimeAtom.prototype._isVaildMonth = function (strMonth)
{		
	if ((3 > strMonth.length && 0 < strMonth.length) && 
		(0 < parseFloat(strMonth) && 13 > parseFloat(strMonth)))
	{
		return true;
	}

	return false;
}

/**
 * 년도 의 유효성을 체크한다. 
 * @param nYear, nMonth, nDay
 * @return boolaen
 * 배준배 2006.09.21
 */
InputTimeAtom.prototype._isValidDay = function (nYear, nMonth, nDay)
{
	var arMonthLengthList = new Array(31, 28, 31, 30, 31, 30, 31, 
										31, 30, 31, 30, 31);
	if (Utils.isLeapyear(nYear))
	{
		arMonthLengthList[1] += 1;
	}
	// TODO : 영문 달일경우 날짜 체크가 안된다.. 리뷰하면서 아이디어.. 
	if (0 < nDay && arMonthLengthList[nMonth - 1] >= nDay)
	{
		return true;
	}

	return false;
}

/**
 * 영문 달 인가??
 * @return boolean
 * 배준배 2006. 09. 22
 */
InputTimeAtom.prototype._isThisMonthTypeInEnglish = function ()
{
	if ("4" == this.m_strMonthType || "5" == this.m_strMonthType)
	{
		return true;
	}

	return false;
}

InputTimeAtom.prototype._hideElement = function (heElement)
{
	if (null == heElement)
	{
		return;
	}
	heElement.style.visibility = "hidden";
}

InputTimeAtom.prototype._showElement = function (heElement)
{
	if (null == heElement)
	{
		return;
	}
	
	this.m_heAtomTable.style.display ="block";
	this.m_heAtomTable.style.visibility ="visible";
	
	heElement.style.visibility = "visible";
}

InputTimeAtom.prototype.setVisibility = function (bVisible)
{
	if (bVisible)
	{
		heAtom.style.visibility = "visible";
		heAtom.style.display = "block";
	}
	else
	{
		heAtom.style.visibility = "hidden";
		heAtom.style.display = "none";
	}
}

/**
 * String형 날짜 데이터를 Array(년도, 월, 일)로 만든다.
 * @param strValue
 * @return arValue
 * 배준배 2006. 09. 17
 */
InputTimeAtom.prototype._getValueToArray = function (strValue)
{
	var arValue = new Array();

	//날짜에 아무것도 안들어 있을경우 (DB에 값이 없을경우)
	if (null == strValue || 0 == strValue.length)
	{
		if (this.m_bNotUseDefaultDate)
		{
			arValue[0] = "";
			arValue[1] = "";
			arValue[2] = "";
			if (this.m_bRange)
			{
				arValue[3] = "";
				arValue[4] = "";
				arValue[5] = "";
			}
			
			return arValue;
		}
		
		var objToday = new Date();
		var objYear = CrossBrowsing.getYear(objToday).toString();
		var objMonth = Utils.makeValidCiphers(2,(objToday.getMonth() + 1).toString());
		var objDate = Utils.makeValidCiphers(2,(objToday.getDate()).toString());
					
		strValue = objYear + objMonth + objDate;
	}
	
	arValue[0] = strValue.substr(0, 4);
	arValue[1] = strValue.substr(4, 2);
	arValue[1] = ((null == arValue[1] || 0 == arValue[1].length) ? this._getTodayMonth() : arValue[1]);
	arValue[2] = strValue.substr(6, 2);
	arValue[2] = ((null == arValue[2] || 0 == arValue[2].length) ? "01" : arValue[2]);
	
	if (this.m_bRange || 8 < strValue.length)
	{
		arValue[3] = strValue.substr(8, 4);
		arValue[3] = ((null == arValue[3] || 0 == arValue[3].length) ? this._getTodayYear() : arValue[3]);
		arValue[4] = strValue.substr(12, 2);
		arValue[4] = ((null == arValue[4] || 0 == arValue[4].length) ? this._getTodayMonth() : arValue[4]);
		arValue[5] = strValue.substr(14, 2);
		arValue[5] = ((null == arValue[5] || 0 == arValue[5].length) ? this._getTodayDate() : arValue[5]);
	}
	
	//날짜 형식이 월일 일때 strValue이 년월일이 아니라 월일 만 가져올경우 처리(스크립트로 월일 만 잘라서 처리하는 경우)
	if (this.m_strDataTypeOrigin == "2$3" && 4 == strValue.length)
	{
		arValue[1] = strValue.substr(0, 2);
		arValue[1] = ((null == arValue[1] || 0 == arValue[1].length) ? this._getTodayMonth() : arValue[1]);
		arValue[2] = strValue.substr(2, 2);
		arValue[2] = ((null == arValue[2] || 0 == arValue[2].length) ? "01" : arValue[2]);
	}

	return arValue;
}

InputTimeAtom.prototype._setDateValue = function (arValue)
{
	var nLen = this.m_arDateType.length

	for (var i = 0; i < nLen; i++)
	{
		var strDateType = this.m_arDateType[i];
		
		if (false == this.m_bRange || (this.m_bRange && (i < (this.m_arDateType.length / 2))))
		{
			// Range 타입이 아니거나, Range 타입이면서, 앞쪽인 부분
			if (this._isYear(strDateType))
			{
				this._setElementData(this.m_heAtomYear, this._getYearForDisplay(arValue[0], strDateType));
			}
			else if (this._isMonth(strDateType))
			{								
				this._setElementData(this.m_heAtomMonth, this._getMonthForDisplay(arValue[1], strDateType));
			}
			else if (this._isDate(strDateType))
			{
				this._setElementData(this.m_heAtomDay, arValue[2]);
			}
		}
		else 
		{
			//Range 타입이면서, 앞쪽인 부분
			if (this._isYear(strDateType))
			{
				this._setElementData(this.m_heAtomYearRange, this._getYearForDisplay(arValue[3], strDateType));
			}
			else if (this._isMonth(strDateType))
			{
				this._setElementData(this.m_heAtomMonthRange, this._getMonthForDisplay(arValue[4], strDateType));
			}
			else if (this._isDate(strDateType))
			{
				this._setElementData(this.m_heAtomDayRange, arValue[5]);
			}
		}
	}
}

/**
 * '부타''까지''~' 등을 붙인다. 
 * 배준배 2006.09.18
 */
InputTimeAtom.prototype._initRangeFormat = function ()
{
	if (false == this.m_bRange)
	{
		return;
	}

	var strFrom = (0 == this.m_nRangeType) ? "부터  " : " ~ ";
	var strTo = (0 == this.m_nRangeType) ? "까지" : "";

	for (var i = 0; i < 2; i++)
	{
		var strFormatType = this._getFormatTypeBeforeRange(i);

		var heDateFormat = this._getDateFormat(strFormatType, i);
		heDateFormat.noWrap=true;
		
		if (i == 0)
		{	
			CrossBrowsing.setInnerText(heDateFormat, CrossBrowsing.getInnerText(heDateFormat) + strFrom);
		}
		else
		{
			CrossBrowsing.setInnerText(heDateFormat, CrossBrowsing.getInnerText(heDateFormat) + strTo);
		}
	}
}

/**
 * Range 포멧(부터, 까지)등이 붙는 경우 위치상 Range 포멧이 붙기 바로 전의 날짜 포멧 타입을 가져온다. \
 * @param nIndex 
 * @return strForamtType
 * 배준배 
 */
InputTimeAtom.prototype._getFormatTypeBeforeRange = function (nIndex)
{
	if (0 == nIndex)
	{
		return this.m_arDateType[this.m_arDateType.length / 2 - 1];
	}
	else
	{
		return this.m_arDateType[this.m_arDateType.length - 1];
	}
}

InputTimeAtom.prototype._getDateFormat = function (strFormatType, nIndex)
{
	switch (strFormatType)
	{
		case "0" /*4자리 년도 */ :
		case "1" /*2자리 년도 */ : if (0 == nIndex) {return this.m_heAtomYearFormat} 
								   else {return this.m_heAtomYearRangeFormat};
		case "2" /* 2자리 월  */ : 
		case "4" /* 영문 월   */ :
		case "5" /* 영문 월   */ : if (0 == nIndex) {return this.m_heAtomMonthFormat} 
								   else {return this.m_heAtomMonthRangeFormat};
		case "3" /*    일     */ : if (0 == nIndex) {return this.m_heAtomDayFormat} 
								   else {return this.m_heAtomDayRangeFormat};
	}
}

/**
 * 날짜의 포멧(년, 월, 일, / 등..)을 초기화 한다. 
 * 배준배 2006. 09. 17
 */
InputTimeAtom.prototype._initDateFormat = function ()
{
	for (var i = 0; i < this.m_arDateType.length; i++)
	{
		var bRangeDate = this.m_bRange && (i >= (this.m_arDateType.length / 2));
		var strDateFormat = this._getFormatChar(i, bRangeDate);

		// 공백을 추가 한다. 
		if (strDateFormat == "/" || strDateFormat == "-")
		{
			strDateFormat = " " + strDateFormat;
		}

		switch (this.m_arDateType[i])
		{
			case "0" /*4자리년도*/  : 
			case "1" /*2자리년도*/  : 
			{
				this._setYearFormat(strDateFormat, this.m_arDateType[i], bRangeDate); 
				break;
			}
			case "2" /* 숫자 월 */  :
			case "4" /* 영문 월 */  :
			case "5" /* 영문월(약)*/:
			{
				this._setMonthFormat(strDateFormat, this.m_arDateType[i], bRangeDate);
				break;
			}
			case "3" /*    일   */  :
			{
				this._setDayFormat(strDateFormat, bRangeDate);
				break;
			}
		}
	}
}

/**
 * 년,월,일 포멧에 해당하는 구분 문자를 리턴한다.
 */
InputTimeAtom.prototype._getFormatChar = function (nCount, bRangeDate)
{
	var chFirst = this.m_strDateFormat.charAt(0);
	
	if (0 <= this.m_strDateFormat.indexOf("Mon"))
	{
		var nTempCount = -1;
		
		for (var i = 0; i < this.m_strDateFormat.length; i++)
		{
			var chTemp = this.m_strDateFormat.charAt(i);
			
			if ("M" == chTemp)
			{
				if ("Month" == this.m_strDateFormat.substring(i, i+5))
				{
					i += 4;
				}
				else
				{
					i += 2;
				}
			}
			else if ("Y" != chTemp && "M" != chTemp && "D" != chTemp)
			{
				nTempCount++;
				
				var chNext = this.m_strDateFormat.charAt(i + 1);
				if (' ' == chNext)
				{
					i += 1;
				}
				else if ('~' == chNext)
				{
					i += 2;
				}
				
				if (nTempCount == nCount)
				{
					return chTemp;
				}
			}
		}
		return "";
	}
	else if ("Y" == chFirst || "M" == chFirst || "D" == chFirst)
	{
		var nTempCount = -1;
		
		for (var i = 1; i < this.m_strDateFormat.length; i++)
		{
			var chTemp = this.m_strDateFormat.charAt(i);
			if (" " == chTemp)
			{
				nTempCount++;
				i += 2;
				
				if (nTempCount == nCount)
				{
					return "";
				}
			}
			else if ("Y" != chTemp && "M" != chTemp && "D" != chTemp)
			{
				nTempCount++;
				
				if (nTempCount == nCount)
				{
					return chTemp;
				}
			}
		}
		return "";
	}
	else
	{
		if (bRangeDate)
		{
			nCount += 3;
		}
		return this.m_strDateFormat.charAt(nCount);
	}
}

/**
 * 년도 표현 형식이 2자리 일 경우 앞의 두자리를 DB용 데이터에서 가져온다. 
 * @return strFrontYear
 * 배준배 
 */
InputTimeAtom.prototype._getFrontYear = function ()
{
	var strFrontYear = "";
	
	if ("1" == this.m_strYearType)
	{
		if (this.m_bRange)
		{
			strFrontYear = this.m_strDBTypeDate.substring(8, 10);
		}
		else
		{
			strFrontYear = this.m_strDBTypeDate.substring(0, 2);
		}
	}
	
	return strFrontYear;
}

InputTimeAtom.prototype._getYearDate = function ()
{
	var strYearDate = null;

	if (this.m_bSelectedRange)
	{
		strYearDate = this._getElementData(this.m_heAtomYearRange);
		
		if (Utils.isEmpty(strYearDate))
		{
			strYearDate = this.m_strDBTypeDate.substring(8, 4);
		}
	}
	else
	{
		strYearDate = this._getElementData(this.m_heAtomYear);
		
		if (Utils.isEmpty(strYearDate))
		{
			strYearDate = this.m_strDBTypeDate.substring(0, 4);
		}
	}
	
	if (1 == this.m_nYearKind)
	{
		strYearDate = this._makeChristianEra(strYearDate);
	}
	
	return strYearDate;
}

InputTimeAtom.prototype._getMonthDate = function ()
{
	var strMonth = null;

	if (this.m_bSelectedRange)
	{
		strMonth = this._getElementData(this.m_heAtomMonthRange);
	}
	else
	{
		strMonth = this._getElementData(this.m_heAtomMonth);
	}

	return Utils.isEmpty(strMonth) ? this._getDefaultMonth() : strMonth;
}

/**
 * 월 날짜 값이 null 인경우(EX : YYDD 또는 YY)기본 날짜 값을 만든다.
 * @return strDefaultMonth
 * 배준배
 */
InputTimeAtom.prototype._getDefaultMonth = function ()
{
	if (this.m_bSelectedRange)
	{
		return this.m_strDBTypeDate.substring(4, 6);
	}

	return this.m_strDBTypeDate.substring(12, 14);
}

InputTimeAtom.prototype._getDayDate = function ()
{
	var strDay = null;

	if (this.m_bSelectedRange)
	{
		strDay = this._getElementData(this.m_heAtomDayRange);
	}
	else
	{
		strDay = this._getElementData(this.m_heAtomDay);
	}

	return Utils.isEmpty(strDay) ? this._getDefaultDay() : strDay;
}

/**
 * 일 날짜 값이 null 인경우(EX : MMYY 또는 YY)기본 날짜 값을 만든다.
 * @return strDefaultMonth
 * 배준배
 */
InputTimeAtom.prototype._getDefaultDay = function ()
{
	if (this.m_bSelectedRange)
	{
		return this.m_strDBTypeDate.substring(6, 8);
	}

	return this.m_strDBTypeDate.substring(14);
}

/**
 * 서기를 단기로 바꾼다. 
 * @return strDangunEra
 * 배준배
 */
InputTimeAtom.prototype._makeDangunEra = function (strChristianEra)
{
	return (parseFloat(strChristianEra) + 2333).toString();
}

/**
 * 단기를 서기로 바꾼다. 
 * @return strChristianEra
 * 배준배
 */
InputTimeAtom.prototype._makeChristianEra = function (strDangunEra)
{
	return (parseFloat(strDangunEra) - 2333).toString();
}

///////// 날짜 포멧 설정하기 ////////////
/**
 * 년도에 대한 날짜 포멧을 붙인다.
 * @ param strFormat, strCode(날짜 종류)
 * 배준배 2006.09.17
 */
InputTimeAtom.prototype._setYearFormat = function (strFormat, strCode, bRangeDate)
{
	if (bRangeDate)
	{
		this._setElementData(this.m_heAtomYearRangeFormat, strFormat);
	}
	else
	{
		this._setElementData(this.m_heAtomYearFormat, strFormat);
	}
}

/**
 * 월에 대한 날짜 포멧을 붙입니다. 
 * @ param strFormat
 * 배준배 2006. 09. 17
 */
InputTimeAtom.prototype._setMonthFormat = function (strFormat, strCode, bRangeDate)
{
	if (bRangeDate)
	{
		this._setElementData(this.m_heAtomMonthRangeFormat, strFormat);
	}
	else
	{
		this._setElementData(this.m_heAtomMonthFormat, strFormat);
	}
}

/**
 * 일에 대한 날짜 포멧을 붙입니다.
 * @ param strFormat
 * 배준배 2006. 09. 17
 */
InputTimeAtom.prototype._setDayFormat = function (strFormat, bRangeDate)
{
	if (bRangeDate)
	{
		this._setElementData(this.m_heAtomDayRangeFormat, strFormat);
	}
	else
	{
		this._setElementData(this.m_heAtomDayFormat, strFormat);
	}
}

/**
 * Range인경우 확장된 멤버 HTML를 설정한다. 
 * 배준배 2006. 09. 17
 */
InputTimeAtom.prototype._initRange = function ()
{
	if (false == this.m_bRange)
	{
		return;
	}

	this.m_heAtomYearRange = document.getElementById(InputTimeAtom.DEFAULT_ID + "YEAR_RANGE_" + this.m_strVarName);
	this.m_heAtomMonthRange = document.getElementById(InputTimeAtom.DEFAULT_ID + "MONTH_RANGE_" + this.m_strVarName);
	this.m_heAtomDayRange = document.getElementById(InputTimeAtom.DEFAULT_ID + "DAY_RANGE_" + this.m_strVarName);
		
	// 날짜 Range 포멧(년, 월, 일, - 등)
	this.m_heAtomYearRangeFormat = document.getElementById(InputTimeAtom.DEFAULT_ID + "YEAR_RANGE_FORMAT_" + this.m_strVarName);
	this.m_heAtomMonthRangeFormat = document.getElementById(InputTimeAtom.DEFAULT_ID + "MONTH_RANGE_FORMAT_" + this.m_strVarName);
	this.m_heAtomDayRangeFormat = document.getElementById(InputTimeAtom.DEFAULT_ID + "DAY_RANGE_FORMAT_" + this.m_strVarName);
	
	// 날짜 Range Edit박스
	this.m_heAtomYearRangeEdit = document.getElementById(InputTimeAtom.DEFAULT_ID + "YEAR_RANGE_EDIT_" + this.m_strVarName);
	this.m_heAtomMonthRangeEdit = document.getElementById(InputTimeAtom.DEFAULT_ID + "MONTH_RANGE_EDIT_" + this.m_strVarName);
	this.m_heAtomDayRangeEdit = document.getElementById(InputTimeAtom.DEFAULT_ID + "DAY_RANGE_EDIT_" + this.m_strVarName);
}

/**
 * 오늘 날짜 데이터를 가져온다
 * 배준배 2006. 09. 16
 */
InputTimeAtom.prototype._getTodayYear = function ()
{
	return CrossBrowsing.getYear(new Date()).toString();
}

InputTimeAtom.prototype._getTodayMonth = function ()
{
	var strMonth = (new Date().getMonth() + 1).toString();
	if (1 == strMonth.length)
	{
		strMonth = "0" + strMonth;
	}
	
	return strMonth;
}

InputTimeAtom.prototype._getTodayDate = function ()
{
	var strDate = new Date().getDate().toString();
	if (1 == strDate.length)
	{
		strDate = "0" + strDate;
	}
	
	return strDate;
}

InputTimeAtom.prototype._getFormattedDateValue = function (arValue)
{
	var arDateType = this.m_arDateType;
	
	var yIndex = 0;
	var mIndex = 1;
	var dIndex = 2;
			
	var strFormatResult = "";
	var strFromResult = "";
	var strTmpResult = "";
	
	var nCnt = 0;
	var bYMD = false;
	var ch = this.m_strDateFormat.charAt(0);
	if (ch == 'Y' || ch == 'M' || ch == 'D')
	{
		bYMD = true;
	}
	
	var nLen = arDateType.length;
	for (var i = 0; i < nLen; i++)
	{
		var strDateType = arDateType[i];
		
		if (this._isYear(strDateType))
		{
			strTmpResult += this._getFormattedYear(arValue[yIndex], nCnt, strDateType);
		}
		else if (this._isMonth(strDateType))
		{
			strTmpResult += this._getFormattedMonth(arValue[mIndex], nCnt, strDateType);
		}
		else if (this._isDate(strDateType))
		{
			strTmpResult += this._getFormattedDate(arValue[dIndex], nCnt);
		}
		
		if (bYMD)
		{
			nCnt = strTmpResult.length;
		}
		else
		{
			nCnt ++;
		}
	}
	
	strFormatResult = strTmpResult;
	
	return strFormatResult;
}

/**
 * 년도 와 날짜 포멧을 연결한('2000년' 또는 '2001/' 등) 결과값을 돌려 준다. 
 * 수행조건의 Row인경우 하나의 스트링으로 날짜 전체를 나타낸다
 * @param strDateValue, nFormatIndex, strDateType
 * 배준배
 */
InputTimeAtom.prototype._getFormattedYear = function (strDateValue, nFormatIndex, strDateType)
{
	var strDateFormat = this.m_strDateFormat;
	
	var ch = strDateFormat.charAt(nFormatIndex);
	while (ch == 'Y')
	{
		ch = strDateFormat.charAt(++nFormatIndex);
	}
	
	if ("1" == strDateType)
	{
		return strDateValue.substr(2, 2) + ch;
	}
	else
	{
		return strDateValue + ch;
	}
}

/**
 * 월과 날짜 포멧을 연결한('12월' 또는 '12/' 등) 결과값을 돌려 준다. 
 * 수행조건의 Row인경우 하나의 스트링으로 날짜 전체를 나타낸다
 * @param strDateValue, nFormatIndex, strDateType
 * 배준배
 */
InputTimeAtom.prototype._getFormattedMonth = function (strDateValue, nFormatIndex, strDateType)
{
	var strDateFormat = this.m_strDateFormat;

	if ("2" != strDateType)
	{
		strDateValue = this._makeNumberToEnglish(strDateValue, strDateType);
	}
	
	var ch = strDateFormat.charAt(nFormatIndex);
	while (ch == 'M')
	{
		ch = strDateFormat.charAt(++nFormatIndex);
	}
	
	return strDateValue + ch;
}

/**
 * 일과 날짜 포멧을 연결한('21일' 또는 '21/' 등) 결과값을 돌려 준다. 
 * 수행조건의 Row인경우 하나의 스트링으로 날짜 전체를 나타낸다
 * @param strDateValue, nFormatIndex, strDateType
 * 배준배
 */
InputTimeAtom.prototype._getFormattedDate = function (strDateValue, nFormatIndex)
{
	var strDateFormat = this.m_strDateFormat;
	
	var ch = strDateFormat.charAt(nFormatIndex);
	while (ch == 'D')
	{
		ch = strDateFormat.charAt(++nFormatIndex);
	}
	
	return strDateValue + strDateFormat.charAt(nFormatIndex);
}

/**
 * DB에 저장뢸 원본 날짜 데이터를 갱신한다. 
 * @param arValue (날짜 데이터를 담은 Array)
 * 배준배 2006. 09. 17
 */
InputTimeAtom.prototype._updateDBTypeDate = function (arValue)
{
	var strValue = "";
	// 단기인 경우 2333년을 더해서 보여준다. 
	for (var i = 0; i < arValue.length; i++)
	{
		strValue += arValue[i];
	}
	
	this.m_strDBTypeDate = strValue;
}

InputTimeAtom.prototype._occurOnChangeEvent = function (nOccurEventType)
{
	if (this.m_strOldValue != this.m_strDBTypeDate)
	{
		this.m_strOldValue = this.m_strDBTypeDate;	
			this.onChange(nOccurEventType);
	}
}

/**
 * 화면에 보야야할 형식의 (두자리 숫자, 네자리 숫자)년도 형식으로바 꾼다
 * @param strDateValue, strDateType
 * @return strDateVlue (바꿔진 년도 형식)
 * 배준배 2006.09.21
 */
InputTimeAtom.prototype._getYearForDisplay = function (strDateValue, strDateType)
{
	// 단기인 경우 2333년을 더해서 보여준다. 
	if (1 == this.m_nYearKind)
	{
		strDateValue = this._makeDangunEra(strDateValue);
	}

	if ("1" == strDateType)
	{
		return strDateValue.substr(2, 2);
	}
	else
	{
		return strDateValue;
	}
}

/**
 * 화면에 보여야할 형식의(숫자, 영문, 영문 약자) 월 형식으로 바꾼다
 * @param strDateValue, strDateType
 * @return strDateValue (바꿔진 형식의 월)
 * 배준배 2006.09.21
 */
InputTimeAtom.prototype._getMonthForDisplay = function (strDateValue, strDateType)
{
	if ("2" != strDateType)
	{
		strDateValue = this._makeNumberToEnglish(strDateValue, strDateType);
	}
	
	return strDateValue;
}

/**
 * 년도, 월, 일의 데이터 타입을 식별한다. 
 * @param strDateType
 * 배준배 2006. 09. 17
 */
InputTimeAtom.prototype._isYear = function (strDateType)
{
	if ("0" == strDateType || "1" == strDateType)
	{
		return true;
	}
	
	return false;
}

InputTimeAtom.prototype._isMonth = function (strDateType)
{
	if ("2" == strDateType || "4" == strDateType || "5" == strDateType)
	{
		return true;
	}
	
	return false;
}

InputTimeAtom.prototype._isDate = function (strDateType)
{
	if ("3" == strDateType)
	{
		return true;
	}
	
	return false;
}

/**
 * 월의 날짜 타입에 따라 영문 화된 월을 넘겨준다. 
 * @param strMonth, strRect
 * 배준배 2006. 09. 17
 */
InputTimeAtom.prototype._makeNumberToEnglish = function (strMonth, strRect)
{
	var nMonth = parseFloat(strMonth);
	switch (nMonth)
	{
		case 1 : if ("4" == strRect) return "January"; else return "Jan"; 
		case 2 : if ("4" == strRect) return "February"; else return "Feb";
		case 3 : if ("4" == strRect) return "March"; else return "Mar"; 
		case 4 : if ("4" == strRect) return "April"; else return "Apr";
		case 5 : return "May";
		case 6 : if ("4" == strRect) return "June"; else return "Jun";
		case 7 : if ("4" == strRect) return "July"; else return "Jul";
		case 8 : if ("4" == strRect) return "August"; else return "Aug"; 
		case 9 : if ("4" == strRect) return "September"; else return "Sep";
		case 10 : if ("4" == strRect) return "October"; else return "Oct"; 
		case 11 : if ("4" == strRect) return "November"; else return "Nov";
		case 12 : if ("4" == strRect) return "December"; else return "Dec";
		//default : return null;
		default : return "";
	}
}

/**
 * 영문 월을 해당 숫자로 넘겨 준다 
 * @param strEngMonth
 * @return 
 * 배준배 2006. 09. 22
 */
InputTimeAtom.prototype._makeEnglishToNumber = function (strEngMonth)
{
	switch (strEngMonth)
	{
		case "January"   :
		case "Jan"       : return "01";
		case "February"  :
		case "Feb"       : return "02";
		case "March"     : 
		case "Mar"       : return "03";
		case "April"     :
		case "Apr"       : return "04";
		case "May"       : return "05";
		case "June"      : 
		case "Jun"       : return "06";
		case "July"      :
		case "Jul"       : return "07";
		case "August"    :
		case "Aug"       : return "08";
		case "September" : 
		case "Sep"       : return "09";
		case "October"   :
		case "Oct"       : return "10";
		case "November"  :
		case "Nov"       : return "11";
		case "December"  : 
		case "Dec"       : return "12";
		default : return strEngMonth;
	}
}

InputTimeAtom.prototype._setClickedButtonStyle = function (heButton)
{
	heButton.style.border = "solid 1px #8C8C8C";
}

InputTimeAtom.prototype._setUnClickedButtonStyle = function (heButton)
{
	heButton.style.border = "0";
}

//
// 여기서 부터 Element들의 포지션을 다시 정의 하는 것에 관한 메서드들 입니다. 
//

/**
 * Edit의 넓이를 다시 정의 한다. 
 * 수행조건의 날짜 타입인 경우 초기화 되기전 Element들은 크기도, 위치도 가지고 있지 않다
 * 배준배 
 */
InputTimeAtom.prototype._resizeEditBox = function ()
{
	if (null != this.m_heAtomYear)
	{
		this.m_heAtomYearEdit.style.pixelWidth = this.m_heAtomYear.offsetWidth;
	}
	if (null != this.m_heAtomMonth)
	{
		this.m_heAtomMonthEdit.style.pixelWidth = this.m_heAtomMonth.offsetWidth;
	}
	if (null != this.m_heAtomDay)
	{
		this.m_heAtomDayEdit.style.pixelWidth = this.m_heAtomDay.offsetWidth;
	}
}

/**
 * Builder의 논리를 기준으로 Element들의 Y좌표 들을 만들어 반환한다. 
 * @return nYPos (모든 Element들의 공통 Y좌표)
 */
InputTimeAtom.prototype._makeYPosition = function ()
{
	return (this.m_heAtom.style.pixelHeight - this.m_heAtomHeader.offsetHeight) / 4.0;
}

/**
 * 달력 버튼의 위치를 설정한다. 
 * 가장 마지막에 있는 Element의 오른쪽 끝 보다 1px를 더 간 위치이다.
 * 배준배 2006. 10. 19
 */
InputTimeAtom.prototype._setCalendarButtonPosition = function (nPreRightPos)
{
	this.m_heAtomCalendarButton.style.pixelLeft = nPreRightPos + 1;
}

/**
 * 년도에 관련된(년도, 년도포맷, 년도Edit)들의 X좌표를 설정하고, 
 * 년도 포맷의 오론쪽 좌표를 반환합니다.
 * (배치상 하나의 날짜에 관련된 요소중 가장 오른쪽에 위치하는 것이 포맷이다.)
 * @param nIndex(현재 쓰고 있는 요소의 실재 인덱스)
 * @param nXPos
 * @param nYPos
 * @return 년도 관련 Element의 위치를 설정 한 후 오른 쪽 끝 좌표를 반환합니다.
 */
 // 함수 이름  
InputTimeAtom.prototype._setYearPosition = function (nIndex, nXPos, nYPos)
{
	// 쓰이고 있는 요소의 인덱스가 0 이면, X좌표는 머릿말의 오론쪽 끝 좌표로 한다. 
	if (0 == nIndex)
	{
		this.m_heAtomYear.style.pixelLeft = this._getHeaderRight();
	}
	else
	{
		this.m_heAtomYear.style.pixelLeft = nXPos;
	}

	this.m_heAtomYear.style.pixelTop = nYPos;
	
	this._setYearEditPosition(nYPos);
	this._setYearFormatPosition(nYPos);

	return this._getYearRight();
}

/**
 * 년도 Edit의 X, Y좌표를 설정합니다. 
 * @param nYPos
 */
InputTimeAtom.prototype._setYearEditPosition = function (nYPos)
{
	this.m_heAtomYearEdit.style.pixelLeft = this.m_heAtomYear.style.pixelLeft;
	this.m_heAtomYearEdit.style.pixelTop = nYPos;
}

/**
 * 년도 포맷의 X, Y좌표를 설정합니다. 
 * @param nYPos
 * 배준배 2006. 10. 19
 */
InputTimeAtom.prototype._setYearFormatPosition = function (nYPos)
{
	this.m_heAtomYearFormat.style.pixelLeft = this.m_heAtomYearEdit.style.pixelLeft 
		+ this.m_heAtomYearEdit.style.pixelWidth;
	this.m_heAtomYearFormat.style.pixelTop = nYPos;
}

/**
 * 월에 관련된(년도, 년도포맷, 년도Edit)들의 X좌표를 설정하고, 
 * 월 포맷의 오론쪽 좌표를 반환합니다. 
 * (배치상 하나의 날짜에 관련된 요소중 가장 오른쪽에 위치하는 것이 포맷이다.)
 * @param nIndex(현재 쓰고 있는 요소의 실재 인덱스), nXPos , nYPos
 * @return 월 관련 Element의 위치를 설정 한 후 오른 쪽 끝 좌표를 반환합니다.
 */
InputTimeAtom.prototype._setMonthPosition = function (nIndex, nPreDateRight, nYPos)
{
	// 쓰이고 있는 요소의 인덱스가 0 이면, X좌표는 머릿말의 오론쪽 끝 좌표로 한다. 
	if (0 == nIndex)
	{
		this.m_heAtomMonth.style.pixelLeft = this._getHeaderRight();
	}
	else
	{
		this.m_heAtomMonth.style.pixelLeft = nPreDateRight;
	}
	this.m_heAtomMonth.style.pixelTop = nYPos;

	this._setMonthEditPosition(nYPos);
	this._setMonthFormatPosition(nYPos);

	return this._getMonthRight();
}

/**
 * 월 Edit의 X, Y좌표를 설정합니다. 
 * @param nYPos
 * 배준배 2006. 10. 19
 */
InputTimeAtom.prototype._setMonthEditPosition = function (nYPos)
{
	this.m_heAtomMonthEdit.style.pixelLeft = this.m_heAtomMonth.style.pixelLeft;
	this.m_heAtomMonthEdit.style.pixelTop = nYPos;
}

/**
 * 월 포맷의 X, Y좌표를 설정합니다. 
 * @param nYPos
 * 배준배 2006. 10. 19
 */
InputTimeAtom.prototype._setMonthFormatPosition = function (nYPos)
{
	this.m_heAtomMonthFormat.style.pixelLeft = this.m_heAtomMonthEdit.style.pixelLeft 
		+ this.m_heAtomMonthEdit.style.pixelWidth;

	this.m_heAtomMonthFormat.style.pixelTop = nYPos;
}

/**
 * 일에 관련된(년도, 년도포맷, 년도Edit)들의 X좌표를 설정하고, 
 * 일 포맷의 오론쪽 좌표를 반환합니다. 
 * (배치상 하나의 날짜에 관련된 요소중 가장 오른쪽에 위치하는 것이 포맷이다.)
 * @param nIndex(현재 쓰고 있는 요소의 실재 인덱스), nXPos , nYPos
	 * @return 일 관련 Element의 위치를 설정 한 후 오른 쪽 끝 좌표를 반환합니다.
 */
InputTimeAtom.prototype._setDayPosition = function (nIndex, nPreDateRight, nYPos)
{
	// 쓰이고 있는 요소의 인덱스가 0 이면, X좌표는 머릿말의 오론쪽 끝 좌표로 한다. 
	if (0 == nIndex)
	{
		this.m_heAtomDay.style.pixelLeft = this._getHeaderRight();
	}
	else
	{
		this.m_heAtomDay.style.pixelLeft = nPreDateRight;
	}
	
	this.m_heAtomDay.style.pixelTop = nYPos;

	this._setDayEditPosition(nYPos);
	this._setDayFormatPosition(nYPos);

	return this._getDayRight();
} 

/**
 * 일 Edit의 X, Y좌표를 설정합니다. 
 * @param nYPos
 * 배준배 2006. 10. 19
 */
InputTimeAtom.prototype._setDayEditPosition = function (nYPos)
{
	this.m_heAtomDayEdit.style.pixelLeft = this.m_heAtomDay.style.pixelLeft;
	this.m_heAtomDayEdit.style.pixelTop = nYPos;
}

/**
 * 일 포맷의 X, Y좌표를 설정합니다. 
 * @param nYPos
 * 배준배 2006. 10. 19
 */
InputTimeAtom.prototype._setDayFormatPosition = function (nYPos)
{
	this.m_heAtomDayFormat.style.pixelLeft = this.m_heAtomDayEdit.style.pixelLeft 
		+ this.m_heAtomDayEdit.style.pixelWidth;

	this.m_heAtomDayFormat.style.pixelTop = nYPos;
}

/**
 * 머릿말의 오른쪽 끝 좌표를 반환한다. 
 * @return nHeaderRight
 * 배준배 
 */
InputTimeAtom.prototype._getHeaderRight = function ()
{
	var nHeaderRight = this.m_heAtomHeader.style.pixelLeft + this.m_heAtomHeader.offsetWidth;

	// 머릿말이 있으면, 머릿말과 날짜 사이에 기본 간격을 넣는다. 
	if (0 < nHeaderRight)
	{
		nHeaderRight += InputTimeAtom.DEFAULT_INTERVAL;
	}
	return nHeaderRight;
}

/**
 * 년도의 오른쪽 끝 좌표를 반환한다. 
 * @return 
 * 배준배 
 */
InputTimeAtom.prototype._getYearRight = function ()
{
	return this.m_heAtomYear.style.pixelLeft + this.m_heAtomYearEdit.offsetWidth
		+  this.m_heAtomYearFormat.offsetWidth;
}

/**
 * 월의 오른쪽 끝 좌표를 반환한다. 
 * @return 
 * 배준배 
 */
InputTimeAtom.prototype._getMonthRight = function ()
{
	return this.m_heAtomMonth.style.pixelLeft + this.m_heAtomMonthEdit.offsetWidth
		+  this.m_heAtomMonthFormat.offsetWidth;
}

/**
 * 일의 오른쪽 끝 좌표를 반환한다. 
 * @return 
 * 배준배 
 */
InputTimeAtom.prototype._getDayRight = function ()
{
	return this.m_heAtomDay.style.pixelLeft + this.m_heAtomDayEdit.offsetWidth 
		+  this.m_heAtomDayFormat.offsetWidth;
}

/**
 * 날짜 사이의 간경을 구한다. 
 * Builder의 논리에 기준 하여 만든다. 
 * @return nBetweenWidth(날짜 사이 간격)
 */
InputTimeAtom.prototype._getBetweenWidth = function ()
{
	var nAtomWidth = this.m_heAtom.style.pixelWidth; // 아톰의 넓이
	
	var nAllDatesWidth = this._getDateEditWidth() + this._getDateFormatWidth(); // 모든 Edit와 Format의 넓이 합

	var nBetweenWidth = (nAtomWidth - (this.m_heAtomHeader.offsetWidth + nAllDatesWidth)) / this.m_arDateType.length;	

	// 각격이 음수가 되면, 기본값 10을 넘긴다. 
	if (0 > nBetweenWidth)
	{
		nBetweenWidth = InputTimeAtom.DEFAULT_INTERVAL;
	}

	return nBetweenWidth;
}

/**
 * 전체 날짜 수정 박스 들의 넓이의 합을 반환한다.
 * @param nEditsWidth
 * 배준배
 */
InputTimeAtom.prototype._getDateEditWidth = function ()
{
	var nEditsWidth = 0;

	if (null != this.m_heAtomYearEdit)
	{
		nEditsWidth += this.m_heAtomYearEdit.offsetWidth;
	}
	if (null != this.m_heAtomMonthEdit)
	{
		nEditsWidth += this.m_heAtomMonthEdit.offsetWidth;
	}
	if (null != this.m_heAtomDayEdit)
	{
		nEditsWidth += this.m_heAtomDayEdit.offsetWidth;
	}

	return nEditsWidth;
}

/**
 * 전체 날짜포멧 들의 넓이의 합을 반환한다.
 * @param nDatesWidth
 * 배준배
 */
InputTimeAtom.prototype._getDateFormatWidth = function ()
{
	var nDatesWidth = 0;
	
	if (null != this.m_heAtomYearFormat)
	{
		nDatesWidth += this.m_heAtomYearFormat.offsetWidth;
	}
	if (null != this.m_heAtomMonthFormat)
	{
		nDatesWidth += this.m_heAtomMonthFormat.offsetWidth;
	}
	if (null != this.m_heAtomDayFormat)
	{
		nDatesWidth += this.m_heAtomDayFormat.offsetWidth;
	}

	return nDatesWidth;
}

/**
 * 현재 선택된 아톰의 우측에 있는 아톰을 리턴
 */
InputTimeAtom.prototype._getNextTabAtom = function (heFrom)
{
	var nXFrom = heFrom.offsetLeft;
	var heNext = null;
	var nXNext = 999;
			
	if (null != this.m_heAtomYearEdit && this.m_heAtomYearEdit.offsetLeft > nXFrom && this.m_heAtomYearEdit.offsetLeft < nXNext)
	{
		heNext = this.m_heAtomYearEdit;
		nXNext = this.m_heAtomYearEdit.offsetLeft;
	}
	if (null != this.m_heAtomMonthEdit && this.m_heAtomMonthEdit.offsetLeft > nXFrom && this.m_heAtomMonthEdit.offsetLeft < nXNext)
	{
		heNext = this.m_heAtomMonthEdit;
		nXNext = this.m_heAtomMonthEdit.offsetLeft;
	}
	if (null != this.m_heAtomDayEdit && this.m_heAtomDayEdit.offsetLeft > nXFrom && this.m_heAtomDayEdit.offsetLeft < nXNext)
	{
		heNext = this.m_heAtomDayEdit;
		nXNext = this.m_heAtomDayEdit.offsetLeft;
	}
	if (null != this.m_heAtomYearRangeEdit && this.m_heAtomYearRangeEdit.offsetLeft > nXFrom && this.m_heAtomYearRangeEdit.offsetLeft < nXNext)
	{
		heNext = this.m_heAtomYearRangeEdit;
		nXNext = this.m_heAtomYearRangeEdit.offsetLeft;
	}
	if (null != this.m_heAtomMonthRangeEdit && this.m_heAtomMonthRangeEdit.offsetLeft > nXFrom && this.m_heAtomMonthRangeEdit.offsetLeft < nXNext)
	{
		heNext = this.m_heAtomMonthRangeEdit;
		nXNext = this.m_heAtomMonthRangeEdit.offsetLeft;
	}
	if (null != this.m_heAtomDayRangeEdit && this.m_heAtomDayRangeEdit.offsetLeft > nXFrom && this.m_heAtomDayRangeEdit.offsetLeft < nXNext)
	{
		heNext = this.m_heAtomDayRangeEdit;
		nXNext = this.m_heAtomDayRangeEdit.offsetLeft;
	}
	
	return heNext;
}

/**
 * 입력란 아톰의 위치에 해당하는, 텍스트 표시 div 아톰을 리턴한다.
 */
InputTimeAtom.prototype._getTextAtom = function(heAtomEdit)
{
	switch(heAtomEdit)
	{
		case this.m_heAtomYearEdit : return this.m_heAtomYear;
		case this.m_heAtomMonthEdit : return this.m_heAtomMonth;
		case this.m_heAtomDayEdit : return this.m_heAtomDay;
		case this.m_heAtomYearRangeEdit : return this.m_heAtomYearRange;
		case this.m_heAtomMonthRangeEdit : return this.m_heAtomMonthRange;
		case this.m_heAtomDayRangeEdit : return this.m_heAtomDayRange;
	}
}

InputTimeAtom.prototype._defaultKeyAction = function ()
	{
	if (!this.m_bDefaultKey)
	{
		return;
	}
	
		GlobalField.setServiceName("ModelAction");
		
	var xnRequest = MakeRequest.createRequestNode();
	
	MakeRequest.makeServiceRequest(xnRequest);
	MakeRequest.makeTouchAtomRequest(xnRequest);
	MakeRequest.makeDecoAtomRequest(xnRequest);
	MakeRequest.makeWebAtomRequest(xnRequest);
	
	var xnResultDoc = PQService.executeService(xnRequest.ownerDocument);
	
	HandleResult.execute(xnResultDoc);
	
	// 폼_검색완료(#지금)
	ScriptFormEvent.onEndSearch(ScriptEvent.SEARCH_END, ScriptEvent.SEARCH_SUCCEED);
}

//접근지정일경우 접근했을때 보여짐
InputTimeAtom.prototype._setFocusVisibility = function (bStatus)
{
	if (this.m_heAtomTable != null && false == IsNtoaModel())
	{
		if (bStatus || !this.m_bFocusVisible)
		{	
			this.m_heAtomTable.style.display ="block";
			this.m_heAtomTable.style.visibility ="visible";
		}
		else
		{
			this.m_heAtomTable.style.visibility ="hidden";
			this.m_heAtomTable.style.display ="none";
		}
	}
}

InputTimeAtom.prototype.getProperty = function (nNameID, arArgs, objRetVal)
{
	switch (nNameID)
	{
		case 0 : case 203 : return this.get_DateProperty (203, arArgs, objRetVal);
		case 20 :case 286 : return this.get_GdiProperty (286, arArgs, objRetVal);
		default : return StdCore.E_NOT_DEF_PROPERTY;
	}
}

InputTimeAtom.prototype.setProperty = function (nNameID, arArgs, objRetVal)
{
	switch (nNameID)
	{
		case 0 : case 203 : return this.set_DateProperty (203, arArgs, objRetVal);
		case 20 :case 286 : return this.set_GdiProperty (286, arArgs, objRetVal);
		default : return StdCore.E_NOT_DEF_PROPERTY;
	}
}

InputTimeAtom.prototype.action = function (nNameID, arArgs, objRetVal)
{
	switch (wPropID)
	{
		default : return this.getProperty (wPropID, arArgs, objRetVal);
	}
}

InputTimeAtom.prototype.get_DateProperty = function (nNameID, arArgs, objRetVal)
{
	switch (nNameID)
	{
		case 203 : // 값
			objRetVal.setValueType(CVariantX._vtString, this.getValue()); 
			break;
	}
}

InputTimeAtom.prototype.set_DateProperty = function (nNameID, arArgs, objValue)
{
	switch (nNameID)
	{
		case 203 : // 값
			this.setValue(objValue.toStringX());
			break; 
	}
}


////////////////////////////////////////////////////////////
// static field
InputTimeAtom.DEFAULT_ID = "__INPUTTIME_";

InputTimeAtom.YEAR_FORMAT = "YEAR_FORMAT";
InputTimeAtom.MONTH_FORMAT = "MONTH_FORMAT";
InputTimeAtom.DAY_FORMAT = "DAY_FORMAT";

InputTimeAtom.REGULAREXPRESSION_NUMBER = /([0-9])/;

InputTimeAtom.DEFAULT_INTERVAL = 5;

/**
 * 아톰리스트
 */
InputTimeAtom._atoms = new Object();

InputTimeAtom.init = function ()
{
	for (var strVarName in InputTimeAtom._atoms)
	{
		var objAtom = InputTimeAtom._atoms[strVarName];
		
		objAtom.init();
	}
}

InputTimeAtom.getAtom = function (strVarName, strScrollName, heAtom)
{
	if (null != strScrollName && 0 < strScrollName.length)
	{
		if (ContainsScrollAtom())
		{
			var objScrollAtom = ScrollAtom.getAtom(strScrollName);
			if (null != objScrollAtom)
			{
				var nRowIndex = objScrollAtom.getRowIndex(heAtom);
				if (0<= nRowIndex)
				{
					return objScrollAtom.getBindedAtom(strVarName, nRowIndex);
				}
			}
		}
	}
	else
	{
		return InputTimeAtom._atoms[strVarName];
	}
	
	return null;
}

/**
 * @return 기본검색키로 설정된 아톰배열
 */
InputTimeAtom.getDefaultKeyAtoms = function ()
{
	var arDefaultKeyAtoms = new Array();
	
	for (var strVarName in InputTimeAtom._atoms)
	{
		var objAtom = InputTimeAtom._atoms[strVarName];
		
		if (objAtom.isDefaultKey())
		{
			arDefaultKeyAtoms.push(objAtom);
		}
	}
	
	return arDefaultKeyAtoms;
}

InputTimeAtom.makeRequest = function (xnAtomRequest)
{
	for (var strVarName in InputTimeAtom._atoms)
	{
		var objAtom = InputTimeAtom._atoms[strVarName];
		
		objAtom.makeRequest(xnAtomRequest);
	}
}

InputTimeAtom.checkSureInput = function ()
{
	for (var strVarName in InputTimeAtom._atoms)
	{
		var objTimeAtom = InputTimeAtom._atoms[strVarName];
		if (objTimeAtom.isSureInput())
		{
			// throw SureInputException
			if (false == objTimeAtom.checkSureInput())
				return;
		}
	}
}
/**
 * 스크롤에 묶인경우 유효성을 체크 합니다. 
 */
InputTimeAtom.checkSureInputScroll = function ()
{
	for (var strVarName in InputTimeAtom._atoms)
	{
		var objTimeAtom = InputTimeAtom._atoms[strVarName];
		if (objTimeAtom.isSureInputScroll())
		{
			// throw SureInputException
			if (false == objTimeAtom.checkSureInputScroll())
				return;
		}
	}
}

InputTimeAtom.getAtomByDatabaseInfo = function (strTableName, strFieldName)
{
	for (var strVarName in InputTimeAtom._atoms)
	{
		var objAtom = InputTimeAtom._atoms[strVarName];
		if (strTableName == objAtom.getTableName() && strFieldName == objAtom.getFieldName())
		{
			return objAtom;
		}
	}
	
	return null;
}

InputTimeAtom.makeDefaultKeyRequest = function (xnAtomRequest)
{
	for (var strVarName in InputTimeAtom._atoms)
	{
		var objAtom = InputTimeAtom._atoms[strVarName];
		
		if (objAtom.isDefaultKey() && !objAtom.isScroll())
		{
			objAtom.makeRequest(xnAtomRequest);
		}
	}
}

InputTimeAtom.hasDefaultKey = function ()
{
	for (var strVarName in InputTimeAtom._atoms)
	{
		var objAtom = InputTimeAtom._atoms[strVarName];
		
		if (objAtom.isDefaultKey())
		{
			return true;
		}
	}
	
	return false;
}


////////////////////////////////////////////////////////////
// event handler

// <div> <=== 아톰
// <div>머릿말</div>
// <table><tbody><tr><td>달력버튼</td></tr></tbody></table>
// <nobr>
// <div>년도</div><input>년도 수정박스</input><div>년도 포멧</div>
// <div>월</div><input>월 수정박스</input><div>월 포멧</div>
// <div>일</div><input>일 수정박스</input><div>일 포멧</div>
// </nobr>
// </div>

/**
 * 날짜를 클릭한 경우 
 * @param strVarName, strScrollName, heDate(날짜(Div) Tag)
 * 배준배
 */
InputTimeAtom.onClickDate = function (strVarName, strScrollName, heDate, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	// 스크롤에 묶인 아톰인 경우, 날짜 테그(heDate)의 부모의 부모가 아톰이 되므로 
	// getAtom의 인자로 다음과 같이 넘긴다. 
	var objAtom = InputTimeAtom.getAtom (strVarName, strScrollName, heDate.parentNode.parentNode.parentNode.parentNode.parentNode);
	if (null != objAtom)
	{
		objAtom.onClickDate(heDate);
	}	

}

InputTimeAtom.onBlurEdit = function (strVarName, strScrollName, heEdit, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	// 스크롤에 묶인 아톰인 경우, 날짜 테그(heDate)의 부모의 부모가 아톰이 되므로 
	// getAtom의 인자로 다음과 같이 넘긴다. 
	var objAtom = InputTimeAtom.getAtom(strVarName, strScrollName, heEdit.parentNode.parentNode.parentNode.parentNode.parentNode);
	if (null != objAtom)
	{
		objAtom.onBlurEdit(heEdit, objEvent);
	}	

}

InputTimeAtom.onDblClick = function (strVarName, heEdit, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
		
	var objAtom = InputTimeAtom._atoms[strVarName];
	if (null != objAtom)
	{
		objAtom.onDblClick(objEvent);
	}
}

InputTimeAtom.onFocus = function (strVarName, strScrollName, heEdit, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	var objAtom = InputTimeAtom.getAtom (strVarName, strScrollName, heEdit.parentNode.parentNode.parentNode.parentNode.parentNode);
	if (null != objAtom)
	{
		objAtom.onFocus(heEdit, objEvent);
	}
}

InputTimeAtom.onChange = function (strVarName, heEdit, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	var objAtom = InputTimeAtom._atoms[strVarName];
	if (null != objAtom)
	{
		objAtom.onChange();
	}
}

InputTimeAtom.onKeyDown = function (strVarName, strScrollName, heEdit, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	var objAtom = InputTimeAtom.getAtom (strVarName, strScrollName, heEdit.parentNode.parentNode.parentNode.parentNode.parentNode);
	if (null != objAtom)
	{
		objAtom.onKeyDown(heEdit, objEvent);
	}
}

InputTimeAtom.onMouseDown = function (strVarName, strScrollName, heEdit, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	//var objAtom = InputTimeAtom._atoms[strVarName];
	var objAtom = InputTimeAtom.getAtom (strVarName, strScrollName, heEdit);
	if (null != objAtom)
	{	
		objAtom.onMouseDown();
	}
}

InputTimeAtom.onBlurNotEdit = function (strVarName, heEdit, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	var objAtom = InputTimeAtom._atoms[strVarName];
	if (null != objAtom)
	{
		objAtom.onBlurNotEdit();
	}
}

/**
 * 날짜입력란 전체의 연산식을 수행한다.
 */
InputTimeAtom.executeOperation = function ()
{
	for (var strVarName in InputTimeAtom._atoms)
	{
		var objAtom = InputTimeAtom._atoms[strVarName];
		
		if (null != objAtom && objAtom.isRelatedOperation())
		{
			PQOperation.execute(objAtom);
		}
	}
}

InputTimeAtom.setReadOnly = function (bReadOnly)
{
	for (var strVarName in InputTimeAtom._atoms)
	{
		InputTimeAtom._atoms[strVarName].setReadOnly(bReadOnly);
	}
}

function InputTimeCalendar ()
{
	this.m_objInputTimeAtom = null;
	this.m_heCalendar = document.getElementById("__INPUTTIME_CALENDARBUTTON_");
}

InputTimeCalendar.prototype.getHTML = function ()
{
	return this.m_heCalendar;
}

InputTimeCalendar.prototype.setAtom = function (objAtom)
{
	this.m_objInputTimeAtom = objAtom;
	
	var heDiv = objAtom.getHTML();
	this.m_heCalendar.style.top = (heDiv.offsetTop + heDiv.offsetHeight / 2 - 8) + "px"; 
	this.m_heCalendar.style.left = (heDiv.offsetLeft + heDiv.offsetWidth - 8) + "px";
}

InputTimeCalendar.prototype.setPosition = function (nTop, nLeft)
{
	this.m_heCalendar.style.top = nTop + "px";
	this.m_heCalendar.style.left = nLeft + "px";
}

InputTimeCalendar.prototype.onClickCalendarButton = function (heButton, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	// 스크롤에 묶인 아톰인 경우, 달력 버튼 테그(td)의 부모(tr)의 부모(tbody)의 부모(table)의 부모(div[heAtom])가 아톰이 되므로 
	// getAtom의 인자로 다음과 같이 넘긴다. 
	//var objAtom = InputTimeAtom.getAtom (strVarName, strScrollName, heButton.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode);
	if (null != this.m_objInputTimeAtom)
	{
		this.m_objInputTimeAtom.onClickCalendarButton(objEvent);
	}
}

InputTimeCalendar.prototype.onMousedownCalendarButton = function (heButton, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	// 스크롤에 묶인 아톰인 경우, 달력 버튼 테그(td)의 부모(tr)의 부모(tbody)의 부모(table)의 부모(div[heAtom])가 아톰이 되므로 
	// getAtom의 인자로 다음과 같이 넘긴다. 
	//var objAtom = InputTimeAtom.getAtom (strVarName, strScrollName, heButton.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode);
	if (null != this.m_objInputTimeAtom)
	{
		this.m_objInputTimeAtom.onMousedownCalendarButton(heButton);
	}
}

InputTimeCalendar.prototype.onBlurCalendarButton = function (heEdit, objEvent)
{
	//var objAtom = InputTimeAtom._atoms[strVarName];
	if (null != this.m_objInputTimeAtom)
	{
		this.m_objInputTimeAtom.onBlurCalendarButton();
	}
}
