/**
 * DecorationAtoms JS 클래스 목록
 * DecorImageAtom
 * FreeLineAtom
 * GroupBoxAtom
 * ItemNameAtom
 * RectangleAtom
 * StraightLineAtom
 * TabViewPage
 */

/**
 * 그림삽입 아톰 
 */
function DecorImageAtom (strVarName, strHyperLinkName, strScrollName, nScriptIndex)
{
	this.Atom (strVarName, "", strScrollName, -1, nScriptIndex);
	
	this.m_strHyperLinkName = strHyperLinkName;
	this.m_strScrollName = strScrollName;
	
	this.m_heAtom = document.getElementById("__DECORIMAGE_" + strVarName);
	this.m_nRowIndex = -1;
	
	if (null != strHyperLinkName && 0 < strHyperLinkName.length)
	{
		this.m_heAtom.style.cursor = "hand";
	}
}

DecorImageAtom.prototype = new Atom ();
DecorImageAtom.prototype.constructor = DecorImageAtom;

DecorImageAtom.prototype.init = function ()
{
}

DecorImageAtom.prototype.isSureInput = function ()
{
	return false;
}

DecorImageAtom.prototype.isSureInputScroll = function ()
{
	return false;
}

DecorImageAtom.prototype.getHTML = function ()
{
	return this.m_heAtom;
}

/**
 * 아톰리스트에 추가
 */
DecorImageAtom.prototype.putAtom = function ()
{
	DecorImageAtom._atoms[this.m_strVarName] = this;
}

DecorImageAtom.prototype.setHTML = function (heAtom)
{
	this.m_heAtom = heAtom;
}

/**
 * @return 아톰타입 "DecorImageAtom"
 */
DecorImageAtom.prototype.getAtomType = function ()
{
	return "DecorImageAtom";
}

DecorImageAtom.prototype.setRowIndex = function (nIndex)
{
	this.m_nRowIndex = nIndex;
}

DecorImageAtom.prototype.setRefVarName = function (strRefVarName)
{
}

DecorImageAtom.prototype.displayValue = function ()
{
	return;
}

DecorImageAtom.prototype.isSureInputScroll = function ()
{
	return false;
}

/**
 * 스크롤에 묶인 경우 유효행 체크를 합니다
 */
DecorImageAtom.prototype.checkSureInputScroll = function ()
{
	return true;
}

/**
 * 객체 clone 메소드 입니다.
 * @param bIsHtml html 값을 설정할지 결정 
 */
DecorImageAtom.prototype.clone = function (bIsHtml)
{
	var objNewAtom = new DecorImageAtom(this.m_strVarName, this.m_strHyperLinkName, this.m_strScrollName, this.m_nScriptIndex);
					
	if (false != bIsHtml && null != this.m_heAtom)
	{
 		objNewAtom.setHTML(this.m_heAtom.cloneNode(true));
 	}
 	else
 	{
 		objNewAtom.setHTML(null);
 	}
 	
 	return objNewAtom;
}

DecorImageAtom.prototype.makeRequest = function (xnRequest)
{
	var xnAtom = XmlLib.createChild(xnRequest, "DecorImage");
	
	xnAtom.setAttribute("VarName", this.m_strVarName);
}

DecorImageAtom.prototype.onClick = function ()
{
	// 하이퍼링크 동작, 가장 마지막에 수행해야 합니다. 다른 동작 추가시 위로 추가하세요
	if (null != this.m_strHyperLinkName && 0 != this.m_strHyperLinkName.length && ContainsWebHyperDataAtom())
	{
		var objHyperLinkAtom = Model.getAtom(this.m_strHyperLinkName);
		if (null != objHyperLinkAtom)
		{
			// 먼저 하이퍼 링크의 링크 동작을 제외한 onClick을 수행한다. (스크립트동작)
			if (-1 != objHyperLinkAtom.onLinkClick())
			{
				objHyperLinkAtom.connectLink(this.m_heAtom);
			}
		}
	}
}

/**
 * 인자로 받은 값만큼 높이를 변화시킨다
 * 
 * @param nResizeValue (높이 변경 값)
 */
DecorImageAtom.prototype.resizeHeight = function (nResizeValue)
{
	var nHeight = this.m_heAtom.offsetHeight;
	
	this.m_heAtom.style.height = (nHeight + nResizeValue) + "px";
}

/**
 * 인자로 받은 값만큼 넓이를 변화시킨다
 * 
 * @param nResizeValue (높이 변경 값)
 */
DecorImageAtom.prototype.resizeWidth = function (nResizeValue)
{
	var nWidth = this.m_heAtom.offsetWidth;
	
	this.m_heAtom.style.width = (nWidth + nResizeValue) + "px";
}

/**
 * 인자로 받은 값만큼 top을 변경시킨다
 * 
 * @param nRepositionValue (top 변경 값)
 */
DecorImageAtom.prototype.repositionYPos = function (nRepositionValue)
{
	var nTop = Number(this.m_heAtom.style.top.replace("px", ""));
	
	this.m_heAtom.style.top = (nTop + nRepositionValue) + "px";
}

/**
 * 인자로 받은 값만큼 left를 변경시킨다
 * 
 * @param nRepositionValue (left 변경 값)
 */
DecorImageAtom.prototype.repositionXPos = function (nRepositionValue)
{
	var nLeft = Number(this.m_heAtom.style.left.replace("px", ""));
	
	this.m_heAtom.style.left = (nLeft + nRepositionValue) + "px";
}

DecorImageAtom.prototype.setValue = function (strImagePath)
{
	if ("" != strImagePath)
	{
		strImagePath = Utils.removePQPath(strImagePath);
		strImagePath = strImagePath.replace('\\','\/');
		strImagePath = "/ups/" + GetProjectName() + "/" + strImagePath;
		
		this.m_heAtom.style.backgroundImage = 'url(' + strImagePath + ')';
	}
}

/**
 * 선택표시 (f9 기능)
 */
DecorImageAtom.prototype.vanish = function ()
{
	// TODO : 선택표시 구현
}

DecorImageAtom.prototype.getProperty = function (nNameID, arArgs, objRetVal)
{
	switch (nNameID)
	{
		case 18 :case 286 : return this.get_GdiProperty (286, arArgs, objRetVal);
		default : return StdCore.E_NOT_DEF_PROPERTY;
	}
}

DecorImageAtom.prototype.setProperty = function (nNameID, arArgs, objRetVal)
{	
	switch (nNameID)
	{
		case 0 : case 265 : return this.set_ImageProperty (265, arArgs, objRetVal);
		case 18 :case 286 : return this.set_GdiProperty (286, arArgs, objRetVal);
		default : return StdCore.E_NOT_DEF_PROPERTY;
	}
}

DecorImageAtom.prototype.set_ImageProperty = function (nNameID, arArgs, pValue)
{
	switch (nNameID)
	{
		case 265:		// 배경그림경로
			this.setValue(pValue.toStringX());
			break;
			
		default:
			return StdCore.E_NOT_DEF_PROPERTY;
	}
	
	return StdCore.S_OK;
}

/**
 * 아톰리스트
 */
DecorImageAtom._atoms = new Object();

DecorImageAtom.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);
				}
			}
		}
	}

	return DecorImageAtom._atoms[strVarName];
}

DecorImageAtom.onClick = function (strVarName, strScrollName, heAtom)
{
	var objAtom = DecorImageAtom.getAtom(strVarName, strScrollName, heAtom);
	
	if (null != objAtom)
	{
		objAtom.onClick();
	}
}

DecorImageAtom.makeRequest = function (xnAtomRequest)
{
	for (var strVarName in DecorImageAtom._atoms)
	{
		DecorImageAtom._atoms[strVarName].makeRequest(xnAtomRequest);
	}
}


/**
 * 사선  Javascript 클래스 목록
 * 	- FreeLineAtom
 *	- FreeLineStyle
 */

function FreeLineAtom (strVarName, bVanish, objStyle)
{
	this.m_strVarName = strVarName;
	this.m_bVanish = bVanish;	
	this.m_objStyle = objStyle;
	
	this.m_heAtom = document.getElementById(strVarName);
	
	this.m_nRowIndex = -1;
}

FreeLineAtom.prototype.init = function ()
{
	this.setPosition();
}

FreeLineAtom.prototype.getVarName = function ()
{
	return this.m_strVarName;
}

// XmlAtomDefine에 설정된 아톰 타입 문자열을 리턴해야 한다.
FreeLineAtom.prototype.getAtomType = function ()
{
	return "FreeLine";
}

FreeLineAtom.prototype.getHTML = function ()
{
	return this.m_heAtom;
}

FreeLineAtom.prototype.setHTML = function (heAtom)
{
	this.m_heAtom = heAtom;
}

FreeLineAtom.prototype.setRowIndex = function (nIndex)
{
	this.m_nRowIndex = nIndex;
}

FreeLineAtom.prototype.setRefVarName = function (strRefVarName)
{

}

FreeLineAtom.prototype.isSureInput = function ()
{
	return false;
}

FreeLineAtom.prototype.isSureInputScroll = function ()
{
	return false;
}

/**
 * 스크롤에 묶인 경우 유효행 체크를 합니다
 */
FreeLineAtom.prototype.checkSureInputScroll = function ()
{
	return true;
}

/**
 * 객체 clone 메소드 입니다.
 * @param bIsHtml html 값을 설정할지 결정 
 */
FreeLineAtom.prototype.clone = function (bIsHtml)
{
	var objNewAtom = new FreeLineAtom(this.m_strVarName, this.m_bVanish, this.m_objStyle);
					
	if (false != bIsHtml && null != this.m_heAtom)
	{
		var heClone = this.m_heAtom.cloneNode(true);
		
		// VML속성은 클론 되지 않기 때문에 카피 해준다.
		heClone.to = this.m_heAtom.to;
		heClone.from = this.m_heAtom.from;
		heClone.strokecolor = this.m_heAtom.strokecolor;
		heClone.strokeweight = this.m_heAtom.strokeweight;
		heClone.firstChild.dashstyle = this.m_heAtom.firstChild.dashstyle;
		
 		objNewAtom.setHTML(heClone);
 	}
 	else
 	{
 		objNewAtom.setHTML(null);
 	}
 	
 	return objNewAtom;
}

/**
 * 선택표시 (f9 기능)
 */
FreeLineAtom.prototype.vanish = function ()
{
	if (this.m_bVanish)
	{
		// 현재 감춤 상태이면 표시한다.
		if ("hidden" == this.m_heAtom.style.visibility)
		{
			this.m_heAtom.style.visibility = "visible";
		}
		else	// 표시된 상태이면 감춘다.
		{
			this.m_heAtom.style.visibility = "hidden";
		}
	}
}

/**
 * 아톰리스트에 추가
 */
FreeLineAtom.prototype.putAtom = function ()
{
	FreeLineAtom._atoms[this.m_strVarName] = this;
}

FreeLineAtom.prototype.setPosition = function ()
{
	this.m_nFromX = this.m_objStyle.getX1Pos();
	this.m_nToX = this.m_objStyle.getX2Pos();
	this.m_nFromY = this.m_objStyle.getY1Pos();
	this.m_nToY = this.m_objStyle.getY2Pos();
}

/**
 * 인자로 받은 값만큼 top을 변경시킨다
 * @param nRepositionValue (top 변경 값)
 */
FreeLineAtom.prototype.repositionYPos = function (nRepositionValue)
{
	this.m_nFromY += nRepositionValue;
	this.m_nToY += nRepositionValue;
	 
	this.m_heAtom.from = this.m_nFromX + "px," + this.m_nFromY + "px";
	this.m_heAtom.to =  this.m_nToX + "px," + this.m_nToY + "px";
}

/**
 * 인자로 받은 값만큼 left를 변경시킨다
 * @param nRepositionValue (left 변경 값)
 */
FreeLineAtom.prototype.repositionXPos = function (nRepositionValue)
{
	this.m_nFromX += nRepositionValue;
	this.m_nToX += nRepositionValue;
	
	this.m_heAtom.from = this.m_nFromX + "px," + this.m_nFromY + "px";
	this.m_heAtom.to =  this.m_nToX + "px," + this.m_nToY + "px";
}

/**
 * 인자로 받은 값만큼 높이를 변화시킨다
 * 
 * @param nResizeValue (높이 변경 값)
 */
FreeLineAtom.prototype.resizeHeight = function (nResizeValue)
{
	this.m_nToY += nResizeValue;
	
	this.m_heAtom.to = this.m_nToX + "px," + this.m_nToY + "px";
}

/**
 * 인자로 받은 값만큼 넓이를 변화시킨다
 * 
 * @param nResizeValue (넓이 변경 값)
 */
FreeLineAtom.prototype.resizeWidth = function (nResizeValue)
{
	this.m_nToX += nResizeValue;
	
	this.m_heAtom.to = this.m_nToX + "px," + this.m_nToY + "px";
}

/**
 * 아톰리스트
 */
FreeLineAtom._atoms = new Object();

FreeLineAtom.init = function ()
{
	for (var strVarName in FreeLineAtom._atoms)
	{
		var objAtom = FreeLineAtom._atoms[strVarName];
		
		if (null != objAtom)
		{
			objAtom.init();
		}
	}
}

FreeLineAtom.getAtom = function (strVarName)
{
	return FreeLineAtom._atoms[strVarName];
}


function FreeLineStyle (nX1Pos, nY1Pos, nX2Pos, nY2Pos, strColor, nWidth, nStyle)
{
	this.m_nX1Pos = nX1Pos;
	this.m_nY1Pos = nY1Pos;
	this.m_nX2Pos = nX2Pos;
	this.m_nY2Pos = nY2Pos;
	
	this.m_strColor = strColor;
	this.m_nWidth = nWidth;
	this.m_nStyle = nStyle;
}

FreeLineStyle.prototype.getX1Pos = function ()
{
	return this.m_nX1Pos;
}

FreeLineStyle.prototype.getY1Pos = function ()
{
	return this.m_nY1Pos;
}

FreeLineStyle.prototype.getX2Pos = function ()
{
	return this.m_nX2Pos;
}

FreeLineStyle.prototype.getY2Pos = function ()
{
	return this.m_nY2Pos;
}

FreeLineStyle.prototype.getColor = function ()
{
	return this.m_strColor;
}

FreeLineStyle.prototype.getWidth = function ()
{
	return this.m_nWidth;
}

FreeLineStyle.prototype.getStyle = function ()
{
	return this.m_nStyle;
}


/**
 *	그룹박스
 */
function GroupBoxAtom (strVarName, bVanish)
{
	this.m_strVarName = strVarName;
	this.m_bVanish = bVanish;
	
	this.m_heAtom = document.getElementById(strVarName);
}

/**
 *	@return 아톰의 HTML 엘리먼트
 */
GroupBoxAtom.prototype.getHTML = function ()
{
	return this.m_heAtom;
}

GroupBoxAtom.prototype.getVarName = function ()
{
	return this.m_strVarName;
}

/**
 * 선택표시 (f9 기능)
 */
GroupBoxAtom.prototype.vanish = function ()
{
	if (this.m_bVanish)
	{
		if ("hidden" == this.m_heAtom.style.visibility)
		{
			this.m_heAtom.style.visibility = "visible";
		}
		else
		{
			this.m_heAtom.style.visibility = "hidden";
		}
	}
}

/**
 *	초기화
 */
GroupBoxAtom.prototype.init = function ()
{
	//
}

/**
 * 아톰리스트에 추가
 */
GroupBoxAtom.prototype.putAtom = function ()
{
	GroupBoxAtom._atoms[this.m_strVarName] = this;
}

/**
 * 아톰리스트
 */
GroupBoxAtom._atoms = new Object();

/** 
 *	@param strVarName - 아톰명
 *	@return 아톰명에 해당되는 아톰
 */
GroupBoxAtom.getAtom = function (strVarName)
{
	var objAtom = GroupBoxAtom._atoms[strVarName];
	
	if (null != objAtom)
	{
		return objAtom;
	}
	
	return null;
}

/**
 *	초기화
 */
GroupBoxAtom.init = function ()
{
	for (var strVarName in GroupBoxAtom._atoms)
	{
		var objAtom = GroupBoxAtom._atoms[strVarName];
		
		objAtom.init();
	}
}

/**
 * 항목명표시란 아톰
 **/
function ItemNameAtom (strValue, strVarName, strRefVarName, bVanish)
{
	this.m_strValue = strValue;
	this.m_heAtom = document.getElementById(strVarName);
	this.m_strVarName = strVarName;
	this.m_strRefVarName = strRefVarName;
	this.m_bVanish = bVanish;
}

//////////////////////////////////////
// public method
//

ItemNameAtom.prototype.getHTML = function ()
{
	return this.m_heAtom;
}
ItemNameAtom.prototype.getVarName = function ()
{
	return this.m_strVarName;
}

ItemNameAtom.prototype.getRefVarName = function ()
{
	return this.m_strRefVarName;
}

ItemNameAtom.prototype.setRefVarName = function(strRefVarName)
	{
		this.m_strRefVarName = strRefVarName;
	}

ItemNameAtom.prototype.getValue = function ()
{
	return this.m_strValue;
}

ItemNameAtom.prototype.setValue = function (strValue)
{
	var heItemName = this.m_heAtom;
	var heTBody = heItemName.firstChild;
	var heTr = heTBody.firstChild;
	var heTd = heTr.firstChild;
	CrossBrowsing.setInnerText(heTd, strValue);
}

/**
 * 선택표시 (f9 기능)
 */
ItemNameAtom.prototype.vanish = function ()
{
	if (this.m_bVanish)
	{
	// 현재 감춤 상태이면 표시한다.
	if ("hidden" == this.m_heAtom.style.visibility)
	{
		this.m_heAtom.style.visibility = "visible";
	}
	else	// 표시된 상태이면 감춘다.
	{
		this.m_heAtom.style.visibility = "hidden";
	}
	}
}

ItemNameAtom.prototype.makeRequest = function (xnRequest)
{
	var xnAtom = XmlLib.createChild(xnRequest, "ItemName");
	
	xnAtom.setAttribute("VarName", this.m_strVarName);
	
	var strValue = this.getValue();
	XmlLib.setTextValue(xnAtom, strValue);
}

/**
 * 아톰리스트에 추가
 */
ItemNameAtom.prototype.putAtom = function ()
{
	ItemNameAtom._atoms[this.m_strVarName] = this;
}

/**
 * 아톰리스트
 */
ItemNameAtom._atoms = new Object();
 
ItemNameAtom.getAtom = function (strVarName)
{
	var objAtom = ItemNameAtom._atoms[strVarName];
	
	if (null != objAtom)
	{
		return objAtom;
	}
	
	return null;
}

ItemNameAtom.makeRequest = function (xnAtomRequest)
{
	for (var strVarName in ItemNameAtom._atoms)
	{
		ItemNameAtom._atoms[strVarName].makeRequest(xnAtomRequest);
	}
}

/**
 *	사각형 아톰 Class
 */
function RectangleAtom (strVarName, strRefVarName, isInsertComma, isNotZero, strPeriod, bVanish, nPenWidth, strValue, strHyperLinkName, strScrollName, objFont, nScriptIndex)
{
	this.Atom (strVarName, strRefVarName, strScrollName, -1, nScriptIndex);
	
	this.m_heAtom = document.getElementById(strVarName);
	this.m_heAtomValue = document.getElementById(strVarName + "_value");
	this.m_strValue = strValue;
	this.m_isInsertComma = isInsertComma;
	this.m_isNotZero = isNotZero;
	this.m_strPeriod = strPeriod;
	this.m_bVanish = bVanish;
	this.m_nPenWidth = nPenWidth; // border 넓이
	this.m_strHyperLinkName = strHyperLinkName;
	this.m_objFont = objFont; // 폰트 정보
	
	this.m_nRowIndex = -1;
	
	if (null != strHyperLinkName && 0 < strHyperLinkName.length)
	{
		this.m_heAtom.firstChild.style.cursor = "hand";
	}
	
	if (!is_iev)
	{
		var objVmlLabel = document.getElementById("__LABEL_" + this.m_strVarName);
		if (null != objVmlLabel)
		{
			objVmlLabel.style.border = "solid 1px #000000";
		}
	}
}

RectangleAtom.prototype = new Atom ();
RectangleAtom.prototype.constructor = RectangleAtom;

RectangleAtom.prototype.init = function ()
{
}

RectangleAtom.prototype.getHTML = function ()
{
	return this.m_heAtom;
}

RectangleAtom.prototype.setHTML = function (heAtom)
{
	this.m_heAtom = heAtom;
}

/**
 * @return 아톰타입 "RectangleAtom"
 */
RectangleAtom.prototype.getAtomType = function ()
{
	return "RectangleAtom";
}

RectangleAtom.prototype.setRefVarName = function (strRefVarName)
{
	this.m_strRefVarName = strRefVarName
}

RectangleAtom.prototype.getInsertComma = function ()
{
	return this.m_isInsertComma;
}

RectangleAtom.prototype.getNotZero = function ()
{
	return this.m_isNotZero;
}

RectangleAtom.prototype.getPeriod = function ()
{
	return this.m_strPeriod;
}

RectangleAtom.prototype.getValue = function ()
{
	return this.m_strValue;
}

/**
 * 사각형 아톰은 필드정보가 없기 때문에 의미가 없지만  
 * 연결검색에서 사각형 아톰도 쓰일 수 있기 때문에 연결검색에서 쓰이는 인터페이스를 구현해준다.<b> 
 */
RectangleAtom.prototype.getFieldName = function ()
{
	return "";
}

RectangleAtom.prototype.setRowIndex = function (nIndex)
{
	this.m_nRowIndex = nIndex;
}

RectangleAtom.prototype.isSureInput = function ()
{
	return false;
}

RectangleAtom.prototype.isSureInputScroll = function ()
{
	return false;
}

/**
 * 스크롤에 묶인 경우 유효행 체크를 합니다
 */
RectangleAtom.prototype.checkSureInputScroll = function ()
{
	return true;
}

/**
 * 객체 clone 메소드 입니다.
 * @param bIsHtml html 값을 설정할지 결정 
 */
RectangleAtom.prototype.clone = function (bIsHtml)
{
	var objNewAtom = new RectangleAtom(this.m_strVarName,
									this.m_strRefVarName,
									this.m_isInsertComma,
									this.m_isNotZero,
									this.m_strPeriod,
									this.m_bVanish,
									this.m_nPenWidth,
									this.m_strValue,
									this.m_strHyperLinkName,
									this.m_strScrollName,
									this.m_objFont,
									this.m_nScriptIndex);
					
	if (bIsHtml && this.m_heAtom)
	{
 		var heClone = this.m_heAtom.cloneNode(true);
		
		// VML속성은 클론 되지 않기 때문에 카피 해준다.
		if (this.m_heAtom.fillcolor)
		{
			heClone.fillcolor =  this.m_heAtom.fillcolor;
		}
		if (this.m_heAtom.strokecolor)
		{
			heClone.strokecolor = this.m_heAtom.strokecolor;
		}
		if (this.m_heAtom.strokeweight)
		{
			heClone.strokeweight = this.m_heAtom.strokeweight;
		}
		if (this.m_heAtom.coordsize)
		{
			heClone.coordsize = this.m_heAtom.coordsize;
		}
		if (this.m_heAtom.childNodes[1])
		{
			heClone.childNodes[1].dashstyle = this.m_heAtom.childNodes[1].dashstyle;
		}
		if (this.m_heAtom.childNodes[1])
		{
			heClone.childNodes[1].opacity = this.m_heAtom.childNodes[1].opacity;
		}
		if (this.m_heAtom.childNodes[2])
		{
			heClone.childNodes[2].opacity = this.m_heAtom.childNodes[2].opacity;
		}
		if (this.m_heAtom.childNodes[2])
		{
			heClone.childNodes[2].filltype = this.m_heAtom.childNodes[2].filltype;
		}
		
 		objNewAtom.setHTML(heClone);
 	}
 	else
 	{
 		objNewAtom.setHTML(null);
 	}
 	
 	return objNewAtom;
}

/**
 *	아톰의 값을 설정한다.
 *	@param 아톰 내부에 보여질 스트링
 */
RectangleAtom.prototype.setValue = function (strValue)
{
	if (!this.m_heAtom)
	{
		return;
	}
	
	this.m_strValue = strValue;
	
	var objAtomElement = this.m_heAtomValue;
	if (objAtomElement)
	{
		CrossBrowsing.setInnerText(objAtomElement, this._getFormatValue(strValue));
	}
}

RectangleAtom.prototype.displayValue = function ()
{
	var objAtomElement = this.m_heAtomValue;
	if (null != objAtomElement)
	{
		CrossBrowsing.setInnerText(objAtomElement, this.m_strValue);
	}	
}

/**
 * 선택표시 (f9 기능)
 */
RectangleAtom.prototype.vanish = function ()
{
	if (this.m_bVanish)
	{
		// 현재 감춤 상태이면 표시한다.
		if ("hidden" == this.m_heAtom.style.visibility)
		{
			this.m_heAtom.style.visibility = "visible";
		}
		else // 표시된 상태이면 감춘다.
		{
			this.m_heAtom.style.visibility = "hidden";
		}
	}
}

RectangleAtom.prototype.makeRequest = function (xnRequest)
{
	var xnAtom = XmlLib.createChild(xnRequest, "RectangleAtom");
	
	xnAtom.setAttribute("VarName", this.m_strVarName);
	
	var strValue = this.getValue();
	XmlLib.setTextValue(xnAtom, strValue);
}

/**
 * 인자로 받은 값만큼 높이를 변화시킨다
 * 
 * @param nResizeValue (높이 변경 값)
 */
RectangleAtom.prototype.resizeHeight = function (nResizeValue)
{
	// Vml 의 offsetHeight 값이 style 의 값과 차이가 난다
	// Vml 의 규격이 조검더 크다 
	// Vml 은 style로 부터 값을 얻어온다
	var strHeight = this.m_heAtom.style.height;
	var strTitleHeight = this.m_heAtom.firstChild.style.height;
	
	var nHeight = 0;
	var nTitleHeight = 0;
	
	if (null != strHeight && strTitleHeight)
	{
		try
		{
			strHeight = Utils.replace(strHeight, "px", "");
			strTitleHeight = Utils.replace(strTitleHeight, "px", "");
			
			nHeight = parseInt(strHeight);
			nTitleHeight = parseInt(strTitleHeight);
		}
		catch (e)
		{
			nHeight = this.m_heAtom.offsetHeight;
			nTitleHeight = this.m_heAtom.firstChild.offsetHeight;
		}
		
		this.m_heAtom.style.height = (nHeight + nResizeValue) + "px";
		this.m_heAtom.firstChild.style.height = (nTitleHeight + nResizeValue) + "px";
	}
}

/**
 * 인자로 받은 값만큼 넓이를 변화시킨다
 * 
 * @param nResizeValue (높이 변경 값)
 */
RectangleAtom.prototype.resizeWidth = function (nResizeValue)
{
	// Vml 의 offsetHeight 값이 style 의 값과 차이가 난다
	// Vml 의 규격이 조검더 크다 
	// Vml 은 style로 부터 값을 얻어온다
	var strWidth = this.m_heAtom.style.width;
	var nWidth = 0;
	
	if (null != strWidth)
	{
		try
		{
			strWidth = Utils.replace(strWidth, "px", "");
			
			nWidth = parseInt(strWidth);
		}
		catch (e)
		{
			nWidth = this.m_heAtom.offsetWidth;
		}
		
		this.m_heAtom.style.width = (nWidth + nResizeValue) + "px";
	}		
}

/**
 * 인자로 받은 값만큼 top을 변경시킨다
 * 
 * @param nRepositionValue (top 변경 값)
 */
RectangleAtom.prototype.repositionYPos = function (nRepositionValue)
{
	var strTop = this.m_heAtom.style.top;
	var nTop = 0;
	var nGap = this.m_nPenWidth / 2;
	
	if (null != strTop)
	{
		try
		{
			strTop = Utils.replace(strTop, "px", "");
			
			nTop = parseInt(strTop);
		}
		catch (e)
		{
			nTop = this.m_heAtom.offsetTop;
		}
		
		nTop += nGap;
		
		this.m_heAtom.style.top = (nTop + nRepositionValue) + "px";
	}
}

/**
 * 인자로 받은 값만큼 left를 변경시킨다
 * 
 * @param nRepositionValue (left 변경 값)
 */
RectangleAtom.prototype.repositionXPos = function (nRepositionValue)
{
	var strLeft = this.m_heAtom.style.left;
	var nLeft = 0;
	var nGap = this.m_nPenWidth / 2;
	
	if (null != strLeft)
	{
		try
		{
			strLeft = Utils.replace(strLeft, "px", "");
			
			nLeft = parseInt(strLeft);
		}
		catch (e)
		{
			nLeft = this.m_heAtom.offsetLeft;
		}
		
		nLeft += nGap;
		
		this.m_heAtom.style.left = (nLeft + nRepositionValue) + "px";
	}
}

/**
 * 사각형을 클릭했을 때
 */ 
RectangleAtom.prototype.onClick = 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)
		{
			// 먼저 하이퍼 링크의 링크 동작을 제외한 onClick을 수행한다. (스크립트동작)
			if (-1 != objHyperLinkAtom.onLinkClick())
			{
				objHyperLinkAtom.connectLink(this.m_heAtom);
			}
		}
	}
}

/**
 * 사각형에 마우스가 오버 되었을 때
 */
RectangleAtom.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);
			}
		}
	}
}

RectangleAtom.prototype.onMouseOut = function ()
{
	// 하이퍼링크에 묶여 있다면, 원래 글꼴로 돌아온다.
	if (null != this.m_strHyperLinkName && 0 != this.m_strHyperLinkName.length && ContainsWebHyperDataAtom())
	{
		this.changeFont(this.m_objFont);
	}
}

RectangleAtom.prototype.changeFont = function (objFont)
{
	this.m_heAtom.firstChild.style.fontFamily = objFont.getFontName();
	this.m_heAtom.firstChild.style.fontSize = objFont.getFontSize() + "pt";
	this.m_heAtom.firstChild.style.color = objFont.getFontColor();
	if (objFont.isBold())
	{
		this.m_heAtom.firstChild.style.fontWeight = "bold";
	}
	else
	{
		this.m_heAtom.firstChild.style.fontWeight = "normal";
	}
	
	if (objFont.isItalic())
	{
		this.m_heAtom.firstChild.style.fontStyle = "italic";
	}
	else
	{
		this.m_heAtom.firstChild.style.fontStyle = "normal";
	}
	
	if (objFont.isUnderLine())
	{
		this.m_heAtom.firstChild.style.textDecoration = "underline";
	}
	else if (objFont.isStrikeOut())
	{
		this.m_heAtom.firstChild.style.textDecoration = "line-through";
	}
	else
	{
		this.m_heAtom.firstChild.style.textDecoration = "none";
	}
}

RectangleAtom.prototype.clear = function ()
{
	this.setValue("");
}

/**
 * 아톰리스트에 추가
 */
RectangleAtom.prototype.putAtom = function ()
{
	RectangleAtom._atoms[this.m_strVarName] = this;
}

RectangleAtom.prototype.setFont = function (strAttribName, objValue)
{
	if ("Size" == strAttribName)
	{
		this.m_heAtom.firstChild.style.fontSize = objValue + "pt";
		this.m_objFont.setFontSize(objValue);
	}
	else if ("Bold" == strAttribName)
	{
		if (objValue)
		{
			this.m_heAtom.firstChild.style.fontWeight = "bold";
			this.m_objFont.setBold();
		}
		else
		{
			this.m_heAtom.firstChild.style.fontWeight = "normal";
			this.m_objFont.removeBold();
		}
	}
	else if ("Italic" == strAttribName)
	{
		if (objValue)
		{
			this.m_heAtom.firstChild.style.fontStyle = "italic";
			this.m_objFont.setItalic();
		}
		else
		{
			this.m_heAtom.firstChild.style.fontStyle = "normal";
			this.m_objFont.removeItalic();
		}
	}
	else if ("UnderLine" == strAttribName)
	{
		if (objValue)
		{
			this.m_heAtom.firstChild.style.textDecoration = "underline";
			this.m_objFont.setUnderLine();
		}
		else
		{
			this.m_heAtom.firstChild.style.textDecoration = "none";
			this.m_objFont.removeUnderLine();
		}
	}
	else if ("StrikeOut" == strAttribName)
	{
		if (objValue)
		{
			this.m_heAtom.firstChild.style.textDecoration = "line-through";
			this.m_objFont.setStrikeOut();
		}
		else
		{
			this.m_heAtom.firstChild.style.textDecoration = "none";
			this.m_objFont.removeStrikeOut();
		}
	}
	else if ("Family" == strAttribName)
	{
		this.m_heAtom.firstChild.style.fontFamily = objValue;
		this.m_objFont.setFontName(objValue);
	}
	else if ("Color" == strAttribName)
	{
		this.m_heAtom.firstChild.style.color = objValue;
		this.m_objFont.setFontColor(objValue);
	}
}

/**
 *	@param 콤마삽입, 0표시안함, 소수자릿수 처리할 스트링
 *	@return 콤마삽입, 0표시안함, 소수자릿수 처리된 스트링
 */
RectangleAtom.prototype._getFormatValue = function (strValue)
{	
	var strFormatValue = strValue;
	
	// 실수 형태일 때만 처리
	if (!isNaN(strFormatValue))
	{	
		// 0표시안함 처리
		if (true == this._isNotDisplayZero(strFormatValue))
		{
			return "";
		}
		else
		{
			if("Y" == this.m_isNotZero)
			{
				strFormatValue = parseFloat(strValue).toString();
			}
		}

		// 소숫점 자릿수 조절
		strFormatValue = this._handlePeriod(strFormatValue);
		
		// 콤마삽입
		if ("Y" == this.m_isInsertComma)
		{
			strFormatValue = Utils.insertComma(strFormatValue);
			
			return strFormatValue;			
		}
	}

	return strFormatValue;
}

/**
 * 소숫점 자리수 조절
 */
RectangleAtom.prototype._handlePeriod = function(strValue)
{
	if (isNaN(strValue) || -1 == strValue.indexOf("."))
	{
		return strValue;
	}
	
	var nPeriod = Utils.initPeriod(this.m_strPeriod);
	
	if (0 >= nPeriod)
	{
		return strValue;
	}
	
	var fValue = parseFloat(strValue);
	var strPeriodValue = fValue.toFixed(nPeriod);	// nPeriod 만큼 숫자를 고정 소수점 표시로 나타낸다.
	
	return strPeriodValue;
}

/**
 * 값이 0이고 0표시안함인지 확인한다.
 *
 * @param strValue 값
 *
 * @return 값이 0이고 0표시안함이면 true, 아니면 false 
 */
RectangleAtom.prototype._isNotDisplayZero = function (strValue)
{
	var nValue = parseFloat(strValue);
	
	if (0 == nValue && "Y" == this.m_isNotZero)
	{
		return true;
	}
	
	return false;
}

RectangleAtom.prototype.getProperty = function (wNameID, pvaArgs, pRetVal)
{
	switch (wNameID)
	{
		case 0 : case 203 : return this.get_RectProperty (203, pvaArgs, pRetVal);
		case 7 : case 286 : return this.get_GdiProperty (286, pvaArgs, pRetVal);
		default : return StdCore.E_NOT_DEF_PROPERTY;
	}
}

RectangleAtom.prototype.get_RectProperty = function (wNameID, pvaArgs, pRetVal)
{
	switch (wNameID)
		{
		case 203: // 값
		case 279: // 제목
			pRetVal.setValue(this.m_strValue);
			break;
	}
	return StdCore.S_OK;
}

RectangleAtom.prototype.setProperty = function (wNameID, pvaArgs, pRetVal)
{
	switch (wNameID)
	{
		case 0 : case 203 : return this.set_RectProperty (203, pvaArgs, pRetVal);
		case 7 : case 286 : return this.set_GdiProperty (286, pvaArgs, pRetVal);
		default : return StdCore.E_NOT_DEF_PROPERTY;	
	}
}

RectangleAtom.prototype.set_RectProperty = function (wNameID, pvaArgs, pValue)
{
	switch (wNameID)
	{
		case 203: // 값
		case 279: // 제목
			this.setValue(pValue.toStringX());
			break;
	}
	return StdCore.S_OK;
}


/**
 * 아톰리스트
 */
RectangleAtom._atoms = new Object();

RectangleAtom.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 RectangleAtom._atoms[strVarName];
}

RectangleAtom.getRefAtom = function (strRefVarName)
{
	for (var strVarName in RectangleAtom._atoms)
	{
		var objRefAtom = RectangleAtom._atoms[strVarName];
		if (strRefVarName == objRefAtom.getRefVarName())
		{
			return objRefAtom;
		}
	}
	
	return null;
}

RectangleAtom.makeRequest = function (xnAtomRequest)
{
	for (var strVarName in RectangleAtom._atoms)
	{
		RectangleAtom._atoms[strVarName].makeRequest(xnAtomRequest);
	}
}

RectangleAtom.onClick = function (strVarName, strScrollName, heAtom)
{
	var objRect = RectangleAtom.getAtom(strVarName, strScrollName, heAtom);
	
	if (null != objRect)
	{
		objRect.onClick();
	}
}

RectangleAtom.onMouseOver = function (strVarName, strScrollName, heAtom)
{
	var objRect = RectangleAtom.getAtom(strVarName, strScrollName, heAtom);
	
	if (null != objRect)
	{
		objRect.onMouseOver();
	}
}

RectangleAtom.onMouseOut = function (strVarName, strScrollName, heAtom)
{
	var objRect = RectangleAtom.getAtom(strVarName, strScrollName, heAtom);
	
	if (null != objRect)
	{
		objRect.onMouseOut();
	}
}


/**
 * 직선 그리기 아톰 Class
 * 손영훈
 */
function StraightLineAtom (strVarName, bVanish, nFromX, nFromY, nToX, nToY)
{
	this.m_strVarName = strVarName;
	this.m_bVanish = bVanish;
	this.m_nFromX = nFromX; // x1 좌표
	this.m_nFromY = nFromY; // y1 좌표
	this.m_nToX = nToX; // x2 좌표
	this.m_nToY = nToY; // y2 좌표
	
	this.m_heAtom = document.getElementById(strVarName);
	this.m_nRowIndex = -1;
}

StraightLineAtom.prototype.init = function ()
{
}

StraightLineAtom.prototype.getVarName = function ()
{
	return this.m_strVarName;
}

// XmlAtomDefine에 설정된 아톰 타입 문자열을 리턴해야 한다.
StraightLineAtom.prototype.getAtomType = function ()
{
	return "Line";
}

StraightLineAtom.prototype.getHTML = function ()
{
	return this.m_heAtom;
}

StraightLineAtom.prototype.setHTML = function (heAtom)
{
	this.m_heAtom = heAtom;
}

StraightLineAtom.prototype.setRowIndex = function (nIndex)
{
	this.m_nRowIndex = nIndex;
}

StraightLineAtom.prototype.setRefVarName = function (strRefVarName)
{

}

StraightLineAtom.prototype.displayValue = function ()
{
	return;
}

StraightLineAtom.prototype.isSureInput = function ()
{
	return false;
}

StraightLineAtom.prototype.isSureInputScroll = function ()
{
	return false;
}

/**
 * 스크롤에 묶인 경우 유효행 체크를 합니다
 */
StraightLineAtom.prototype.checkSureInputScroll = function ()
{
	return true;
}

/**
 * 객체 clone 메소드 입니다.
 * @param bIsHtml html 값을 설정할지 결정 
 */
StraightLineAtom.prototype.clone = function (bIsHtml)
{
	var objNewAtom = new StraightLineAtom(this.m_strVarName, this.m_bVanish);
					
	if (false != bIsHtml && null != this.m_heAtom)
	{
		var heClone = this.m_heAtom.cloneNode(true);
		
		// VML속성은 클론 되지 않기 때문에 카피 해준다.
		heClone.to = this.m_heAtom.to;
		heClone.from = this.m_heAtom.from;
		heClone.strokecolor = this.m_heAtom.strokecolor;
		heClone.strokeweight = this.m_heAtom.strokeweight;
		heClone.firstChild.dashstyle = this.m_heAtom.firstChild.dashstyle;
		
 		objNewAtom.setHTML(heClone);
 	}
 	else
 	{
 		objNewAtom.setHTML(null);
 	}
 	
 	return objNewAtom;
}

/**
 * 선택표시 (f9 기능)
 */
StraightLineAtom.prototype.vanish = function ()
{
	if (this.m_bVanish)
	{
		// 현재 감춤 상태이면 표시한다.
		if ("hidden" == this.m_heAtom.style.visibility)
		{
			this.m_heAtom.style.visibility = "visible";
		}
		else	// 표시된 상태이면 감춘다.
		{
			this.m_heAtom.style.visibility = "hidden";
		}
	}
}

/**
 * 아톰리스트에 추가
 */
StraightLineAtom.prototype.putAtom = function ()
{
	StraightLineAtom._atoms[this.m_strVarName] = this;
}

/**
 * 인자로 받은 값만큼 높이를 변화시킨다
 * 
 * @param nResizeValue (높이 변경 값)
 */
StraightLineAtom.prototype.resizeHeight = function (nResizeValue)
{
	this.m_nToY += nResizeValue;
	
	this.m_heAtom.to = this.m_nToX + "px," + this.m_nToY + "px";
}

/**
 * 인자로 받은 값만큼 넓이를 변화시킨다
 * 
 * @param nResizeValue (넓이 변경 값)
 */
StraightLineAtom.prototype.resizeWidth = function (nResizeValue)
{
	this.m_nToX += nResizeValue;
	
	this.m_heAtom.to = this.m_nToX + "px," + this.m_nToY + "px";
}

/**
 * 인자로 받은 값만큼 top을 변경시킨다
 * @param nRepositionValue (top 변경 값)
 */
StraightLineAtom.prototype.repositionYPos = function (nRepositionValue)
{
	this.m_nFromY += nRepositionValue;
	this.m_nToY += nRepositionValue;
	 
	this.m_heAtom.from = this.m_nFromX + "px," + this.m_nFromY + "px";
	this.m_heAtom.to =  this.m_nToX + "px," + this.m_nToY + "px";
}

/**
 * 인자로 받은 값만큼 left를 변경시킨다
 * @param nRepositionValue (left 변경 값)
 */
StraightLineAtom.prototype.repositionXPos = function (nRepositionValue)
{
	this.m_nFromX += nRepositionValue;
	this.m_nToX += nRepositionValue;
	
	this.m_heAtom.from = this.m_nFromX + "px," + this.m_nFromY + "px";
	this.m_heAtom.to =  this.m_nToX + "px," + this.m_nToY + "px";
}

/**
 * 아톰리스트
 */
StraightLineAtom._atoms = new Object();

StraightLineAtom.getAtom = function (strVarName)
{
	var objLine = StraightLineAtom._atoms[strVarName];
	
	if (null != objLine)
	{
		return objLine;
	}
	
	return null;
}


/**
* TabViewAtom class
*/
function TabViewAtom (strVarName, // 1
					nScriptIndex, // 2
					arTabViewPageList) // 3
{
	this.m_strVarName = strVarName;
	this.m_nScriptIndex = nScriptIndex;
	this.m_arTabViewPageList = arTabViewPageList;
	
	this.m_nSelectedTabIndex = 0;
	this.m_heAtom = document.getElementById(this.m_strVarName);
}

/**
 * 탭뷰 안에 포함된 아톰의 값을 초기화한다.
 * @param nTabIndex
 */
TabViewAtom.prototype.clearAtomValue = function (nTabIndex)
{
	this.m_arTabViewPageList[nTabIndex].clearAtomValue();
}
	
TabViewAtom.prototype.getVarName = function ()
{
	return this.m_strVarName;
}

TabViewAtom.prototype.init = function ()
{
	for (var i = 0; i < this.m_arTabViewPageList.length; i += 1)
	{
		this.m_arTabViewPageList[i].initContainedAtomList();
		
		if (0 == i)
		{
			this._setSelectedTabPage(i);
		}
		else
		{
			this._setUnSelectedTabPage(i);
		}
	}
}

TabViewAtom.prototype.selectTabPage = function (nTabIndex)
{
	var nOldTabIndex = this.m_nSelectedTabIndex;
	var nNewTabIndex = nTabIndex;
	
	if (this.m_nSelectedTabIndex == nTabIndex)
	{
		return;
	}
	
	this._setSelectedTabPage(nNewTabIndex);
	this._setUnSelectedTabPage(nOldTabIndex);
	
	this.m_nSelectedTabIndex = nTabIndex;

	this._handleOtherAtomsInChangeTabPage();
	
	if (-1 != ScriptAtomEvent.onMoveTabView(this.m_nScriptIndex, nOldTabIndex, nNewTabIndex))
	{
		ScriptAtomEvent.onMoveTabViewAfter(this.m_nScriptIndex, nOldTabIndex, nNewTabIndex);
	}
}

TabViewAtom.prototype.makeRequest = function (xnRequest)
{
	var xnAtom = XmlLib.createChild(xnRequest, "TabView");
	
	xnAtom.setAttribute("VarName", this.m_strVarName);
	
	xnAtom.setAttribute("SelectTab", this.m_nSelectedTabIndex);
	
	var arFieldInfo = new Array();
	for (var i = 0, nLen = this.m_arTabViewPageList.length; i != nLen; i++)
	{
		var objTabPage = this.m_arTabViewPageList[i];
		if (null != objTabPage)
		{
			arFieldInfo.push(objTabPage.getFieldInfo());
		}
	}
	
	var strFieldInfoList = arFieldInfo.join(",");
	
	xnAtom.setAttribute("FieldInfo", strFieldInfoList);
}

/**
 * 아톰리스트에 추가
 */
TabViewAtom.prototype.putAtom = function ()
{
	TabViewAtom._atoms[this.m_strVarName] = this;
}

TabViewAtom.prototype._setSelectedTabPage = function (nTabIndex)
{
	var objTabPage = this.m_arTabViewPageList[nTabIndex];
	if (null != objTabPage)
	{
		objTabPage.setSelectedTabPage();
	}
}

TabViewAtom.prototype._setUnSelectedTabPage = function (nTabIndex)
{
	var objTabPage = this.m_arTabViewPageList[nTabIndex];
	if (null != objTabPage)
	{
		objTabPage.setUnSelectedTabPage();
	}
}

/*
* 새로운 Tab선택되면서, 닫히는 Tab 내의 아톰이 수행해야할 일들을 정의 한다. 
* EX) 수행조건의 열려있는 메뉴 및 Row를 닫아 준다. 
**/
TabViewAtom.prototype._handleOtherAtomsInChangeTabPage = function ()
{
	if (ContainsSearchConditionAtom())
	{
		// 수행조건 의 열려있는 Menu및 Row를 닫는다. 
		SearchConditionAtom.closeAllMenu();
	}
	
	if (ContainsGridExAtom())
	{
		GridExAtom.doColumnAutoLengthForAll();
	}
}

/**
 * 아톰리스트
 */
TabViewAtom._atoms = new Object(); 

TabViewAtom.getAtom = function (strVarName)
{
	return TabViewAtom._atoms[strVarName];
}

/**
 * 탭 인덱스에 해당되는 탭의 아톰 값 초기화
 * @param nTabIndex
 */
TabViewAtom.clearAtomValue = function (nTabIndex)
{
	for (var strVarName in TabViewAtom._atoms)
	{
		TabViewAtom._atoms[strVarName].clearAtomValue(nTabIndex);
	}
}

TabViewAtom.selectTabPage = function (strVarName, nTabIndex)
{
	var objAtom = TabViewAtom.getAtom(strVarName);
	if (null != objAtom)
	{
		objAtom.selectTabPage(nTabIndex);
	}
}

TabViewAtom.makeRequest = function (xnAtomRequest)
{
	for (var strVarName in TabViewAtom._atoms)
	{
		var objAtom = TabViewAtom._atoms[strVarName];
		if (null != objAtom)
		{
			objAtom.makeRequest(xnAtomRequest);
		}
	}
}

TabViewAtom.onMouseDown = function (strTabId, objEvent)
{
	AdditionalMenu.onContextMenu(strTabId, objEvent);
}


function TabViewPage (strTabID, // 1
					strAtomVarNameList, // 2
					strFieldInfo, // 3
					strSelectedTabColor, // 4
					strSelectedTabFontColor) // 5
{
	this.m_strTabPageName = strTabID;
	this.m_strAtomVarNameList = strAtomVarNameList;
	this.m_strFieldInfo = strFieldInfo;
	this.m_strSelectedTabColor = strSelectedTabColor;
	this.m_strSelectedTabFontColor = strSelectedTabFontColor;
	
	this.m_strTabName = "__TABPAGE_" + strTabID;
	this.m_strUnSelectedTabColor = "#CCCCCC";
	this.m_strUnSelectedTabTextColor = "#808080";
	this.m_objContainedAtomList = new Object();
	
	this.m_heTabPage = document.getElementById(this.m_strTabPageName);
	this.m_heTab = document.getElementById(this.m_strTabName);
}

TabViewPage.prototype.clearAtomValue = function ()
{
	for (var strVarName in this.m_objContainedAtomList)
	{
		if (this.m_objContainedAtomList[strVarName])
		{
			this.m_objContainedAtomList[strVarName].init();
		}
	}
}
	
TabViewPage.prototype.getFieldInfo = function ()
{
	return this.m_strFieldInfo;
}
	
/**
 * 탭에 있는 아톰리스트 초기화
 */	
TabViewPage.prototype.initContainedAtomList = function ()
{
	var arVarName = this.m_strAtomVarNameList.split(",");
	for (var i = 0; i < arVarName.length ; i +=1)
	{
		var strVarName = arVarName[i];
		var objAtom = Model.getAtom(strVarName);
		
		this.m_objContainedAtomList[strVarName] = objAtom;
	}
}	

TabViewPage.prototype.setSelectedTabPage = function ()
{
	this._showTabPage();
	this._setSelectedTabColor();
}

TabViewPage.prototype.setUnSelectedTabPage = function ()
{
	this._hideTabPage();
	this._setUnSelectedTabColor();
}


TabViewPage.prototype._showTabPage = function ()
{
	this.m_heTabPage.style.display = "block";
}

TabViewPage.prototype._hideTabPage = function ()
{
	this.m_heTabPage.style.display = "none";
}

TabViewPage.prototype._setSelectedTabColor = function ()
{
	this._setTabColor(this.m_strSelectedTabColor, this.m_strSelectedTabFontColor);
}

TabViewPage.prototype._setUnSelectedTabColor = function ()
{
	this._setTabColor(this.m_strUnSelectedTabColor, this.m_strUnSelectedTabTextColor);
}

TabViewPage.prototype._setTabColor = function (strTabColor, strTextColor)
{
	this.m_heTab.style.backgroundColor = strTabColor;
	this.m_heTab.style.color = strTextColor;
}
