/**
 * InputDataImageAtom JS 클래스 리스트
 * InputDataAtom
 * InputImageAtom
 */

/**
 * 입력란  Javascript 클래스 목록
 */
function InputDataAtom (strVarName, // 1
						nScriptIndex, // 2
						nSQLIndex,
						nDBIndex,
						bDBIO,
						strRefVarName, // 3
						strTableName, // 4
						strFieldName, // 5
						strFieldType, // 6
						nFieldLen, // 7
						bDefaultKey, // 8
						bSureInput, // 9
						bSureInputScroll, // 10
						strPrefix, // 11
						strDefaultValue, // 12
						bMaskSave, // 13
						strSuffix, // 14
						bInputNumber, // 15
						nCaseType, // 16
						bNotDisplayZero, // 17
						bInsertComma, // 18
						nMinNum, // 19
						nMaxNum, // 20
						strPeriod, // 21
						strProcessPeriod, // 22
						bScroll, // 23
						strScrollName, // 24
						bPopup, // 25
						strPopName, // 26
						strTabID, // 27
						strHelp, // 28
						bMultiLine, // 29
						bAcceptReturn, // 30
						bVanish, // 31
						bNotDefault, // 32
						bReadOnly, // 33
						bAutoLoad, // 34
						bAutoInc,
						bRelatedOperation, // 35
						bCanDefaultKeyActionAfterPopup, // 36
						strHyperLinkName, // 37
						objFont, // 38
						bAutoTab) // 39
{
	this.Atom (strVarName, strRefVarName, strScrollName, -1, nScriptIndex, nSQLIndex, nDBIndex, bVanish);
	
	this.m_strTableName			= strTableName;		// 테이블명
	this.m_strFieldName			= strFieldName;		// 필드명
	this.m_strFieldType			= strFieldType;		// 자료형태
	this.m_nFieldLen			= nFieldLen;		// 최대길이
	this.m_bDBIO				= bDBIO;
	this.m_bDefaultKey			= bDefaultKey;		// 기본검색키
	this.m_bSureInput			= bSureInput;		// 필수입력
	this.m_bSureInputScroll 	= bSureInputScroll; // 유효체크
	this.m_strPrefix			= strPrefix;		// 접두어
	this.m_strDefaultValue		= strDefaultValue;	// 기본값
	this.m_bMaskSave			= bMaskSave;		// 기호저장
	this.m_strSuffix			= strSuffix;		// 반복접미어
	this.m_bInputNumber			= bInputNumber;		// 숫자, char형 이라도, true 이면 실수형으로 취급한다.
	this.m_nCaseType			= nCaseType; 		// 대문자 : 0, 소문자 : 1, 구분안함 : -1
	this.m_bNotDisplayZero		= bNotDisplayZero;	// 0표시 안함
	this.m_bNotFloatDefault		= bNotDefault;		// 실수형 기본값 없음
	this.m_bInsertComma			= bInsertComma;		// 콤마삽입
	this.m_nMaxNum				= nMaxNum;			// 최대값
	this.m_nMinNum				= nMinNum;			// 최소값	
	this.m_strPeriod			= strPeriod;
	this.m_nPeriod				= 0;				// 소수자리수
	this.m_strProcessPeriod 	= strProcessPeriod;	// 반올림, 내림, 올림	
	this.m_bScroll				= bScroll;			// 스크롤에 묶여 있는지 여부
	this.m_bPopup				= bPopup;			// 팝업에 묶여 있는지 여부
	this.m_strPopName			= strPopName;		// 팝업 이름	
	this.m_strTabID				= strTabID;			// 탭뷰 ID
	this.m_strHelp				= strHelp;			// 도움말
 	this.m_bMultiLine			= bMultiLine;		// 다중라인
 	this.m_bAcceptReturn		= bAcceptReturn;	// 엔터키 적
 	this.m_bReadOnly			= bReadOnly;		// 읽기 전용
 	this.m_bAutoLoad			= bAutoLoad;		// 자동검색
 	this.m_bAutoInc				= bAutoInc;			// 자동증가
 	this.m_nAutoIncCount = 0;						// 첫번째 자동증가 필드에 대해서 keyTransaction 수행
 	this.m_bOperation			= true; 			// 연산식을 발생시킬것인가?
 	this.m_bRelatedOperation	= bRelatedOperation;// 이 아톰이 연산식으로 참조되는 아톰인가?
 	this.m_bCanDefaultKeyActionAfterPopup	= bCanDefaultKeyActionAfterPopup;	// 팝업 후에 기본검색키 동작 할 수 있는가
	this.m_strHyperLinkName = strHyperLinkName;	// 하이퍼링크 아톰이름
	this.m_objFont = objFont; // 입력란 폰트 정보
	this.m_bAutoTab = bAutoTab;
	
 	this.m_heAtom = document.getElementById(this.m_strVarName);
 	this.m_heAtomMenu = document.getElementById("__ADDITIONALMENU_" + this.m_strVarName); //입력란 부가기능
 	
 	this.m_strOldValue = ""; // onChange 이벤트를 강제로 발생시키기 위해 이전값을 저장합니다.
 	
 	this.m_strSaveType = "";
 	this.m_strValue = "";
 	
 	this.m_nRowIndex = -1;
 	
 	this.m_nCommaCount = 0;		// 콤마 삽입때문에 input의 길이가 변경되어야 할 경우 사용된다. -손영훈
 	this.m_nMinusDecimal = 0;	// '-' 마이너스, '.' 소수점은 필드 최대길이에 포함시키지기 위해 사용

 	this.m_bFormatMask = false;		// 기본값에 포맷 마스크가 지정된 입력란인지를 나타냄
 	this.m_strFormatValue = "";		// 포멧 마스크에서 구분기호만 나타낸 문자열
 	this.m_strPrevFormat = "";		// 포멧 마스크에서 키입력 이전의 문자열
 	this.m_nPrevCursorPos = 0;		// 포멧 마스크에서 key down후의 커서 위치
 	
 	this.bExecuteNotZero = false	// 0표시 안함을 처리했는지 여부
 	
 	this.m_nKeyDownKeyCode = 0;		// 한글입력시 keycode가 keydown에서만 다르게 들어옴
 	
 	if (null != strHyperLinkName && 0 < strHyperLinkName.length)
	{
		this.m_heAtom.style.cursor = "hand";
	}
}

InputDataAtom.prototype = new Atom ();
InputDataAtom.prototype.constructor = InputDataAtom;

InputDataAtom.prototype.clear = function ()
{
	this._setValue("");
	
	this.m_nAutoIncCount = 0;
}

// XmlAtomDefine에 설정된 아톰 타입 문자열을 리턴해야 한다.
InputDataAtom.prototype.getAtomType = function ()
{
	return "InputData";
}

InputDataAtom.prototype.getSaveType = function ()
{
	return this.m_strSaveType;
}
 	
/**
 * 아톰리스트에 추가
 */
InputDataAtom.prototype.putAtom = function ()
{
	InputDataAtom._atoms[this.m_strVarName] = this;
}

InputDataAtom.prototype.setRefVarName = function(strRefVarName)
{
	this.m_strRefVarName = strRefVarName;
}
 	
InputDataAtom.prototype.setSaveType = function (strSaveType)
{
	this.m_strSaveType = strSaveType;
}
 	
InputDataAtom.prototype.getRowIndex = function ()
{
	return this.m_nRowIndex;
}

InputDataAtom.prototype.setRowIndex = function (nIndex)
{
	this.m_nRowIndex = nIndex;
}
 	
InputDataAtom.prototype.isScroll = function ()
{
	return this.m_bScroll;
}

InputDataAtom.prototype.isPopup = function ()
{
	return this.m_bPopup;
}
 	
InputDataAtom.prototype.getHTML = function ()
{
	return this.m_heAtom;
}
 	
InputDataAtom.prototype.setHTML = function (heAtom)
{
	this.m_heAtom = heAtom;
}
 	
InputDataAtom.prototype.isSureInput = function ()
{
	return this.m_bSureInput;
}
 	
InputDataAtom.prototype.isSureInputScroll = function ()
{
	return this.m_bSureInputScroll;
}
 	
InputDataAtom.prototype.isDefaultKey = function ()
{
	return this.m_bDefaultKey;
}
 	
InputDataAtom.prototype.isAutoLoad = function ()
{
	return this.m_bAutoLoad;
}

InputDataAtom.prototype.isAutoInc = function ()
{
	return this.m_bAutoInc;
}

InputDataAtom.prototype.getAutoIncCount = function ()
{
	return this.m_nAutoIncCount;
}

InputDataAtom.prototype.addAutoIncCount = function ()
{
	this.m_nAutoIncCount += 1;
}

InputDataAtom.prototype.getTableName = function ()
{
	return this.m_strTableName;
}
 	
InputDataAtom.prototype.getFieldName = function ()
{
	return this.m_strFieldName;
}
 	
InputDataAtom.prototype.getPrefix = function ()
{
	return this.m_strPrefix;
}
 	
InputDataAtom.prototype.getFieldLen = function ()
{
	return this.m_nFieldLen;
}

InputDataAtom.prototype.setValue = function (strValue, nOccurEventType)
{
	this._setValue(strValue);
	this._occurOnChangeEvent(nOccurEventType);
}
 	
InputDataAtom.prototype.getValue = function ()
{
	this._saveEditToValue();
	return this._getUnFormatValue(this.m_strValue);
}

/**
 * @return 접두어가 포함된 입력란 값
 */
InputDataAtom.prototype.getValueWithPrefix = function ()
{
	return this.getPrefix() + this.getValue();
}

/**
* 화면에 아톰의 값을 포맷대로 출력한다.
*/
InputDataAtom.prototype.displayValue = function ()
{
	if (this.m_heAtom)
	{
		var strDisplayValue = "";
		
		if (this.m_strValue)
		{
			strDisplayValue = this.m_strValue;
		}
		else
		{
			if (!this.isScroll())
			{
				// 기본값
				var strDefaultValue = this._getDefaultValue();
				
//				if (this.m_bMaskSave)
//				{
//					// 사용자 정의 DisPlay Type 일때 마스크포맷형태를 보여주지 않는다.
//					strDefaultValue = "";
//				}
	
				strDisplayValue = strDefaultValue;
			}
		}
		
		this.m_heAtom.value = strDisplayValue;
	}
}
 	
InputDataAtom.prototype.setIsOperation = function (bOperation)
{
	this.m_bOperation = bOperation;
}
 	
InputDataAtom.prototype.isOperation = function ()
{
	return this.m_bOperation;
}
 	
InputDataAtom.prototype.isCharFieldType = function ()
{
	return "char" == this.m_strFieldType;
}

InputDataAtom.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;
}

/**
 * 커서 포커스를 가질수 있는지 여부
 */
InputDataAtom.prototype.isFocusable = function ()
{
	if (null == this.m_heAtom || 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();
}

InputDataAtom.prototype.isRelatedOperation = function ()
{
	return this.m_bRelatedOperation;
}

/**
 * 객체 clone 메소드 입니다.
 * @param bIsHtml html 값을 설정할지 결정 
 */
InputDataAtom.prototype.clone = function (bIsHtml)
{
	var objNewAtom = new InputDataAtom(this.m_strVarName, this.m_nScriptIndex, this.m_nSqlIndex, this.m_nDBIndex, this.m_bDBIO, 
					this.m_strRefVarName, this.m_strTableName, this.m_strFieldName, this.m_strFieldType, this.m_nFieldLen, this.m_bDefaultKey,
					this.m_bSureInput, this.m_bSureInputScroll, this.m_strPrefix, this.m_strDefaultValue,
					this.m_bMaskSave, this.m_strSuffix, this.m_bInputNumber, this.m_nCaseType,
					this.m_bNotDisplayZero, this.m_bInsertComma, this.m_nMinNum, this.m_nMaxNum,
					this.m_strPeriod, this.m_strProcessPeriod, this.m_bScroll, this.m_strScrollName,
					this.m_bPopup, this.m_strPopName, this.m_strTabID, this.m_strHelp,
					this.m_bMultiLine, this.bAcceptReturn, this.m_bVanish, this.m_bNotFloatDefault,
					this.m_bReadOnly, this.m_bAutoLoad, this.m_bAutoInc, this.m_bRelatedOperation, this.m_bCanDefaultKeyActionAfterPopup,
					this.m_strHyperLinkName, this.m_objFont, this.m_bAutoTab)
					
	if (false != bIsHtml && null != this.m_heAtom)
	{
 		objNewAtom.setHTML(this.m_heAtom.cloneNode(true));
 	}
 	else
 	{
 		objNewAtom.setHTML(null);
 	}
 	
 	return objNewAtom;
}
	
InputDataAtom.prototype.init = function ()
{
	if (this.m_bReadOnly && null != this.m_heAtom)
	{
		// 읽기전용일 경우, 한글 입력 못하게 막음
		this.m_heAtom.style.imeMode = "disabled";
	}

	this.m_nPeriod = Utils.initPeriod(this.m_strPeriod);

	// 포맷마스크가 되기 위해서는 2글자 이상이 되어야 한다.
	// 예를 들어, 'A'나 '#'인 경우는 포맷마스크가 아니다.
	if (false == this.m_bFormatMask && null != this.m_strDefaultValue && 1 < this.m_strDefaultValue.length)
	{
		this._checkFormatMaskString(this.m_strDefaultValue);
	}
	
	// 스크롤에 묶여 있는 입력란은 무조건 ""을 입력합니다.
	if (this.isScroll())
	{
		this.m_strValue = "";
		
		this.displayValue();
	}
	else
	{
		this._setValue("");
	}
	
	this.setPopupScrollname();
	
	this.m_strOldValue = "";
}
	
InputDataAtom.prototype.setPopupScrollname = function ()
{
	if (this.m_bPopup && 0 < this.m_strPopName.length && 0 < this.m_strScrollName.length)
	{
		var objAtom = PopupAtom.getAtom(this.m_strPopName);
		
		if (null != objAtom)
		{
			objAtom.setScrollName(this.m_strScrollName);
		}
	}
}
	
/**
* 요청정보를 만든다.
* @param xnRequest
* @param isScroll 스크롤 아톰의 묶여있다면 true. 그 외에는 undefined
*/
InputDataAtom.prototype.makeRequest = function (xnRequest, isScroll)
{
	var strVarName = this.getVarName();
	var strValue = this.getValue();

	var xnAtom = XmlLib.createChild(xnRequest, "InputData");
	
	//저장속성을 설정함
	xnAtom.setAttribute("SaveType", this.m_strSaveType);
	
	xnAtom.setAttribute("VarName", strVarName);
	XmlLib.setTextValue(xnAtom, strValue);
			
	xnAtom.setAttribute("TableName", this.getTableName());
	xnAtom.setAttribute("FieldName", this.getFieldName());
	xnAtom.setAttribute("FieldType", this.m_strFieldType);
	xnAtom.setAttribute("TabId", this.m_strTabID);
	
	xnAtom.setAttribute("DefaultString", this.m_strDefaultValue);
	xnAtom.setAttribute("Prefix", this.m_strPrefix);
	xnAtom.setAttribute("IsDefaultKey", this.m_bDefaultKey ? "true" : "false");
	
	if (this._isRealNumberType())
	{
		xnAtom.setAttribute("PeriodInfo", this.m_nPeriod + ":" + this.m_strProcessPeriod);
	}
	
	if (this.m_bPopup)
	{
		// applet에서 자체정의 팝업 실행 시키기 위해 전달
		xnAtom.setAttribute("PopName", this.m_strPopName);
	}
}
	
/**
 * 필수입력속성체크, 
 * 필수입력인데 값이 없으면 예외발생(throw)후 ButtonAtom.js에서 catch
 */
InputDataAtom.prototype.checkSureInput = function ()
{
	var strValue = this.getValue();

	if (null == strValue || 0 == strValue.length)
	{
		if ((true == this.isScroll() && 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;
}

/**
 * 스크롤에 묶인 경우 유효행 체크를 합니다
 */
InputDataAtom.prototype.checkSureInputScroll = function ()
{
	if (this.getValue())
	{
		return true;
	}

	return false;
}

/**
 * 선택표시 (f9 기능)
 */
InputDataAtom.prototype.vanish = function ()
{
	if (this.m_bVanish && null != this.m_heAtom)
	{
		// 현재 감춤 상태이면 표시한다.
		if ("hidden" == this.m_heAtom.style.visibility)
		{
			this.m_heAtom.style.visibility = "visible";
		}
		else	// 표시된 상태이면 감춘다.
		{
			this.m_heAtom.style.visibility = "hidden";
		} 
	}
}

/**
 *	@return 팝업 후에 기본검색키 동작 할 수 있는지 여부
 */
InputDataAtom.prototype.canDefaultKeyActionAfterPopup = function ()
{
	return this.m_bCanDefaultKeyActionAfterPopup;
}

InputDataAtom.prototype.setReadOnly = function (bReadOnly)
{
	this.m_bReadOnly = bReadOnly;
	
	if (bReadOnly)
	{
		this.m_heAtom.readOnly = true;
	}
	else
	{
		this.m_heAtom.readOnly = false;
	}
}

/**
 * 인자로 받은 값만큼 top을 변경시킨다
 * 
 * @param nRepositionValue (top 변경 값)
 */
InputDataAtom.prototype.repositionYPos = function (nRepositionValue)
{
	var nTop = this.m_heAtom.offsetTop;
	
	this.m_heAtom.style.top = (nTop + nRepositionValue) + "px";
}

/**
 * 인자로 받은 값만큼 left를 변경시킨다
 * 
 * @param nRepositionValue (left 변경 값)
 */
InputDataAtom.prototype.repositionXPos = function (nRepositionValue)
{
	var nLeft = this.m_heAtom.offsetLeft;
	
	this.m_heAtom.style.left = (nLeft + nRepositionValue) + "px";
}
 	
 	
////////////////////////////////////////////////////////////
// event handler
	
/**
 * _누름 스크립트 -> 스크롤_누름 이벤트 발생
 */
InputDataAtom.prototype.onClick = function (heAtom, objEvent)
{
	//비활성화일 때는 이벤트 발생 안 함.
	if (!this._isDisabled())
	{
		var nCursorPos = HTMLLib.getCursorPosition(heAtom);

		if (-1 == ScriptAtomEvent.onClick(this.m_nScriptIndex))
		{
			objEvent.returnValue = false;
			return;
		}
		else
		{
			ScriptAtomEvent.onClickAfter(this.m_nScriptIndex);
		}
		
		if (this.isScroll())
		{
			if (ContainsScrollAtom())
			{
				ScrollOnClick(this.m_strScrollName, this.m_strVarName, this.m_heAtom, objEvent);
			}
		}
		
		HTMLLib.setCursorPosition(heAtom, nCursorPos);	
	}
	
	// 하이퍼링크 동작, 가장 마지막에 수행해야 합니다. 다른 동작 추가시 위로 추가하세요
	if (null != this.m_strHyperLinkName && 0 != this.m_strHyperLinkName.length && ContainsWebHyperDataAtom())
	{
		var objHyperLinkAtom = Model.getAtom(this.m_strHyperLinkName, this.m_strScrollName, this.m_heAtom);
		if (null != objHyperLinkAtom)
		{
			// 먼저 하이퍼 링크의 링크 동작을 제외한 onClick을 수행한다. (스크립트동작)
			if (-1 != objHyperLinkAtom.onLinkClick())
			{
				objHyperLinkAtom.connectLink(this.m_heAtom, this.m_strScrollName);
			}
		}
	}
}

/**
 *	팝업동작 이후 팝업에 묶인 아톰들 중 기본검색키가 있으면 기본검색키동작한다.
 */
InputDataAtom.prototype.defaultKeyActionAfterPopup = function ()
{
	var objPopupAtom = PopupAtom.getAtom(this.m_strPopName);
	var arBindedAtomVarName = objPopupAtom.getBindedAtomVarNames();
	var strScrollName = objPopupAtom.getScrollName();
	var heAtom = this.getHTML();
	
	for (var i = 0; i < arBindedAtomVarName.length; i += 1)
	{
		var objInputDataAtom = InputDataAtom.getAtom(arBindedAtomVarName[i], strScrollName, heAtom);
		
		if (null == objInputDataAtom)
		{
			continue;
		}
		
		var strValue = objInputDataAtom.getValue();
		
		if (objInputDataAtom.canDefaultKeyActionAfterPopup())
		{
			objInputDataAtom.defaultKeyAction();
			break;
		}
	}
}
	
/**
 * _두번누름 스크립트 -> onChangeEvent 발생 -> [_팝업동작 스크립트 -> 팝업 -> _탭이동 스크립트  -> _스크롤내이동 스크립트 ] 
 * -> 기본키 동작 -> 스크롤_두번누름 이벤트 발생
 */
InputDataAtom.prototype.onDblClick = function (heAtom, objEvent)
{
	//비활성화일 때는 이벤트 발생 안 함.
	if (this._isDisabled())
	{
		return;
	}
	
	this._occurOnChangeEvent();
	
	var bPopupReturn = false;
	
	if (this.m_bPopup && !IsTrialModel())
	{
		bPopupReturn = PopupOnDblClick(this.m_strPopName, this.m_strScrollName, this, objEvent);
		
		// 팝업에서 사용자가 취소를 눌렀을 때 탭이동, 스크롤내이동 없음
		if (bPopupReturn)
		{
			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.defaultKeyActionAfterPopup();
		}
	}
	else
	{
		if (this.isDefaultKey())
		{
			this.defaultKeyAction();
		}
	}
	
	if (this.isScroll())
	{
		ScrollOnDblClick(this.m_strScrollName, heAtom, objEvent);
	}
	
	this._moveTabByPopup(bPopupReturn);
}
	
/**
 * _초점얻음 스크립트 -> 스크롤_초점얻음 이벤트
 */
InputDataAtom.prototype.onFocus = function (heAtom, objEvent)
{
	if (this.m_bPopup)
	{
		if (ContainsPopupAtom())
		{
			PopupAtom.showEditBox(this.m_strPopName, this, this.m_strScrollName);
		}
	}
	
	if (-1 == ScriptAtomEvent.onFocus(this.m_nScriptIndex))
	{
		objEvent.returnValue = false;
		return false;
	}
	else
	{
		ScriptAtomEvent.onFocusAfter(this.m_nScriptIndex);
	}
	
	if (this.isScroll())
	{
		if (ContainsScrollAtom())
		{
			ScrollOnFocus(this.m_strScrollName, heAtom, objEvent);
		}
	}
}

/**
 * 입력란 기능 동작 -> _초점상실 스크립트 -> 스크롤_초점상실 이벤트
 */
InputDataAtom.prototype.onBlur = function (heAtom, objEvent)
{
	// "0채우기" 속성이 있을 경우 0채우기 기능을 수행한다.
	if("0채우기" == this.m_strDefaultValue)
	{
		this.setValue(this._getZeroValue(this.getValue()));
	}
	// 반복 접미어가 있을 경우, 값 뒤에 붙인다.
	this._appendSuffix();
	
	if (this._isNumericType() && !this.m_bNotDisplayZero)
	{
		this._setValue(this.getValue());
	}

	// 최대, 최소값 검사
	if (false == this._checkMinMaxValue())
	{
		heAtom.focus();
	}

	if (IsNtoaModel())
	{
		this._synchronizeNtoaMasterInfo();
	}
	
	this._occurOnChangeEvent();
	
	if (-1 == ScriptAtomEvent.onBlur(this.m_nScriptIndex))
	{
		objEvent.returnValue = false;
		return;
	}
	else
	{
		ScriptAtomEvent.onBlurAfter(this.m_nScriptIndex);
	}
	
	if (this.isScroll())
	{
		if (ContainsScrollAtom())
		{
			ScrollOnBlur(this.m_strScrollName, heAtom, objEvent);
		}
	}
}
	
InputDataAtom.prototype.onKeyPress = function (objEvent)
{
}

InputDataAtom.prototype.onKeyDown = function (heAtom, objEvent)
{
	// 키보드 입력 체크
	if (false == this._checkInputType(objEvent, heAtom))
	{
		return;
	}
	
	// 키값확인(문자, 문자코드) 이벤트 발생.
	//TODO 화살표 키 동작 제대로 안 되는 등 문제 발생함...
//	if (-1 != ScriptAtomEvent.onCheckKeyValue(this.m_nScriptIndex, objEvent))
//	{
//		ScriptAtomEvent.onCheckKeyValueAfter(this.m_nScriptIndex, objEvent);
//	}
	
	switch (objEvent.keyCode)
	{
		case 9: // Tab key
		{
			this._onTabKeyDown(heAtom, objEvent);
				
			break;
		}
		case 13: // Enter key
		{
			this._onEnterKeyDown(heAtom, objEvent);

			//버튼아톰에 그림 설정이 되어있을 경우 <input type=image>를 사용한다.
			//이 경우에 엔터키 이벤트가 이 태그까지 영향을 미치기 때문에 원치않는 onclick 이벤트가 발생한다.
			//따라서 입력란에서 엔터키 동작 후 이벤트를 취소시킨다.
			
			// 다중라인에 엔터키 적용 속성이 설정되었을 경우에는 취소시키지 않는다.
			if (false == this.m_bMultiLine || false == this.m_bAcceptReturn)
			{
				objEvent.returnValue = false;
			}
			break;
		}		
		case 68: case 73: // D, I key
		{
			if (objEvent.ctrlKey && this.isScroll())
			{
				ScrollAtom.onKeyDown(this.m_strScrollName, heAtom, objEvent); 
				objEvent.returnValue = false;
			}
			else
			{
				objEvent.returnValue = true;
			}
			return;
		}
	}
}

InputDataAtom.prototype.onKeyUp = function (objEvent)
{
	var nKeyCode = objEvent.keyCode;

	if (HTMLLib.isDirectionKeyDown(nKeyCode) || 9 == nKeyCode) 
	{
		return;
	}
	
	if (this.m_bFormatMask)
	{
		// 포멧 마스크 입력시 문자열 조정
		this._adjustFormatValue(objEvent);
	}
	else
	{
		// 숫자 입력시 필드길이 재정의
		this._changeFieldLength(objEvent.keyCode);
	}
	
	// 콤마 삽입
	if (this.m_bInsertComma && !this.m_bFormatMask)
	{		
		this._insertCommaProc(objEvent);
	}

	// 소수점 자리수 체크
	this._checkDecimalPoint(objEvent);

	// 대, 소문자 변경
	this._checkUpperLowerCase(this.m_nKeyDownKeyCode, this.m_heAtom);
	
	// 자동탭이동이고 필드길이와 현재 값의 길이와 같다면 탭이동 한다.
	if (this.m_bAutoTab && this.m_nFieldLen == this.m_heAtom.value.length)
	{
		var nType = TabOrderManager.ATOMKIND_INPUTDATA;
		if (this.isScroll())
		{
			nType = TabOrderManager.ATOMKIND_SCROLLINPUT;
		}
		g_objTabOrderManager.moveNextFocus(nType, this.m_strVarName, this.m_strScrollName, this.m_strTabID)
	}
}

InputDataAtom.prototype.onMouseDown = function (objEvent)
{
	if (2 == objEvent.button) // right button
	{
		this._openAddMenu(objEvent);
	}
}

InputDataAtom.prototype.onMouseOver = function ()
{
	// 하이퍼 링크가 있다면 하이퍼링크에 정의된 글꼴로 변경해줘야 한다.
	if (null != this.m_strHyperLinkName && 0 != this.m_strHyperLinkName.length && ContainsWebHyperDataAtom())
	{
		var objHyperLinkAtom = Model.getAtom(this.m_strHyperLinkName, this.m_strScrollName, this.m_heAtom);
		if (null != objHyperLinkAtom)
		{
			var objFont = objHyperLinkAtom.getFont();
			if (null != objFont)
			{
				this.changeFont(objFont);
			}
		}
	}
}

InputDataAtom.prototype.onMouseOut = function ()
{
	// 하이퍼링크에 묶여 있다면, 원래 글꼴로 돌아온다.
	if (null != this.m_strHyperLinkName && 0 != this.m_strHyperLinkName.length && ContainsWebHyperDataAtom())
	{
		this.changeFont(this.m_objFont);
	}
}

InputDataAtom.prototype.onPaste = function ()
{
	/**
	 * Ctrl + V로 최대자릿수보다 더 믾이 입력됬을때 최대 자릿수 이하는 짜른다.
	 */
	if(this.m_bMultiLine)
	{
		var nLengthLimit = this.m_nFieldLen + this.m_nCommaCount + this.m_nMinusDecimal;
		var nCurLength = this.m_heAtom.value.length
		
		var strPaste = window.clipboardData.getData("Text");
		
		if (null != strPaste)
		{
			if (nCurLength + strPaste.length > nLengthLimit)
			{
				strPaste = strPaste.substring(0, nLengthLimit - nCurLength);
				
				window.clipboardData.setData("Text", strPaste);
			}
		}
	}
}

InputDataAtom.prototype.changeFont = function (objFont)
{
	this.m_heAtom.style.fontFamily = objFont.getFontName();
	this.m_heAtom.style.fontSize = objFont.getFontSize() + "pt";
	this.m_heAtom.style.color = objFont.getFontColor();
	if (objFont.isBold())
	{
		this.m_heAtom.style.fontWeight = "bold";
	}
	else
	{
		this.m_heAtom.style.fontWeight = "normal";
	}
	
	if (objFont.isItalic())
	{
		this.m_heAtom.style.fontStyle = "italic";
	}
	else
	{
		this.m_heAtom.style.fontStyle = "normal";
	}
	
	if (objFont.isUnderLine())
	{
		this.m_heAtom.style.textDecoration = "underline";
	}
	else if (objFont.isStrikeOut())
	{
		this.m_heAtom.style.textDecoration = "line-through";
	}
	else
	{
		this.m_heAtom.style.textDecoration = "none";
	}
}

/*
* 값이 변경될 경우 실행
* @param nOccurEventType 이벤트 발생여부. null or 0: 이벤트 발생, 1: 이벤트 발생 안함, 2: 스크롤 행 수정만 동작
*/
InputDataAtom.prototype.onChange = function (nOccurEventType)
{
	if (Define.isOccurEvent(nOccurEventType))
	{
		if (this.isScroll() && ContainsScrollAtom())
		{
			var objScrollAtom = ScrollAtom.getAtom(this.m_strScrollName);
 			
 			// modifyRow에서 스크롤에 관련된 연산식이 수행됨
 			if (this.isOperation() && this.isRelatedOperation())
			{
				objScrollAtom.modifyRow(this.m_nRowIndex, nOccurEventType, this.m_strVarName);
 			}
 			// 이 아톰의 값 변경 시 연산식 수행이 필요 없을 시 수행됨
 			// Applet에서 이미 연산식 수행을 했을 때
 			else
 			{
 				objScrollAtom.modifyRowExcludeOperation(this.m_nRowIndex, nOccurEventType);
 			}
		}
		else
		{
			if (this.isOperation())
			{
				PQOperation.execute(this);
			}
		}
		
		// 입력란에 값이 들어오면 해당 입력란을 포함한 자체정의 팝업을 동작시킨다.
		this._executeMemoryPopup();
	}
}

InputDataAtom.prototype.setFont = function (strAttribName, objValue)
{
	if ("Size" == strAttribName)
	{
		this.m_heAtom.style.fontSize = objValue + "pt";
		this.m_objFont.setFontSize(objValue);
	}
	else if ("Bold" == strAttribName)
	{
		if (objValue)
		{
			this.m_heAtom.style.fontWeight = "bold";
			this.m_objFont.setBold();
		}
		else
		{
			this.m_heAtom.style.fontWeight = "normal";
			this.m_objFont.removeBold();
		}
	}
	else if ("Italic" == strAttribName)
	{
		if (objValue)
		{
			this.m_heAtom.style.fontStyle = "italic";
			this.m_objFont.setItalic();
		}
		else
		{
			this.m_heAtom.style.fontStyle = "normal";
			this.m_objFont.removeItalic();
		}
	}
	else if ("UnderLine" == strAttribName)
	{
		if (objValue)
		{
			this.m_heAtom.style.textDecoration = "underline";
			this.m_objFont.setUnderLine();
		}
		else
		{
			this.m_heAtom.style.textDecoration = "none";
			this.m_objFont.removeUnderLine();
		}
	}
	else if ("StrikeOut" == strAttribName)
	{
		if (objValue)
		{
			this.m_heAtom.style.textDecoration = "line-through";
			this.m_objFont.setStrikeOut();
		}
		else
		{
			this.m_heAtom.style.textDecoration = "none";
			this.m_objFont.removeStrikeOut();
		}
	}
	else if ("Family" == strAttribName)
	{
		this.m_heAtom.style.fontFamily = objValue;
		this.m_objFont.setFontName(objValue);
	}
	else if ("Color" == strAttribName)
	{
		this.m_heAtom.color = objValue;
		this.m_objFont.setFontColor(objValue);
	}
}

InputDataAtom.prototype.setFocus = function ()
{
	if (null != this.m_heAtom)
	{
		this.m_heAtom.focus();
		this.m_heAtom.select();
		
		if (this.m_bFormatMask)
		{
			HTMLLib.setCursorPosition(this.m_heAtom, 0);
		}
		
		return true;
	}
	return false;
}

InputDataAtom.prototype.setPrefix = function (strPrefix)
{
	this.m_strPrefix = strPrefix;
}

/**
 * 비활성화 상태인가?
 */
InputDataAtom.prototype._isDisabled = function ()
{
	var heAtom = this.getHTML();
	if (null != heAtom)
	{
		return heAtom.readOnly;
	}
	
	return false;
}

/**
 * Tab Key
 *
 * 기본키동작 -> onChange 이벤트 -> _탭이동 스크립트 -> _스크롤내이동 스크립트
 */
InputDataAtom.prototype._onTabKeyDown = function (heAtom, objEvent)
{
	// 필수 입력인데 값이 없으면 메세지 뿌림
	if (this.m_bSureInput && heAtom.value == "")
	{
		alert(this.m_strVarName + "을(를) 입력해 주십시오.");
		objEvent.returnValue = false;
		return;
	}
	
	this._occurOnChangeEvent();
	
	if (this.isDefaultKey())
	{
		this.defaultKeyAction();
	}
	
	if (-1 == ScriptAtomEvent.onMoveTab(this.m_nScriptIndex))
	{
		objEvent.returnValue = false;
		return;
	}
	else
	{
		ScriptAtomEvent.onMoveTabAfter(this.m_nScriptIndex);
	}
	
	var nType = TabOrderManager.ATOMKIND_INPUTDATA;
	if (this.isScroll())
	{
		nType = TabOrderManager.ATOMKIND_SCROLLINPUT; 
		
		if (-1 == ScriptAtomEvent.onMoveScroll(this.m_nScriptIndex))
		{
			objEvent.returnValue = false;
			return ;
		}
		else
		{
			ScriptAtomEvent.onMoveScrollAfter(this.m_nScriptIndex);
		}
	}
	
	if (objEvent.shiftKey)
	{
		if (g_objTabOrderManager.movePrevFocus(nType, this.m_strVarName, this.m_strScrollName, this.m_strTabID))
		{
			// 항목 순서에 의한 포커스 이동이 성공하면, 원래의 tab key 이벤트는 무효화 시킨다.
			objEvent.returnValue = false;
		}
	}
	else
	{
		if (g_objTabOrderManager.moveNextFocus(nType, this.m_strVarName, this.m_strScrollName, this.m_strTabID))
		{
			// 항목 순서에 의한 포커스 이동이 성공하면, 원래의 tab key 이벤트는 무효화 시킨다.
			objEvent.returnValue = false;
		}
	}
	
	if (this.isScroll())
	{
		// 스크롤에서는 무조건 원래의 tabKey 이벤트 무효화 시킴, 아톰 밀리는것 방지하기 위함
		objEvent.returnValue = false;
	}
}

/**
 * Enter Key
 *
 * onChange 이벤트 -> (_팝업동작 스크립트) -> 팝업 -> 기본키동작 -> _탭이동 스크립트 -> _스크롤내이동 스크립트
 */
InputDataAtom.prototype._onEnterKeyDown = function (heAtom, objEvent)
{
	if (this.m_bPopup)
	{
		this._occurOnChangeEvent();
		
		var bPopupReturn = PopupOnDblClick(this.m_strPopName, this.m_strScrollName, this, objEvent);
		
		// 팝업에서 사용자가 취소를 눌렀을 때 탭이동, 스크롤내이동 없음
		if (bPopupReturn)
		{
			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);
				}
			}
			
			if (this.m_bSureInput && heAtom.value == "")
			{
			}
			else
			{
				this.defaultKeyActionAfterPopup();
				this._moveTabByPopup(bPopupReturn);
			}
		}		
	}
	else
	{
		// 필수 입력인데 값이 없으면 메세지 뿌림
		if (this.m_bSureInput && heAtom.value == "")
		{
			alert(this.m_strVarName + "을(를) 입력해 주십시오.");
			objEvent.returnValue = false;
			return;
		}
		
		this._occurOnChangeEvent();
	
		if (this.isDefaultKey())
		{
			this.defaultKeyAction();
		}
		
		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);
			}
		}
		
		// 팝업이 아니고, 다중라인이 아니면, 엔터키를 눌렀을 때도, 항목순서 탭이동 수행
		if (!(this.m_bMultiLine && this.m_bAcceptReturn))
		{
			var nType = TabOrderManager.ATOMKIND_INPUTDATA;
			if (this.isScroll())
			{
				nType = TabOrderManager.ATOMKIND_SCROLLINPUT;
			} 
			
			if (g_objTabOrderManager.moveNextFocus(nType, this.m_strVarName, this.m_strScrollName, this.m_strTabID))
			{
				// 항목 순서에 의한 포커스 이동이 성공하면, 원래의 tab key 이벤트는 무효화 시킨다.
				objEvent.returnValue = false;
			}
		}
	}
}

/**
 * 팝업동작 이후, 커서이동 수행
 */
InputDataAtom.prototype._moveTabByPopup = function (bPopupReturn)
{
	if (this.m_bPopup && bPopupReturn)
	{
		var nType = TabOrderManager.ATOMKIND_POPUP;
		if (this.isScroll() && 0 < this.m_strScrollName.length)
		{
			nType = TabOrderManager.ATOMKIND_SCROLLPOPUP;
		}
		
		var nOffset = Model.getAtom(this.m_strPopName).getOffsetTabOrder();
		
		g_objTabOrderManager.moveNextFocus(nType, this.m_strPopName, this.m_strScrollName, this.m_strTabID, nOffset);
	}
}

InputDataAtom.prototype._setValue = function (strValue)
{
 	this.m_strValue = this._getFormatValue(strValue);
 	
 	this.displayValue();
}
	

InputDataAtom.prototype._getZeroValue = function (strValue)
{
	if ("0채우기" == this.m_strDefaultValue)
	{
		if (null == strValue || 0 ==  strValue.length)
		{
			return "";
		}
		else
		{
			var nZeroLength = this.m_nFieldLen;
			if (!isNaN(strValue))
			{
				nZeroLength = this.m_nFieldLen - strValue.length;
			}
			else
			{
				strValue = "";
			}
			for (var i=0; i<nZeroLength; i=i+1)
			{
				strValue = "0" + strValue;
			}
			
			return strValue;
		} 
	}
	return strValue;
}

/**
* @return strDefaultValue 기본값.
*/
InputDataAtom.prototype._getDefaultValue = function ()
{
	var strDefaultValue = this.m_strDefaultValue;
	
	if (strDefaultValue)
	{
		var objRegExp = /^\"(.*)\"$/;
		
		if (this.m_bFormatMask)
		{
			// 포맷 마스크일 경우에는 기본값 대신, 구분문자만 보여준다.
			strDefaultValue = this.m_strFormatValue;
		}
		else if (strDefaultValue.match(objRegExp))
		{
			strDefaultValue = strDefaultValue.replace(objRegExp, "$1")
		}
		else
		{
			if (PQService.containsGlobalInfo(strDefaultValue))
			{
				strDefaultValue = PQService.getGlobalInfo(strDefaultValue);
			}
			else
			{
				strDefaultValue = "";
			}
		}
	}
	
	return strDefaultValue;
}

/**
* 입력란의 기본값이 전역정보의 참조키인가?(사용자명, 사용자부호 등...)
* @return boolean
*/		
InputDataAtom.prototype._isEarmarkedGlobalKey = function ()
{
	return (this.m_strDefaultValue == "USER_ID" || this.m_strDefaultValue == "USER_NAME" ||
					this.m_strDefaultValue == "DP_SCODE" || this.m_strDefaultValue == "DP_SNAME" ||
					this.m_strDefaultValue == "PS_CODE" || this.m_strDefaultValue == "PS_NAME" ||
					this.m_strDefaultValue == "SANCT_CODE" || this.m_strDefaultValue == "PD_CODE" ||
					this.m_strDefaultValue == "JOB_LEVEL");
}

/*
 * 자체정의 팝업을 동작시킨다.
 */
InputDataAtom.prototype._executeMemoryPopup = function ()
{
	if (null == this.m_strPopName || 0 == this.m_strPopName.length)
	{
		return;
	}
	
	var objPopup = null
	if (ContainsPopupAtom())
	{
		objPopup = PopupAtom.getAtom(this.m_strPopName);
	}
	
	if (null == objPopup)
	{
		return;
	}
	
	// 이 InputDataAtom 때문에 연산식이 발생할 필요가 없다면 자체정의 팝업 시에도 연산식이 발생할 필요가 없다.
	// Atom에서 연산식 발생이 필요 없는 경우는 Applet에서 연산식을 수행하고 돌아온 경우이다.
	// 그러므로 HandleResult 과정에서 발생한 OnChange의 경우 Atom의 연산식 수행이 필요가 없다.
	objPopup.setIsOperation(this.isOperation());
	
	if (objPopup.isMemoryPopup())
	{
		objPopup.executeMemoryPopup(this.m_strVarName, this.m_strValue, this, this.m_strScrollName);
	}
	
	objPopup.setIsOperation(true);
}

/**
setValue()
blur : 스크립트 전
enter : 팝업 전
tab : 스크립트 전
dblclick : 스크립트 다음, 팝업 전
 */
InputDataAtom.prototype._occurOnChangeEvent = function (nOccurEventType)
{ 			
	// 현재 편집중이던 값을 아톰 값으로 저장합니다.
	// 편집중에 이벤트가 발생하면, 화면에 보이는 값과 아톰 값이 sync가 안맞는 것을 보완하기 위해
	this._saveEditToValue();
	
	if (this.m_strOldValue != this.m_strValue)
	{
	// 다음에 현재 값과 새로 입력된 값을 비교하기 위해 현재 값을 OldValue에 저장합니다.
		this.m_strOldValue = this.m_strValue;
		this.onChange(nOccurEventType);
	}
}

InputDataAtom.prototype._saveEditToValue = function ()
{
	if (null != this.m_heAtom)
	{
		this.m_strValue = this.m_heAtom.value;
	}
}

InputDataAtom.prototype._openAddMenu = function (objEvent)
{
	var heMenu = this.m_heAtomMenu;
		
	if (null == heMenu || null == heMenu.rows || 0 == heMenu.rows.length)
	{
		return;
	}
	
	// 메뉴 위치 설정
	heMenu.style.left = objEvent.clientX + "px";
	heMenu.style.top = objEvent.clientY + "px";
	
	if (null == this.m_heAtom)
	{
		heMenu.style.zIndex = 1;
	}
	else
	{
		heMenu.style.zIndex = this.m_heAtom.style.zIndex + 1;
	}
	
	heMenu.style.visibility = "visible";
	
	// AdditionalMenu에 이 입력란이 묶여 있는 스크롤 정보를 넣어준다.
	AdditionalMenu.setVarName(this.m_strVarName);
	AdditionalMenu.setIsScroll(this.isScroll());
	AdditionalMenu.setScrollName(this.m_strScrollName);
	AdditionalMenu.setRowIndex(this.m_nRowIndex);
	
	heMenu.focus();
}

/**
 *	기본검색키 동작
 */
InputDataAtom.prototype.defaultKeyAction = function ()
{
	if (g_bQWPClientMode)
	{
		g_objDoc.directExecute();		// 검색계열 아톰 즉시 실행
	
		g_objDoc.loadData(true, SQL_RECORD_TYPE.EQUAL_RECORD); // 데이터 로드
	}
	else
	{
		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);
}
	 	
InputDataAtom.prototype._getFormatValue = function (strValue)
{
	var strFormatValue = "";
	
	if (this._isNumericType() && ! this.m_bFormatMask)
	{
		if (null == strValue || 0 == strValue.length || isNaN(strValue))
		{
			// DB에서 가져온 값이 없을 때에는, 실수형일 경우를 제외하고는 0을 표시하지 않는다.
			if (this._isRealNumberType())	
			{
				// 실수형 일때 기본값없음에 체크가 안되면 무조건 0이고
				// 체크가 되면 기본값이 나와야 합니다.
				if (!this.m_bNotFloatDefault)
				{
					strValue = "0";
				}
				else
				{
					strValue = this._getDefaultValue();
				}
			}
			else
			{
				strValue = "";
			}
		}
		else if ("0" == strValue.charAt(0) && strValue.length > 1) // 0만 있을 경우에는 제거 안함
		{
			// 앞에 있는 필요없는 0 제거
			strValue = strValue.replace(new RegExp("^0*", 'g'), "");
		}
		else if ("-0" == strValue.substring(0, 2) && strValue.length > 2)
		{
			// 음수 일때 필요없는 0 제거
			strValue = strValue.replace(new RegExp("^-0*", 'g'), "-");
		}
		
		// 소수점이 있을 경우 반올림, 올림, 내림
		if (this._isRealNumberType())
		{
			strValue = this._getPeriodValue(strValue);
		}

		// 0표시안함 처리
		this.bExecuteNotZero = this._isNotDisplayZero(strValue);
		if (this.bExecuteNotZero)
		{
			return "";
		}
		
		// 콤마삽입
		if (this.m_bInsertComma && !this.m_bFormatMask)
		{
			strFormatValue = Utils.insertComma(strValue);
			
			// 삽입된 콤마 갯수 카운트
			this.m_nCommaCount = 0;
			for (var n = 0; n < strFormatValue.length; n++)
			{
				if (',' == strFormatValue.charAt(n))
				{
					this.m_nCommaCount ++;
				}
			}
			return strFormatValue;			
		}
		else
		{
			strFormatValue = strValue;
		}
	}
	else if (this._isCharacterType())
	{
		if (null == strValue)
		{
			strValue = "";
		}
		
		strFormatValue = this._removePrefix(strValue);
	}
	else
	{
		strFormatValue = strValue;
	}
	
	if (this.m_bFormatMask)
	{
 		// applet에서 연산식 때문에, ""일 경우 기본값으로 대체함
 		// 포맷마스크일 경우 구분문자 표함한 형식으로 보여져야함
		if (strFormatValue == this.m_strDefaultValue || 0 == strFormatValue.length)
		{
			strFormatValue = this.m_strFormatValue;
		}
 	
		strFormatValue = this._addFormatMaskSeparator(strFormatValue);
	}
	return strFormatValue;
}

/**
 * 접두어 제거
 * 접두어는 DB에 저장될 때 붙습니다.
 * @param strValue 값
 * @return 접두어가 제거된 값
 */
InputDataAtom.prototype._removePrefix = function (strValue)
{
	var strPrefix = this.m_strPrefix;
	
	if (!strPrefix)
	{
		return strValue;
	}
	
	if (strPrefix && 0 == strValue.indexOf(strPrefix))
	{
		strValue = strValue.substring(strPrefix.length);
	}
	
	return strValue;
}
	
InputDataAtom.prototype._getUnFormatValue = function (strValue)
{
	var strUnFormatValue = "";
	
	if (this._isNumericType())
	{
		if (this.m_bNotDisplayZero && 0 == strValue.length && this.bExecuteNotZero)
		{
			return "0";
		}

		// 콤마 제거
		if (this.m_bInsertComma && !this.m_bFormatMask)
		{
			strUnFormatValue = Utils.removeComma(strValue);
		}
		else
		{
			strUnFormatValue = strValue;
		}
	}
	else
	{
		strUnFormatValue = strValue;
	}
	
	if (this.m_bFormatMask)
	{
		strUnFormatValue = this._removeFormatMaskSeparator(strUnFormatValue);
	}

	// 접두어가 붙으면 FieldLen 보다 실제 길이가 증가한다. 마이너스 소수점은 포함시켜서 리턴
	var nLen = this.m_nFieldLen + this.m_nMinusDecimal;
	if (0 < this.m_strPrefix.length)
	{
		nLen += this.m_strPrefix.length;
	}
	
	return strUnFormatValue.substring(0, nLen);
}
	
/**
 * 접미어가 있으면 값 뒤에 붙인다.
 */
InputDataAtom.prototype._appendSuffix = function ()
{
	var strResult = this.getValue();
	var nSuffixLen = this.m_strSuffix.length;		
	var nValueLen = strResult.length;
	
	// 접미어가 없을 경우
	if (nSuffixLen <= 0)
	{
		return ;
	}
	
	// 정수, 실수일 경우에는 숫자형태의 접미어만 붙는다.
	if (this._isNumericType() && isNaN(parseInt(this.m_strSuffix, 10)))
	{
		return ;
	}

	// 입력값이 없을 경우에는 접미어를 붙이지 않는다.
	if ((0 < nValueLen) && (nValueLen < this.m_nFieldLen + this.m_nMinusDecimal))
	{
		var nSuffixCount = Math.floor((this.m_nFieldLen - nValueLen) / nSuffixLen);	// 몇번 접미어를 붙일 것인가.
		
		for (var i = 0; i < nSuffixCount; i++)
		{
			strResult += this.m_strSuffix;
		}
	}

	this._setValue(strResult);
}

/**
 * 입력이 올바르게 들어오면 true, 잘못된 입력이면 false
 */	
InputDataAtom.prototype._checkInputType = function (objEvent, heAtom)
{
	var nKeyCode = objEvent.keyCode;
	this.m_nKeyDownKeyCode = objEvent.keyCode;

	if (this.m_bReadOnly && !HTMLLib.isDirectionKeyDown(nKeyCode))	// 읽기  전용일 경우
	{
		return false;
	}
	
	// 포맷 마스크 일때 입력 체크
	if (this.m_bFormatMask)
	{
		if (false == this._checkFormatMaskInput(objEvent))
		{
			objEvent.returnValue = false;
			objEvent.cancelBubble = true;
			return false;
		}
	}
	
	// 정수 또는 실수형 일때
	if (this._isNumericType() || this.m_bInputNumber)
	{
		if (189 == nKeyCode)	// 189 : '-' 마이너스 키
		{
			var nCursorPos = HTMLLib.getCursorPosition(heAtom);
			if (0 == nCursorPos)
			{
				if ('-' == this.getValue().charAt(0))
				{
					objEvent.keyCode = 39;		// 이미 마이너스가 있으면 오른쪽으로 커서 이동
					return true;					
				}
				
				// 필드 최대 길이 늘림
				this.m_nMinusDecimal ++;
				this._changeInputFieldLength();
				return true;
			}
			objEvent.returnValue = false;
			objEvent.cancelBubble = true;
			return false;
		}
		// 실수일때에는 소수점(190, 110)도 포함
		else if ((190 == nKeyCode || 110 == nKeyCode) && this._isRealNumberType())
		{
			var strValue = this.getValue();

			if (strValue.indexOf(".") >=0 )	// 이미 소수점이 찍혀 있는 경우
			{
				objEvent.returnValue = false;
				objEvent.cancelBubble = true;
				return false;
			}
			
			// 필드 최대 길이 늘림
			this.m_nMinusDecimal ++;
			this._changeInputFieldLength();
			return true;
		}
		else if (HTMLLib.isNumberKeyDown(objEvent))
		{
			var nCursorPos = HTMLLib.getCursorPosition(heAtom);
			
			// 마이너스 앞에는 숫자를 넣지 못하게 한다.
			if (0 == nCursorPos && '-' == this.getValue().charAt(0))
			{
				objEvent.keyCode = 39;		// 오른쪽으로 커서 이동
				return true;
			}
		}			
		else if (!HTMLLib.isOperationKeyDown(nKeyCode))
		{
			objEvent.returnValue = false;
			objEvent.cancelBubble = true;
			return false;
		}
	}
	
	// 다중라인 일때 입력 및 길이 제한
	if (this.m_bMultiLine)
	{
		if (this._limitMultiLineInput(nKeyCode))
		{
			objEvent.returnValue = false;
			objEvent.cancelBubble = true;
			return false;
		}
	}

	return true;
}

/**
 * TextArea에서 현재 입력을 제한 할 것인지를 판단
 * 현재 키 값을 제한 할 경우 true, 허용할 경우 false 리턴 
 */
InputDataAtom.prototype._limitMultiLineInput = function (nKeyCode)
{
	var nLengthLimit = this.m_nFieldLen + this.m_nCommaCount + this.m_nMinusDecimal;	

	// 숫자형, 포멧 마스크, 콤마 삽입 에서는 엔터키로 줄바꿈을 할수 없다.
	if (13 == nKeyCode && (this._isNumericType() || this.m_bInsertComma || this.m_bFormatMask))
	{
		return true;
	}
	// 엔터키의 경우, 입력되면 \r\n 2문자가 생기므로 이를 고려하여 길이 계산
	else if (13 == nKeyCode && this.m_heAtom.value.length + 2 > nLengthLimit)
	{
		this._moveTabByPopup(true);
		return true;
	}
	else if (HTMLLib.isOperationKeyDown(nKeyCode))	// 이동키, 시스템키는 길이 관계 없이 허용
	{
		return false;
	}
	
	if (this.m_bFormatMask)		// 포멧 마스크의 경우 입력 제한 길이를 1 증가 시켜 준다.
	{
		nLengthLimit += 1;		
	}
	
	if (this.m_heAtom.value.length >= nLengthLimit)
	{
		return true;
	}
	return false;
}


/**
 * 입력란 필드 길이 변경
 */
InputDataAtom.prototype._changeInputFieldLength = function()
{
	this.m_heAtom.maxLength = this.m_nFieldLen + this.m_nCommaCount + this.m_nMinusDecimal;	
}

/**
 * 숫자 입력시 필드 길이를 재정의 한다.
 */
InputDataAtom.prototype._changeFieldLength = function (nKeyCode)
{
	// 백스페이스나, del키에 의해, '-'마이너스 '.'소수점이 없어졌을 경우, 필드 길이를 다시 정의 한다.
	if (this._isNumericType())
	{
		if (8 == nKeyCode || 46 == nKeyCode || 110 == nKeyCode)	// 8:백스페이스,  46,110:del키
		{
			var strValue = this.getValue();
			this.m_nMinusDecimal = 0;
			
			if (strValue.indexOf("-") == 0)
			{
				this.m_nMinusDecimal ++;
			}
			if (strValue.indexOf(".") >= 0)
			{
				this.m_nMinusDecimal ++;	
			}
			
			this._changeInputFieldLength();							
		}
	}	
}

/**
 * 소수점 자리수를 체크한다.
 */	
InputDataAtom.prototype._checkDecimalPoint = function (objEvent)
{
	if (this._isRealNumberType() && HTMLLib.isNumberKeyDown(objEvent))
	{
		var strValue = this.getValue();
		var nPointPos = strValue.indexOf(".");
		
		if (nPointPos >= 0 && strValue.length - nPointPos - 1 > this.m_nPeriod)	// 소수점 자리수가 기준을 넘어가면 
		{
			var nCursorPos = HTMLLib.getCursorPosition(this.m_heAtom);
			
			this._setValue(strValue);
			
			HTMLLib.setCursorPosition(this.m_heAtom, nCursorPos);
		}
	}
}

/**
 * 대, 소문자만 표시되어야 할 경우
 */	
InputDataAtom.prototype._checkUpperLowerCase = function (nKeyCode, heAtom)
{
	if (this._isCharacterType())
	{
		if (HTMLLib.isAlphabetKeyDown(nKeyCode))
		{
			var strValue = this.getValue();
			
			if (0 == this.m_nCaseType)	// 대문자
			{
				var nCursorPos = HTMLLib.getCursorPosition(heAtom);
				this._setValue(strValue.toUpperCase());
				HTMLLib.setCursorPosition(heAtom, nCursorPos);
			}
			else if (1 == this.m_nCaseType)	// 소문자
			{
				var nCursorPos = HTMLLib.getCursorPosition(heAtom);
				this._setValue(strValue.toLowerCase());
				HTMLLib.setCursorPosition(heAtom, nCursorPos);			
			}
		}
	}
}

/**
 * 최대, 최소값이 정해져 있으면 검사한다.
 */	
InputDataAtom.prototype._checkMinMaxValue = function ()
{
	// 최대,최소 검사는  정수,실수형 일때에만 수행한다.
	// 정의된 최대,최소 값이 모두 0 일 경우에는 수행 하지 않는다.
	if (this._isNumericType() && !(0 == this.m_nMaxNum && 0 == this.m_nMinNum))
	{	
		//최대/최소 검사를 해서 유효하지않으면 메시지를 보여주고 값을 초기화시키고 이벤트는 무효화한다.
		if (false == this._isValidScope(this.getValue()))
		{
			alert("입력할 수 있는 값의 범위\n최소값: " + this.m_nMinNum + ", 최대값: " + this.m_nMaxNum);
			this._setValue("");
			
			return false;
		}
	}
	
	return true;
}

/**
 * 데이터입력란의 데이터 타입이 숫자일 때, 
 * 들어온 값이 최소값과 최대값 사이에 존재하는지 검사해서 
 * 들어온다면 true, 들어오지않는다면 false를 반환한다.
 */
InputDataAtom.prototype._isValidScope = function (strValue)
{
	if (null == strValue || 0 == strValue.length)
	{
		return true;
	} 		
	
	if ("int" == this.m_strFieldType)
	{
		var nValue = parseInt(strValue, 10);
		return (this.m_nMinNum <= nValue && nValue <= this.m_nMaxNum);			
	}
	else
	{
		var fValue = parseFloat(strValue);
		return (this.m_nMinNum <= fValue && fValue <= this.m_nMaxNum);			
	}
}

InputDataAtom.prototype.getFieldType = function ()
{
	return this.m_strFieldType;
}

/**
 * 데이터 타입이 정수형 또는 실수형이면 true, 아니면 false
 */
InputDataAtom.prototype._isNumericType = function ()
{
	if ("int" == this.m_strFieldType || "float" == this.m_strFieldType || "double" == this.m_strFieldType)
	{
		return true;
	}		
	return false;
}

/**
 * 데이터 타입이 실수형일 경우에만 true, 아니면 false
 */	
InputDataAtom.prototype._isRealNumberType = function ()
{
	if ("float" == this.m_strFieldType || "double" == this.m_strFieldType)
	{
		return true;
	}
	return false;
}

/**
 * 데이터 타입이 문자형일 경우에만 true, 아니면 false
 */		
InputDataAtom.prototype._isCharacterType = function ()
{
	if ("char" == this.m_strFieldType || "text" == this.m_strFieldType)
	{
		return true;
	}		
	return false;
}

/**
 * 값이 0이고 0표시안함인지 확인한다.
 *
 * @param strValue 값
 *
 * @return 값이 0이고 0표시안함이면 true, 아니면 false 
 */
InputDataAtom.prototype._isNotDisplayZero = function (strValue)
{
	var nValue = parseFloat(strValue);
	if (0 == nValue && this.m_bNotDisplayZero)
	{
		return true;
	}
	
	return false;
}
	
/**
 * 소숫점 반올림, 올림, 내림을 처리합니다.
 * @param strValue 값
 * @return 반올림, 올림, 내림 처리된 값
 */
InputDataAtom.prototype._getPeriodValue = function (strValue)
{
	var nPowerOfTen = Math.pow(10, this.m_nPeriod);
	var fValue = parseFloat(strValue) * nPowerOfTen;
	if (!isNaN(fValue))
	{
		// 반올림
		if ("ROUNDOFF" == this.m_strProcessPeriod)
		{
			fValue = Math.round(fValue);
		}
		// 올림
		else if ("RAISEUP" == this.m_strProcessPeriod)
		{
			fValue = Math.ceil(fValue);
		}
		// 내림
		else if ("TRUNCATE" == this.m_strProcessPeriod)
		{
			fValue = Math.floor(fValue);
		}
		
		strValue = new String(fValue / nPowerOfTen);

		if (this.m_nPeriod)
		{
			var nIndex = strValue.indexOf(".");
			
			// 소숫점이 없으면 자릿수만큼 패딩 붙이기
			if (nIndex < 0)
			{
				strValue += ".";
				
				for (var i = 0; i < this.m_nPeriod; i += 1)
				{
					strValue += "0";
				}
			}
			// 있으면 자릿수 점검
			else
			{
				var strFractionalPart = strValue.substr(nIndex + 1);
				strValue = strValue.substr(0, nIndex + 1);
				
				for (var i = 0; i < this.m_nPeriod; i += 1)
				{
					if (i < strFractionalPart.length)
					{
						strValue += strFractionalPart.charAt(i);
					}
					else
					{
						strValue += "0";
					}
				}
			}
		}
	}
	return strValue;
}
	
/**
 * 숫자키를 입력하면 콤마 삽입 수행
 */		
InputDataAtom.prototype._insertCommaProc = function (objEvent)
{
	var nKeyCode = objEvent.keyCode;
	
	if (HTMLLib.isNumberKeyDown(objEvent) || 8 /*백스페이스*/ == nKeyCode || 46 /*del*/ == nKeyCode)
	{
		var nPrevCommaCount = this.m_nCommaCount;
		this.m_nCommaCount = 0;
		var nCursorPos = HTMLLib.getCursorPosition(this.m_heAtom);
				
		var strValue = this.getValue();
		if (0 == strValue.length)
		{
			nCursorPos = 1;		// 기본값으로 "0"일 들어갈 경우, 커서위치를 뒤로 하기 위해
		}
		this._setValue(strValue);
			
		if (this.m_nCommaCount > 0)	// 콤마가 삽입되면 입력란의 길이 제한을 늘린다.
		{
			this._changeInputFieldLength();
			this.displayValue();
		}
			
		nCursorPos += this.m_nCommaCount - nPrevCommaCount;
		HTMLLib.setCursorPosition(this.m_heAtom, nCursorPos);
	}
}

/**
 * 기본값 문자열이 포멧 마스크에 해당하는 문자열인지를 판별한다.
 */
InputDataAtom.prototype._checkFormatMaskString = function (strValue)
{
	this.m_bFormatMask = true;
	
	if (0 == strValue.length || 1 == strValue.length)
	{
		this.m_bFormatMask = false;
		return;
	}
	
	for (var i = 0; i < strValue.length; i += 1)
	{
		var chType = strValue.charAt(i);
		
		if ('#' != chType && 'A' != chType && '?' != chType && '-' != chType &&	'(' != chType &&
			')' != chType && '/' != chType && '.' != chType && ':' != chType)
		{
			this.m_bFormatMask = false;
			break;
		}
	}
	
	if (this.m_bFormatMask)
	{
		// 입력 제한 길이가 포멧마스크 길이 보다 작으면 입력이 안되므로 증가시킴
		if (null != this.m_heAtom && this.m_nFieldLen <= strValue.length)
		{
			this.m_heAtom.maxLength = strValue.length + 1;
		}
		
		this.m_strFormatValue = strValue.replace(new RegExp("[A#\?]", "g"), " ");
		this.m_strPrevFormat = this.m_strFormatValue;
					
		return;
	}
	else
	{
		// 년/월/일 형식일 경우에
		var arYMDstring = Array("YYMMDD", "YY-MM-DD", "YY/MM/DD", "YY.MM.DD", "YYYYMMDD", "YYYY-MM-DD", "YYYY/MM/DD", "YYYY.MM.DD");
		
		for (var i = 0; i < arYMDstring.length; i += 1)
		{
			if (strValue == arYMDstring[i])
			{
				this.m_bFormatMask = true;
			
				this.m_strFormatValue = strValue.replace(new RegExp("[YMD]", "g"), " ");
				this.m_strPrevFormat = this.m_strFormatValue;
				
				if (this.m_nFieldLen <= strValue.length && null != this.m_heAtom)
				{
					this.m_heAtom.maxLength = strValue.length + 1;
				}
				
				this.m_strFormatValue = this._makeDateString(this.m_strDefaultValue);
				this.m_strPrevFormat = this.m_strFormatValue;
				break;
			}
		}
	}
}

/**
 * 현재의 년,월,일 값을 포맷 마스크 형식에 맞는 문자열로 리턴
 */
InputDataAtom.prototype._makeDateString = function (strFormat)
{		
	var strYear = Utils.getTodayYear();
	var strMonth = Utils.getTodayMonth();
	var strDate = Utils.getTodayDate();
	
	var strResult = "";
		
	if (strFormat.indexOf("M") < 4)
	{
		strResult += strYear.substring(2, 4);
		
		if ("M" == strFormat.charAt(2))
		{
			strResult += strMonth + strDate;
		}
		else
		{
			strResult += strFormat.charAt(2) + strMonth + strFormat.charAt(5) + strDate;
		}
	}
	else
	{
		strResult += strYear;
				
		if ("M" == strFormat.charAt(4))
		{
			strResult += strMonth + strDate;
		}
		else
		{
			strResult += strFormat.charAt(4) + strMonth + strFormat.charAt(7) + strDate;
		}
	}
	return strResult;
}

/**
 * 포멧 마스크 구분기호 이면 true
 */
InputDataAtom.prototype._isSeparatorMask = function (chMask)
{
	if ("-" == chMask || "/" == chMask || "." == chMask || "(" == chMask || ")" == chMask || ":" == chMask)
	{
		return true;
	}
	return false;
}

/**
 * 포멧마스크 형식에 맞는 입력인지를 체크
 */
InputDataAtom.prototype._checkFormatMaskInput = function (objEvent)
{	
	var nCursorPos = HTMLLib.getCursorPosition(this.m_heAtom);
	var nKeyCode = objEvent.keyCode;
	
	// 기본값에 저장되어 있는 #A?가 포함된 문자열에서 커서 위치의 문자를 얻음
	var chMask = this.m_strDefaultValue.charAt(nCursorPos);
	var chPrevMask = this.m_strDefaultValue.charAt(nCursorPos - 1);
		
	this.m_strPrevFormat = this.getValue();		// adjustFormatValue()에서 쓰임
	this.m_nPrevCursorPos = HTMLLib.getCursorPosition(this.m_heAtom);
			
	if ("#" == chMask || "Y" == chMask || "M" == chMask || "D" == chMask)
	{
		if (HTMLLib.isNumberKeyDown(objEvent) || 32 == nKeyCode)	// 32 : 스페이스 바
		{
			return true;
		}
	}
	else if ("A" == chMask)
	{
		if (HTMLLib.isCharacterKeyDown(nKeyCode) || 32 == nKeyCode)
		{
			return true;
		}
	}
	else if ("?" == chMask)
	{
		if (HTMLLib.isNumberKeyDown(objEvent) || HTMLLib.isCharacterKeyDown(nKeyCode) || 32 == nKeyCode)
		{
			return true;
		}
	}
	else if (this._isSeparatorMask(chMask))
	{
		if (HTMLLib.isNumberKeyDown(objEvent) || 32 == nKeyCode || HTMLLib.isCharacterKeyDown(nKeyCode))
		{
			HTMLLib.setCursorPosition(this.m_heAtom, HTMLLib.getCursorPosition(this.m_heAtom) + 1);
			return false;
		}			
	}
	
	// 구분기호 삭제 못하게 함
	if (this._isSeparatorMask(chPrevMask) && 8 == nKeyCode)	// 백스페이스
	{
		return false;
	}
	if (this._isSeparatorMask(chMask) && (46 == nKeyCode || 110 == nKeyCode))	// del 키
	{
		return false;
	}
		
	if (HTMLLib.isOperationKeyDown(objEvent.keyCode))	// 이동키, 시스템키는 동작
	{
		return true;
	}

	return false;
}	

/**
 * 포멧 마스크 형식에 맞도록 문자열을 조정한다.
 */
InputDataAtom.prototype._adjustFormatValue = function (objEvent)
{
	var strValue = this.m_heAtom.value;
	var nCursorPos = HTMLLib.getCursorPosition(this.m_heAtom);
	var strResult = strValue;
	
	var nKeyCode = objEvent.keyCode;
	
	if (46 == nKeyCode || 110 == nKeyCode)	// del키
	{
		strResult = strValue.substring(0, nCursorPos);
		strResult += " ";
		strResult += strValue.substring(nCursorPos, strValue.length);		
		
		nCursorPos ++;
	}
	else if (8 == nKeyCode)		// space bar
	{
		if (strValue.length < this.m_strFormatValue.length)
		{
			strResult = strValue.substring(0, nCursorPos);
			strResult += " ";
			strResult += strValue.substring(nCursorPos, strValue.length);
		
		}
	}
	// 문자열 삽입으로 길이가 증가하여, 커서뒤에 위치한 문자를 삭제 시킴
	else if (strValue.length > this.m_strFormatValue.length)
	{
		strResult = strValue.substring(0, this.m_nPrevCursorPos + 1);
		strResult += strValue.substring(nCursorPos + 1, strValue.length);
	}
	
	strResult = this._compareFormatValue(strResult);
	
	// 무리한 키보드 입력으로 포멧 마스크의 길이와 문자열이 일치하지 않는 경우에
	// 강제로 포멧 마스크 형식에 맞도록 현재 문자열을 조정한다.
	if (strResult.length != this.m_strFormatValue.length)
	{
		strResult = this._forceFormatValue(strResult);
	}
	
	this._setValue(strResult);
	
	if (HTMLLib.isCharacterKeyDown(nKeyCode) || HTMLLib.isNumberKeyDown(objEvent))
	{
		// 구분문자 뒤로 커서 위치 이동
		var ch = strResult.charAt(nCursorPos);
		while (true == this._isSeparatorMask(ch))
		{
			nCursorPos ++;
			ch = strResult.charAt(nCursorPos);
		}
	}
	
	HTMLLib.setCursorPosition(this.m_heAtom, nCursorPos);		
}

/**
 * 포맷 마스크 형식과 비교하여 구분기호가 일치하지 않는 부분을 수정
 */
InputDataAtom.prototype._compareFormatValue = function (strValue)
{
	var strResult = strValue;
	
	for (var i = 0; i < strValue.length; i++)
	{
		var chMask = this.m_strFormatValue.charAt(i);
		var chValue = strValue.charAt(i);
		
		if (true == this._isSeparatorMask(chMask) && false == this._isSeparatorMask(chValue))
		{
			strResult = strValue.substring(0, i);
			strResult += this.m_strFormatValue.substring(i, i+1);
		}
		
		if (false == this._isSeparatorMask(chMask) && true == this._isSeparatorMask(chValue))
		{
			strResult += strValue.substring(i+1, strValue.length);
			break;
		}
	}
	return strResult;
}

/**
 * 포맷마스크 형식과 길이나 내용이 일치하지 않을 경우, 강제로 형식에 맞춘다.
 */
InputDataAtom.prototype._forceFormatValue = function (strValue)
{
	var strResult = ""
	
	for (var i = 0, j = 0; i <= this.m_strFormatValue.length; i++)
	{
		var chMask = this.m_strFormatValue.charAt(i);
		
		if (true == this._isSeparatorMask(chMask) || i == this.m_strFormatValue.length)
		{
			for (var k = j; k < i; k++)
			{
				var chValue = strValue.charAt(k);
				if ("" == chValue)
				{
					strResult += " "
				}
				else
				{
					strResult += chValue;
				}
			}
			
			if (i < this.m_strFormatValue.length)
			{
				strResult += chMask;
				j = i + 1;
			}
		}
	}
	
	return strResult;
}

/**
 * 기호저장이 아닐 경우, 포멧 마스크 구분기호를 삽입 한다.
 * 
 * return	: 포멧 마스크 구분기호가 있는 문자열
 */
InputDataAtom.prototype._addFormatMaskSeparator = function (strValue)
{
	var strResult = "";
	
	strValue = this._checkCurrentFormatMaskValue(strValue);
	
	if (this.m_bMaskSave)
	{
		return strValue;
	}
	
	for (var i = 0, j = 0; i < this.m_strFormatValue.length; i=i+1)
	{
		var chMask = this.m_strFormatValue.charAt(i);
		var chValue = strValue.charAt(i);
					
		if (true == this._isSeparatorMask(chMask) && false == this._isSeparatorMask(chValue))
		{
			strResult += chMask;
		}
		else
		{
			strResult += strValue.charAt(j);
			j = j+1;
		}
	}
	return strResult;		
}

InputDataAtom.prototype._checkCurrentFormatMaskValue = function (strValue)
{
	var strResult = "";
	
	for (var i = 0, j = 0; i < this.m_strFormatValue.length; )
	{
		var chMask = this.m_strFormatValue.charAt(i);
		var chValue = strValue.charAt(j);
		
		if (false == this._isSeparatorMask(chMask) && true == this._isSeparatorMask(chValue))
		{
			strResult += chMask;
			i = i+1;
		}
		else
		{
			strResult += chValue;
			i = i+1;
			j = j+1;
		}
	}
	return strResult;						
}

/**
 * 기호저장이 아닐 경우, 포멧 마스크 구분 기호를 제거한다.
 * 
 * return	: 포멧 마스크 구분기호가 있는 문자열	 
 */
InputDataAtom.prototype._removeFormatMaskSeparator = function (strValue)
{
	var strResult = "";
	
	if (this.m_bMaskSave)
	{
		return strValue;
	}
	
	for (var i = 0; i < this.m_strFormatValue.length; i=i+1)
	{
		var chMask = this.m_strFormatValue.charAt(i);
					
		if (false == this._isSeparatorMask(chMask))
		{
			strResult += strValue.charAt(i);
		}
	}
	return strResult;
}	

// Format Mask 처리 부분 끝
/////////////////////////////////////////////
	
/*
 * 문서모델의 문서대장의 값과 입력란의 값을 동기화한다.
 */	 
InputDataAtom.prototype._synchronizeNtoaMasterInfo = function ()
{
	var strID = null;
	
	switch (this.m_strVarName)
	{
		case "MSTDOCNUM":
		case "문서번호":
			strID = "__NTOAMODEL_MASTERDIALOG_FIELD_D03"; 
			break;
		case "MSTTITLE":
		case "제목":
			strID = "__NTOAMODEL_MASTERDIALOG_FIELD_D02"; 
			break;
	}
	
	if (null != strID)
	{
		g_objMasterInfomation.setValue(strID, this.getValue());
	}
}

InputDataAtom.prototype.getProperty = function (nNameID, arArgs, objRetVal)
{
	switch (nNameID)
	{
	case 0 : case 203 : return this.get_InputProperty (203, arArgs, objRetVal);
	case 8 : case 342 : return this.get_FieldProperty (342, arArgs, objRetVal);
	case 36 :case 286 : return this.get_GdiProperty (286, arArgs, objRetVal);
	case 38 :case 253 : return this.get_GdiProperty (253, arArgs, objRetVal);
	default : return StdCore.E_NOT_DEF_PROPERTY;
	}
}

InputDataAtom.prototype.setProperty = function (nNameID, arArgs, objRetVal)
{
	switch (nNameID)
	{
	case 0 : case 203 : return this.set_InputProperty (203, arArgs, objRetVal);
	case 36 :case 286 : return this.set_GdiProperty (286, arArgs, objRetVal);
	case 38 :case 253 : return this.set_GdiProperty (253, arArgs, objRetVal);
	case 43 :case 303 : return this.set_RefProperty (303, arArgs, objRetVal);
	case 45 :case 305 : return this.set_RefProperty (305, arArgs, objRetVal);
	default : return StdCore.E_NOT_DEF_PROPERTY;
	}
}

InputDataAtom.prototype.action = function (nPropID, arArgs, objRetVal)
{
	switch (nPropID)
	{
	case 49 : case 343 :return this.raw_ExecOperate (arArgs, objRetVal);
	case 50 : case 344 :return this.raw_LandAction (344, arArgs, objRetVal);
	default : return this.getProperty (nPropID, arArgs, objRetVal);
	}
}

InputDataAtom.prototype.get_InputProperty = function (nNameID, arArgs, objRetVal)
{
	switch(nNameID)
	{
	case 203:	// 값 (가장 많이 사용되므로 젤 위에 둔다)
		CVariantX.setReturnValue(this.getValue(), objRetVal, this.m_strFieldType);
		break;
	default:
		return StdCore.E_NOT_DEF_PROPERTY;
	}

	return StdCore.S_OK;
}

InputDataAtom.prototype.set_InputProperty = function (nNameID, arArgs, objValue)
{
	switch(nNameID)
	{
	case 203:	// 값 (가장 많이 사용되므로 젤 위에 둔다)
		var strValue = objValue.toStringX();
		//strValue = setContentString (strValue, true);
		
		this.setValue(strValue);
		break;
	default:
		return StdCore.E_NOT_DEF_PROPERTY;
	}

	return StdCore.S_OK;
}

/**
 * 아톰리스트
 */
InputDataAtom._atoms = new Object();

/**
 * 아톰을 초기화한다.
 * @param isNotClear 'DB동작 시 DB연결이 없는 아톰의 값 유지' 속성. 이 인자는 있을 수도 있도 없을 수도 있다.
 */
InputDataAtom.init = function (isNotClear)
{
	for (var strVarName in InputDataAtom._atoms)
	{
		if ("" == strVarName)
			continue;
			
		var objAtom = InputDataAtom._atoms[strVarName];
		//'DB동작 시 DB연결이 없는 아톰의 값 유지' 속성값이 참인 경우
		//필드명이 없는 아톰은 값을 유지하기 위해서 초기화하지 않는다.
		if (true == isNotClear)
		{
			var strFieldName = objAtom.getFieldName();
			if (null == strFieldName || 0 == strFieldName.length)
			{
				continue;
			}
		}
		
		objAtom.init();
	}
}

InputDataAtom.getInputDataList = function ()
{
	if (null == InputDataAtom._atoms)
	{
		return null;
	}
	else
	{
		return InputDataAtom._atoms;
	}
	
}

InputDataAtom.getAtom = function (strVarName, strScrollName, heAtom)
{
	if (strScrollName)
	{
		if (ContainsScrollAtom())
		{
			var objScrollAtom = ScrollAtom.getAtom(strScrollName);
			
			if (objScrollAtom)
			{
				var nRowIndex = objScrollAtom.getRowIndex(heAtom);
				
				if (0 <= nRowIndex)
				{
					return objScrollAtom.getBindedAtom(strVarName, nRowIndex);
				}
			}
		}
		else if (ContainsWebRssAtom())
		{
			return WebRssAtom.getBindedAtom(strScrollName, strVarName, heAtom);
		}
	}

	return InputDataAtom._atoms[strVarName];
}

InputDataAtom.getAtomByDatabaseInfo = function (strTableName, strFieldName)
{
	for (var strVarName in InputDataAtom._atoms)
	{
		var objAtom = InputDataAtom._atoms[strVarName];
		if (strTableName == objAtom.getTableName() && strFieldName == objAtom.getFieldName())
		{
			return objAtom;
		}
	}
	
	return null;
}

InputDataAtom.getRefAtom = function (strRefVarName)
{
	for (var strVarName in InputDataAtom._atoms)
	{
		var objRefAtom = InputDataAtom._atoms[strVarName];
		if (strRefVarName == objRefAtom.getRefVarName())
		{
			return objRefAtom;
		}
	}
	
	return null;
}

InputDataAtom.makeRequest = function (xnAtomRequest)
{
	for (var strVarName in InputDataAtom._atoms)
	{
		var objAtom = InputDataAtom._atoms[strVarName];
		
		objAtom.makeRequest(xnAtomRequest);
	}
}

InputDataAtom.makeDefaultKeyRequest = function (xnAtomRequest)
{
	for (var strVarName in InputDataAtom._atoms)
	{
		var objAtom = InputDataAtom._atoms[strVarName];
		
		if (objAtom.isDefaultKey() && !objAtom.isScroll())
		{
			objAtom.makeRequest(xnAtomRequest);
		}
	}
}

/**
 * 기본검색키이며 자동검색인 입력란 아톰을 가져온다.
 */
InputDataAtom.getDefaultKey = function (strTableName)
{
	for (var strVarName in InputDataAtom._atoms)
	{
		var objAtom = InputDataAtom._atoms[strVarName];
		
		if (strTableName == objAtom.getTableName())
		{
			if (objAtom.isDefaultKey() || objAtom.isAutoLoad())
			{
				return objAtom;
			}
		}
	}
}

/**
 * 입력란의 필수항목 체크를 한다. 
 */
InputDataAtom.checkSureInput = function()
{
	for (var strVarName in InputDataAtom._atoms)
	{
		var objInputAtom = InputDataAtom._atoms[strVarName];
		if (objInputAtom.isSureInput())
		{
			// throw SureInputException
			if (false == objInputAtom.checkSureInput())
				return;
		}
	}
}

/**
 * 입력란 아톰의 유효항목 체크를 실행한다.
 */
InputDataAtom.checkSureInputScroll = function ()
{
	for (var strVarName in InputDataAtom._atoms)
	{
		var objInputAtom = InputDataAtom._atoms[strVarName];
		if (objInputAtom.isSureInputScroll())
		{
			// throw SureInputException
			if (false == objInputAtom.checkSureInputScroll())
				return;
		}
	}
}

InputDataAtom.setReadOnly = function (bReadOnly)
{
	for (var strVarName in InputDataAtom._atoms)
	{
		InputDataAtom._atoms[strVarName].setReadOnly(bReadOnly);
	}
}

/**
 * 아톰리스트의 연산식을 수행한다.
 */
InputDataAtom.executeOperation = function ()
{
	for (var strVarName in InputDataAtom._atoms)
	{
		var objAtom = InputDataAtom._atoms[strVarName];
		
		if (null != objAtom && objAtom.isRelatedOperation())
		{
			PQOperation.execute(objAtom);
		}
	}
}

/**
 * @return 기본검색키로 설정된 아톰배열
 */
InputDataAtom.getDefaultKeyAtoms = function ()
{
	var arDefaultKeyAtoms = new Array();
	
	for (var strVarName in InputDataAtom._atoms)
	{
		var objAtom = InputDataAtom._atoms[strVarName];
		
		if (objAtom.isDefaultKey())
		{
			arDefaultKeyAtoms.push(objAtom);
		}
	}
	
	return arDefaultKeyAtoms;
}


/**
 * 누름 이벤트
 *
 * @param strScrollName 스크롤에 묶여 있는 경우 스크롤아톰 변수명
 * @param heAtom 이벤트가 발생한 html element
 * @param objEvent html 이벤트 객체, FF에서 전달됨
 */
function InputDataOnClick (strScrollName, heAtom, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	var objInputDataAtom = InputDataAtom.getAtom(heAtom.id, strScrollName, heAtom);
	if (null != objInputDataAtom)
	{
		objInputDataAtom.onClick(heAtom, objEvent);
	}
}

/**
 * 두번누름 이벤트
 *
 * @param strScrollName 스크롤에 묶여 있는 경우 스크롤아톰 변수명
 * @param heAtom 이벤트가 발생한 html element
 * @param objEvent html 이벤트 객체, FF에서 전달됨
 */
function InputDataOnDblClick (strScrollName, heAtom, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	var objInputDataAtom = InputDataAtom.getAtom(heAtom.id, strScrollName, heAtom);
	if (null != objInputDataAtom)
	{
		objInputDataAtom.onDblClick(heAtom, objEvent);
	}
}

/**
 * 초점얻음 이벤트
 *
 * @param strScrollName 스크롤에 묶여 있는 경우 스크롤아톰 변수명
 * @param heAtom 이벤트가 발생한 html element
 * @param objEvent html 이벤트 객체, FF에서 전달됨
 */
function InputDataOnFocus (strScrollName, heAtom, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	var objInputDataAtom = InputDataAtom.getAtom(heAtom.id, strScrollName, heAtom);
	if (null != objInputDataAtom)
	{
		objInputDataAtom.onFocus(heAtom, objEvent);
	}
}

/**
 * 초점상실 이벤트
 *
 * @param strScrollName 스크롤에 묶여 있는 경우 스크롤아톰 변수명
 * @param heAtom 이벤트가 발생한 html element
 * @param objEvent html 이벤트 객체, FF에서 전달됨
 */
function InputDataOnBlur (strScrollName, heAtom, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	var objInputDataAtom = InputDataAtom.getAtom(heAtom.id, strScrollName, heAtom);
	if (null != objInputDataAtom)
	{
		objInputDataAtom.onBlur(heAtom, objEvent);
	}
}

/**
 * 키누름 시작
 */
function InputDataOnKeyPress(strScrollName, heAtom, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	var objInputDataAtom = InputDataAtom.getAtom(heAtom.id, strScrollName, heAtom);
	if (null != objInputDataAtom)
	{
		objInputDataAtom.onKeyPress(objEvent);
	}
}

/**
 * 키누름
 */
function InputDataOnKeyDown (strScrollName, heAtom, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	var objInputDataAtom = InputDataAtom.getAtom(heAtom.id, strScrollName, heAtom);
	if (null != objInputDataAtom)
	{
		objInputDataAtom.onKeyDown(heAtom, objEvent);
		
		if (false == objEvent.returnValue)
		{
			return false;
		}
	}
}

/**
 * 키누름 끝
 */
function InputDataOnKeyUp (strScrollName, heAtom, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	var objInputDataAtom = InputDataAtom.getAtom(heAtom.id, strScrollName, heAtom);
	if (null != objInputDataAtom)
	{
		objInputDataAtom.onKeyUp(objEvent);
	}
}

/**
 * 입력란 마우스 다운 이벤트 핸들러
 */
function InputDataOnMouseDown (strScrollName, heAtom, objEvent)
{
	objEvent = HTMLLib.getEvent(objEvent);
	
	var objInputDataAtom = InputDataAtom.getAtom(heAtom.id, strScrollName, heAtom);
	if (null != objInputDataAtom)
	{
		objInputDataAtom.onMouseDown(objEvent);
	}
}

function InputDataOnMouseOver (strScrollName, heAtom, objEvent)
{
	var objInputDataAtom = InputDataAtom.getAtom(heAtom.id, strScrollName, heAtom);
	if (null != objInputDataAtom)
	{
		objInputDataAtom.onMouseOver();
	}
}

function InputDataOnMouseOut (strScrollName, heAtom, objEvent)
{
	var objInputDataAtom = InputDataAtom.getAtom(heAtom.id, strScrollName, heAtom);
	if (null != objInputDataAtom)
	{
		objInputDataAtom.onMouseOut();
	}
}

function InputDataOnPaste (strScrollName, heAtom, objEvent)
{
	var objInputDataAtom = InputDataAtom.getAtom(heAtom.id, strScrollName, heAtom);
	if (null != objInputDataAtom)
	{
		objInputDataAtom.onPaste();
	}
}


function InputImageAtom (strVarName, nScriptIndex, strTableName, strFieldName, strTabID, bSureInput, bVanish)
{
	this.Atom (strVarName, "", "", -1, nScriptIndex, -1, -1, bVanish);
	
	this.m_strTableName = strTableName;
	this.m_strFieldName = strFieldName;
	this.m_strWhereClause = "";
	
	this.m_strTabID = strTabID;
	this.m_bSureInput = bSureInput;
	this.m_bVanish = bVanish;
	
	this.m_bUpdate = false;
	this.m_strDefaultAtomVarName = "";
	
	this.m_heAtom = document.getElementById(this.m_strVarName);
	this.m_heAtomDiv = document.getElementById("__INPUTIMAGE_" + this.m_strVarName);
	
	this.m_objFileUploadComponent = null;
	
	this.m_nCount = 0;	// 이미지 다운로드시 매번 새로운 요청을 만들기 위해 URI 변화를 위한 매개변수(카운트값)
}

InputImageAtom.prototype = new Atom ();
InputImageAtom.prototype.constructor = InputImageAtom;

InputImageAtom.prototype.setValue = function (strClause)
{
	if (null == strClause)
	{
		this.init();
		return;
	}
	
	// 이미지입력란의 테이블명은 처음에는 디비명이 없다. 
	// 기본키 동작 이후에 이미지입력란의 조건절을 만들면서 디비명이 붙은 테이블명도 만든다.
	// 조건절과 같이 넘어온 디비명이 붙은 테이블명을 분리해서 최초의 테이블명 대신에 가지고 있는다.
	// 이 테이블명을 쿼리를 만들때 사용한다.
	var nDelimiterIndex = strClause.indexOf("$");
	if (0 < nDelimiterIndex)
	{
		this.m_strTableName = strClause.substring(0, nDelimiterIndex);			
		strClause = strClause.substring(nDelimiterIndex + 1);
	}
	
	// 필수 입력 체크를 위해 기본키 아톰의 변수명을 저장
	var nComma = strClause.lastIndexOf(",");
	if (-1 < nComma)
	{
		this.m_strDefaultAtomVarName = strClause.substring(nComma + 1);
		this.m_strWhereClause = strClause.substring(0, nComma);			
	}
	else
	{
		this.m_strDefaultAtomVarName = "";
		this.m_strWhereClause = strClause;
	}
	
	this._getImage();
}

InputImageAtom.prototype.isUpdate = function ()
{
	return this.m_bUpdate;
}

/**
 * 선택표시 (f9 기능)
 */
InputImageAtom.prototype.vanish = function ()
{
	if (this.m_bVanish)
	{
		// 현재 감춤 상태이면 표시한다.
		if ("hidden" == this.m_heAtomDiv.style.visibility)
		{
			this.m_heAtomDiv.style.visibility = "visible";
		}
		else	// 표시된 상태이면 감춘다.
		{
			this.m_heAtomDiv.style.visibility = "hidden";
		} 
	}
}

/**
* 날짜 입력란의 필수입력을 반환.
*/
InputImageAtom.prototype.isSureInput = function ()
{
	return this.m_bSureInput;
}

/**
 * 이미지 입력란의 필수입력을 체크한다.
 * 수정 모드인지를 판별 하기 위해, 기본키가 설정된 아톰의 변수명으로 검색한다.
 * 수정 모드가 아닐 경우, 필수입력인데 그림 파일 path가 공백이면 예외 throw
 */
InputImageAtom.prototype.checkSureInput = function ()
{
	if (0 < this.m_strDefaultAtomVarName.length)
	{
		var objAtom = null;
		var strType = "";
		if (ContainsInputDataAtom())
		{
			objAtom = InputDataAtom.getAtom(this.m_strDefaultAtomVarName, "", null);
			strType = objAtom.getSaveType();
		}
		
		if ("UPDATE" == strType)
		{
			return;
		}
	}
	
	var strValue = this.m_objFileUploadComponent.getPath();
		if (null == strValue || 0 == strValue.length)
		{
		this.m_heAtom.focus();
			throw new SureInputException (this.m_strVarName + "을(를) 입력해 주십시오.");
		}
}

InputImageAtom.prototype.init = function ()
{
	this._clearImage();
	this._clearHTML();
	this._initFlag();
	
	this._createFileUploadComponent();
}

InputImageAtom.prototype.makeRequest = function (xnRequest)
{
	var xnAtom = XmlLib.createChild(xnRequest, "InputImageAtom");
	
	xnAtom.setAttribute("VarName", this.m_strVarName);
	xnAtom.setAttribute("TableName", this.m_strTableName);
	xnAtom.setAttribute("TabID", this.m_strTabID);
}

InputImageAtom.prototype.makeUploadRequest = function (xnUploadRequest)
{
	var xnAtom = XmlLib.createChild(xnUploadRequest, "InputImageAtom");
	
	xnAtom.setAttribute("VarName", this.m_strVarName);
	xnAtom.setAttribute("Table", this.m_strTableName);
	xnAtom.setAttribute("Field", this.m_strFieldName);
	xnAtom.setAttribute("Where", this.m_strWhereClause);
}


/**
 * 이미지입력란을 클릭하면, 직업 파일 선택창을 띄우지 않습니다. (보안문제로 막혀있음)
 * 화면 가운데에 div창을 띄우고, 이것을 이용해서 파일 선택창을 띄웁니다.
 */
InputImageAtom.prototype.onMouseUp = function (objEvent)
{
	var heMenu = document.getElementById("__INPUT_IMAGE_CONTEXT_MENU_" + this.m_strVarName);
		
	// 메뉴 위치 설정
	heMenu.style.left = objEvent.clientX + "px";
	heMenu.style.top = objEvent.clientY + "px";
	
	heMenu.style.zIndex = 1;
	heMenu.style.visibility = "visible";
	
	heMenu.focus();
}


/**
 * 파일 선택창을 통해 파일이 선택되면, 파일 이미지입력란의 그림을 바꿉니다.
 */
InputImageAtom.prototype.onChange = function ()
{
	this._hideDialog();
	this._changeImage();
}

/**
 * 
 */
InputImageAtom.prototype.onCancel = function ()
{
	this._hideDialog();
}


/**
 *  이미지 입력란의 컨텍스트 메뉴 클릭
 */
InputImageAtom.prototype.onMouseDownContextMenu = function (strMenu)
{
	switch (strMenu)
	{
		case "파일":
			this._showDialog();
			break;
		case "삭제":
			this._clearImage();
			this.m_bUpdate = true;	// 이미지에 변화가 있음을 알리는 flag
			break;
	}
}

/**
 * 아톰리스트에 추가
 */
InputImageAtom.prototype.putAtom = function ()
{
	InputImageAtom._atoms[this.m_strVarName] = this;
}

InputImageAtom.prototype._createFileUploadComponent = function ()
{
	if (null == this.m_objFileUploadComponent)
	{
		this.m_objFileUploadComponent = new FileUploadComponent(this, this.m_strVarName);
		this.m_objFileUploadComponent.init();
	}
}

InputImageAtom.prototype._clearImage = function ()
{
	// 탭뷰안에 있는 이미지 입력란이 현재 보이는 상태가 아니라면 조회동작시에, 빈이미지로 변경하지 않는다.
	if ("none" != this.m_heAtom.parentElement.parentElement.style.display)
	{
		this._setImage(InputImageAtom.EMPTY_IMAGE_PATH);
	}
}


/** 
 *  이미지 갱신을 위해
 *  URI에 변화를 주어 새로 요청하도록
 *  매개변수 Count를 추가했습니다.
 */
InputImageAtom.prototype._getImage = function ()
{
	var strURL = "/ups/Download.do?ServiceName=InputImage" +
			"&TableName=" + this.m_strTableName + 
			"&FieldName=" + this.m_strFieldName + 
			"&WhereClause=" + this.m_strWhereClause +
			"&Count=" + this.m_nCount;
	
	this._setImage(encodeURI(strURL));
	this.m_nCount = this.m_nCount + 1;	// 다음 요청때 URI가 달라지도록 1증가
}

InputImageAtom.prototype._changeImage = function (strURL)
{
	if (false == this.m_bUpdate)
	{
		this.m_bUpdate = true;
	}

	var strImageSrc = this.m_objFileUploadComponent.getPath();
	
	this._setImage(strImageSrc);
}

InputImageAtom.prototype._clearHTML = function ()
{
	if (null != this.m_objFileUploadComponent)
	{
		this.m_objFileUploadComponent.init();
	}
}

InputImageAtom.prototype._initFlag = function ()
{
	this.m_bUpdate = false;
}

InputImageAtom.prototype._showDialog = function ()
{
	this.m_objFileUploadComponent.show();
}

InputImageAtom.prototype._hideDialog = function ()
{
	this.m_objFileUploadComponent.hide();
}

InputImageAtom.prototype._setImage = function (strImageSrc)
{
	this.m_heAtom.src = strImageSrc;
}

InputImageAtom.prototype.getProperty = function (nNameID, arArgs, objRetVal)
{
	switch (nNameID)
	{
		case 10 :case 286 : return this.get_GdiProperty (286, arArgs, objRetVal);
		case 12 :case 253 : return this.get_GdiProperty (253, arArgs, objRetVal);
		default : return StdCore.E_NOT_DEF_PROPERTY;
	}
}

InputImageAtom.prototype.setProperty = function (nNameID, arArgs, objRetVal)
{
	switch (nNameID)
	{
		case 10 :case 286 : return this.set_GdiProperty (286, arArgs, objRetVal);
		case 12 :case 253 : return this.set_GdiProperty (253, arArgs, objRetVal);
		default : return StdCore.E_NOT_DEF_PROPERTY;
	}
}

InputImageAtom.prototype.action = function (nPropID, arArgs, objRetVal)
{
	switch (nPropID)
	{
		default : return this.getProperty (nPropID, arArgs, objRetVal);
	}
}


////////////////////////////
// static field
//
InputImageAtom.EMPTY_IMAGE_PATH = "/ups/sys/image/support/empty.gif";

/**
 * 아톰리스트
 */
InputImageAtom._atoms = new Object();

InputImageAtom.getAtom = function (strVarName)
{
	return InputImageAtom._atoms[strVarName];
}

InputImageAtom.init = function ()
{
	for (var strVarName in InputImageAtom._atoms)
	{
		if ("" == strVarName)
			continue;
			
		var objAtom = InputImageAtom._atoms[strVarName];
		
		objAtom.init();
	}
}

InputImageAtom.makeRequest = function (xnAtomRequest)
{
	for (var strVarName in InputImageAtom._atoms)
	{
		var objAtom = InputImageAtom._atoms[strVarName];
		
		objAtom.makeRequest(xnAtomRequest);
	}
}

InputImageAtom.makeUploadRequest = function (xnUploadRequest)
{
	// 새로 선택한 그림이 있는지 확인
	var bUpload = false;
	
	for (var strVarName in InputImageAtom._atoms)
	{
		var objAtom = InputImageAtom._atoms[strVarName];
		
		if (objAtom.isUpdate())
		{
			bUpload = true;
			
			// make Upload Request
			objAtom.makeUploadRequest(xnUploadRequest);
		}
	}
	
	return bUpload;
}
/**
* 이미지 입력란의 필수입력을 체크한다.
*/
InputImageAtom.checkSureInput = function ()
{
	
	for (var strVarName in InputImageAtom._atoms)
	{
		var objAtom = InputImageAtom._atoms[strVarName];
		
		if (objAtom.isSureInput())
		{
			objAtom.checkSureInput();
		}
	}
}

/**
 *	컨텍스트 메뉴 보이기 mouseUp
 */
InputImageAtom.onMouseUp = function (heAtom, objEvent)
{
	// 마우스 오른쪽 버튼이면
	if (2 == objEvent.button)
	{
		var strVarName = heAtom.childNodes[0].id;	
		var objAtom = InputImageAtom.getAtom(strVarName);
		
		objAtom.onMouseUp(objEvent);
	}
}

/**
 *	컨텍스트메뉴 onBlur
 */
InputImageAtom.hideContextMenu = function (strVarName, heMenu)
{
	heMenu.style.visibility = "hidden";
}

/**
 *	컨텍스트 메뉴 클릭
 */
InputImageAtom.onMouseDownContextMenu = function (strVarName, strMenu)
{
	if (null != strVarName && null != strMenu)
	{
		var objAtom = InputImageAtom._atoms[strVarName];

		objAtom.onMouseDownContextMenu(strMenu);
	}
}
