

// 보이기/숨기기 리스트 설정
function fnHideShowListSetting(strEvent, strButtonName, strMoreButtonName, strShowAreaName, strNoInput, dwStartNo, dwEndNo)
{
	var objButton		= null;
	var objMoreButton	= null;
	var objShowArea		= null;
	var strClassName	= '';
	var strBuf			= '';

	var blsSetInfo		= false;

	for(var i=dwStartNo; i<=dwEndNo; i++)
	{
		var strObjName	= strButtonName.replace(strNoInput, i);
		objButton			= fnGetObject(strButtonName.replace(strNoInput, i));
		objMoreButton	= fnGetObject(strMoreButtonName.replace(strNoInput, i));
		objShowArea		= fnGetObject(strShowAreaName.replace(strNoInput, i));

		if(objButton)
		{
			strClassName	= objButton.className ? objButton.className : '';
			strBuf			= strButtonName.replace(strNoInput, i);
			strBuf			= strBuf + '_def';

			strClassName	= strClassName + (strClassName == '' ? '' : ' ') + strBuf;
			objButton.className	= strClassName;

			switch (strEvent.toLowerCase())
			{
				case 'click':
					fnAddEvent(objButton, 'onclick', 'fnHideShowEvent(\''+ strObjName +'\')');
					break;
				case 'over':
					fnAddEvent(objButton, 'onmouseover', 'fnHideShowEvent(\''+ strObjName +'\')');
					break;
			}

			if(!blsSetInfo)
			{
				if(objButton.parentNode)
				{
					blsSetInfo		= true;

					objButton.parentNode.setAttribute('ButtonName', strButtonName);
					objButton.parentNode.setAttribute('MoreButtonName', strMoreButtonName);
					objButton.parentNode.setAttribute('ShowAreaName', strShowAreaName);
					objButton.parentNode.setAttribute('NoInput', strNoInput);
					objButton.parentNode.setAttribute('StartNo', dwStartNo);
					objButton.parentNode.setAttribute('EndNo', dwEndNo);
				}
			}
		}

		if(objShowArea)
		{
			strClassName	= objShowArea.className ? objShowArea.className : '';
			strBuf			= strShowAreaName.replace(strNoInput, i);
			strBuf			= strBuf + '_def';

			strClassName	= strClassName + (strClassName == '' ? '' : ' ') + strBuf;
			objShowArea.className	= strClassName;
		}
	}
}

// 처음 보여줄 놈 설정
function fnHideShowListFirstShow(strName)
{
	var objObject	= fnGetObject(strName);

	if(objObject)
	{
		setTimeout(function (){fnHideShowEvent(objObject);}, 50);
	}
}


// 마우스 오버 이벤트
function fnHideShowEvent()
{
	if(fnGetObject(arguments[0]) == null)
	{
		var objThis				= arguments.length > 0 ? (arguments[0].id ? arguments[0] : this ) : this;
	}
	else
	{
		var objThis				= fnGetObject(arguments[0])
	}

	if(!objThis)
		return;

	var strButtonName			= objThis.parentNode.getAttribute('ButtonName') ? objThis.parentNode.getAttribute('ButtonName') : '';
	var strMoreButtonName	= objThis.parentNode.getAttribute('MoreButtonName') ? objThis.parentNode.getAttribute('MoreButtonName') : '';
	var strShowAreaName		= objThis.parentNode.getAttribute('ShowAreaName') ? objThis.parentNode.getAttribute('ShowAreaName') : '';
	var strNoInput					= objThis.parentNode.getAttribute('NoInput') ? objThis.parentNode.getAttribute('NoInput') : '';
	var dwStartNo					= objThis.parentNode.getAttribute('StartNo') ? objThis.parentNode.getAttribute('StartNo') : '';
	var dwEndNo					= objThis.parentNode.getAttribute('EndNo') ? objThis.parentNode.getAttribute('EndNo') : '';

	if(strButtonName == '' || strShowAreaName == '' || strNoInput == '' || dwStartNo == '' || dwEndNo == '')
	{
		return false;
	}
	else
	{
		dwStartNo		= parseInt(dwStartNo, 10);
		dwEndNo			= parseInt(dwEndNo, 10);
	}

	var objButton		= null;
	var objMoreButton	= null;
	var objShowArea		= null;
	var strClassName1	= '';
	var strClassName2	= '';
	var strClassName3	= '';
	var strBuf11		= '';
	var strBuf12		= '';
	var strBuf21		= '';
	var strBuf22		= '';
	var strBuf31		= '';
	var strBuf32		= '';

	for(var i=dwStartNo; i<=dwEndNo; i++)
	{
		objButton		= fnGetObject(strButtonName.replace(strNoInput, i));
		objMoreButton	= fnGetObject(strMoreButtonName.replace(strNoInput, i));
		objShowArea		= fnGetObject(strShowAreaName.replace(strNoInput, i));

		if(objButton && objShowArea)
		{
			strClassName1	= objButton.className ? objButton.className : '';
			if(objMoreButton)
				strClassName2	= objMoreButton.className ? objMoreButton.className : '';
			else
				strClassName2	= '';
			strClassName3	= objShowArea.className ? objShowArea.className : '';

			strBuf11	= strBuf12	= strButtonName.replace(strNoInput, i);
			strBuf21	= strBuf22	= strMoreButtonName.replace(strNoInput, i);
			strBuf31	= strBuf32	= strShowAreaName.replace(strNoInput, i);

			if(objButton == objThis)
			{
				strBuf11	+= '_def';
				strBuf12	+= '_over';
				strBuf21	+= '_def';
				strBuf22	+= '_over';
				strBuf31	+= '_def';
				strBuf32	+= '_over';
				strClassName1	= strClassName1.search(strBuf11) >= 0 ? strClassName1.replace(strBuf11, strBuf12) : (strClassName1.search(strBuf12) >= 0 ? strClassName1 : strBuf12);
				strClassName2	= strClassName2.search(strBuf21) >= 0 ? strClassName2.replace(strBuf21, strBuf22) : (strClassName2.search(strBuf22) >= 0 ? strClassName2 : strBuf22);
				strClassName3	= strClassName3.search(strBuf31) >= 0 ? strClassName3.replace(strBuf31, strBuf32) : (strClassName3.search(strBuf32) >= 0 ? strClassName3 : strBuf32);
			}
			else
			{
				strBuf11	+= '_over';
				strBuf12	+= '_def';
				strBuf21	+= '_over';
				strBuf22	+= '_def';
				strBuf31	+= '_over';
				strBuf32	+= '_def';

				strClassName1	= strClassName1.search(strBuf11) >= 0 ? strClassName1.replace(strBuf11, strBuf12) : (strClassName1.search(strBuf12) >= 0 ? strClassName1 : strBuf12);
				strClassName2	= strClassName2.search(strBuf21) >= 0 ? strClassName2.replace(strBuf21, strBuf22) : (strClassName2.search(strBuf22) >= 0 ? strClassName2 : strBuf22);
				strClassName3	= strClassName3.search(strBuf31) >= 0 ? strClassName3.replace(strBuf31, strBuf32) : (strClassName3.search(strBuf32) >= 0 ? strClassName3 : strBuf32);
			}

			objButton.className			= strClassName1;
			if(objMoreButton)
			{
				objMoreButton.className		= strClassName2;
			}

			objShowArea.className		= strClassName3;
		}
	}
}


function fnLoadInnerPopup(dwSeq)
{
	var strProgramPath			= '/main/';
	var strProgramFilename	= 'inner_popup.asp';
	var strProgramGetValue	= 'Seq='+ dwSeq;
	
	var objInnerPopupDiv		= fnGetObject('inner_popup');

	if(objInnerPopupDiv == null)
	{
		var objInnerPopupDiv		= document.createElement('DIV');

		if(objInnerPopupDiv)
		{
			objInnerPopupDiv.setAttribute('id', 'inner_popup');

			objInnerPopupDiv.style.position	= 'absolute';
			objInnerPopupDiv.style.width		= '0px';
			objInnerPopupDiv.style.height		= '0px';
			objInnerPopupDiv.style.display		= 'block';

			objInnerPopupDiv.style.zIndex		= '1';

			objInnerPopupDiv.style.left			= '655px';
			objInnerPopupDiv.style.top			= '220px';

			objInnerPopupDiv.style.overflow	= 'hidden';

			objInnerPopupDiv.style.filter			= 'Alpha(style=3)';

			var strInnerSource			= '';

			strInnerSource	+= '<table id="inner_popup_table" border="1" cellpadding="0" style="border-collapse: collapse" _width="100%" _height="100%" cellspacing="0">\n';
			strInnerSource	+= '	<tr>\n';
			strInnerSource	+= '		<td valign="top" width="100%">\n';
			strInnerSource	+= '		<table border="0" cellpadding="0" style="border-collapse: collapse" width="100%">\n';
			strInnerSource	+= '			<tr>\n';
			strInnerSource	+= '				<td width="100%">\n';
			strInnerSource	+= '				<table border="0" cellpadding="0" style="border-collapse: collapse" width="100%" height="20" bordercolor="#C0C0C0">\n';
			strInnerSource	+= '					<tr>\n';
			strInnerSource	+= '						<td bgcolor="#000080" style="color: #FFFFFF; font-weight: bold; overflow: hidden;"><!--타이틀--></td>\n';
			strInnerSource	+= '					</tr>\n';
			strInnerSource	+= '				</table>\n';
			strInnerSource	+= '				</td>\n';
			strInnerSource	+= '			</tr>\n';
			strInnerSource	+= '			<tr>\n';
			strInnerSource	+= '				<td id="inner_popup_content" width="100%"></td>\n';
			strInnerSource	+= '			</tr>\n';
			strInnerSource	+= '		</table>\n';
			strInnerSource	+= '		</td>\n';
			strInnerSource	+= '	</tr>\n';
			strInnerSource	+= '</table>\n';


			objInnerPopupDiv.innerHTML		= strInnerSource;

			document.body.appendChild(objInnerPopupDiv);
		}
	}

	var strPrintAreaName	= 'inner_popup_content';
	var objPrintArea			= fnGetObject(strPrintAreaName);
	
	if(objPrintArea != null)
	{
		var blsPreGetSource		= objPrintArea.getAttribute('getsource') ? objPrintArea.getAttribute('getsource') : false;
		var strPreSource				= objPrintArea.innerHTML;
		var strPageSource			= '';
		
		if(blsPreGetSource == false)
		{
			strPageSource				= fnGetPageSource(strProgramPath, strProgramFilename +'?'+ strProgramGetValue, true);
			objPrintArea.innerHTML	= strPageSource;
			objPrintArea.setAttribute('getsource', true);
		}
	}

	var objInnerPopupTable			= fnGetObject('inner_popup_table');

	if(objInnerPopupTable != null)
	{
		var dwWidth			= objInnerPopupTable.offsetWidth + 10;
		var dwHeight			= objInnerPopupTable.offsetHeight + 25;
//		objInnerPopupDiv.style.width		= '0px';
//		objInnerPopupDiv.style.height		= '0px';

		objInnerPopupDiv.style.width		= dwWidth + 'px';
		objInnerPopupDiv.style.height		= dwHeight + 'px';
		objInnerPopupDiv.setAttribute('maxwidth', dwWidth);
		objInnerPopupDiv.setAttribute('maxheight', dwHeight);
	}
	objInnerPopupDiv.style.display		= 'none';
}

var g_bPopupStatus		= 0;
function fnShowInnerPopup(dwSeq)
{
	g_bPopupStatus		= 1;

	var blsNav4	= false;
	var blsIE4	= false;
	if(parseInt(navigator.appVersion.charAt(0)) >= 4)
	{
		blsNav4		= navigator.appName == 'Netscape' ? true : false;
		blsIE4		= navigator.appName.indexOf('Microsoft') != -1 ? true : false;
	}

	var objInnerPopupDiv		= fnGetObject('inner_popup');
	var objInnerPopupTable	= fnGetObject('inner_popup_table');
	var objPrintArea				= fnGetObject('inner_popup_content');
	
	if(objInnerPopupDiv != null && objInnerPopupTable != null && objPrintArea != null)
	{
		var dwWidth			= parseInt(objInnerPopupDiv.getAttribute('maxwidth'), 10);
		var dwHeight			= parseInt(objInnerPopupDiv.getAttribute('maxheight'), 10);

		var dwLeft				= 110;
		var dwTop				= 50;

		var dwMaxIndex		= dwWidth > dwHeight ? dwWidth : dwHeight;
		var dwNowWidth		= 0;
		var dwNowHeight	= 0;
		var dwNowLeft		= 1000;
		var dwNowTop		= 220;
		dwMaxIndex		= dwNowLeft > dwMaxIndex ? dwNowLeft : dwMaxIndex;
		dwMaxIndex		= dwNowTop > dwMaxIndex ? dwNowTop : dwMaxIndex;

		var dwStepTime		= 20;
		var dwStep				= 0;
		var dwMaxStep		= 6;
		setTimeout(function (){fnShowInnerPopup_Proc(dwStepTime, dwMaxStep, dwStep, objInnerPopupDiv, dwMaxIndex, dwWidth, dwHeight, dwNowWidth, dwNowHeight, dwLeft, dwTop, dwNowLeft, dwNowTop);}, dwStepTime);
	}
}

function fnShowInnerPopup_Proc(dwStepTime, dwMaxStep, dwStep, objInnerPopupDiv, dwMaxIndex, dwWidth, dwHeight, dwNowWidth, dwNowHeight, dwLeft, dwTop, dwNowLeft, dwNowTop)
{
	var blsEnd		= false;

	if(dwWidth >= dwNowWidth)
	{
		dwNowWidth		= dwNowWidth + (dwWidth / (dwMaxStep - 1));
	}

	if(dwHeight >= dwNowHeight)
	{
		dwNowHeight		= dwNowHeight + (dwHeight / (dwMaxStep - 1));
	}

	if(dwLeft < dwNowLeft)
	{
		dwNowLeft	 		= dwNowLeft - ((dwNowLeft - dwLeft) / (dwMaxStep - 1));
	}

	if(dwTop < dwNowTop)
	{
		dwNowTop	 		= dwNowTop - ((dwNowTop - dwTop) / (dwMaxStep - 1));
	}

	dwNowWidth		= parseInt(dwNowWidth, 10);
	dwNowHeight		= parseInt(dwNowHeight, 10);
	dwNowLeft	 		= parseInt(dwNowLeft, 10);
	dwNowTop	 		= parseInt(dwNowTop, 10);

	objInnerPopupDiv.style.display		= 'block';
//	objInnerPopupDiv.style.width		= dwNowWidth + 'px';
//	objInnerPopupDiv.style.height		= dwNowHeight + 'px';
	objInnerPopupDiv.style.left			= dwNowLeft + 'px';
	objInnerPopupDiv.style.top			= dwNowTop + 'px';

	var bZoom			= parseInt(dwStep / dwMaxStep * 100, 10);
	if(bZoom < 0)
		bZoom		= 0;
	else if(bZoom > 100)
		bZoom		= 100;

	objInnerPopupDiv.style.zoom		= bZoom +'%';

	objInnerPopupDiv.filters[0].Style		= 0;
	objInnerPopupDiv.filters[0].Opacity	= parseInt(dwStep / dwMaxStep * 100, 10);
	objInnerPopupDiv.filters[0].FinishOpacity		= 0;

//window.document.title	= dwStep +':'+ dwNowWidth +','+ dwNowHeight +'/'+ dwNowLeft +','+ dwNowTop;

	if(dwStep > dwMaxStep)
	{
		blsEnd		= true;
	}
	else
	{
		dwStep++;
	}

	if(blsEnd)
	{
		return;
	}
	else
	{
		setTimeout(function (){fnShowInnerPopup_Proc(dwStepTime, dwMaxStep, dwStep, objInnerPopupDiv, dwMaxIndex, dwWidth, dwHeight, dwNowWidth, dwNowHeight, dwLeft, dwTop, dwNowLeft, dwNowTop);}, dwStepTime);
	}
}


function fnHiddenInnerPopup(dwSeq)
{
	var blsNav4	= false;
	var blsIE4	= false;
	if(parseInt(navigator.appVersion.charAt(0)) >= 4)
	{
		blsNav4		= navigator.appName == 'Netscape' ? true : false;
		blsIE4		= navigator.appName.indexOf('Microsoft') != -1 ? true : false;
	}

	var objInnerPopupDiv		= fnGetObject('inner_popup');
	var objInnerPopupTable	= fnGetObject('inner_popup_table');
	var objPrintArea				= fnGetObject('inner_popup_content');
	
	if(objInnerPopupDiv != null && objInnerPopupTable != null && objPrintArea != null)
	{
		var dwWidth			= parseInt(objInnerPopupDiv.getAttribute('maxwidth'), 10);
		var dwHeight			= parseInt(objInnerPopupDiv.getAttribute('maxheight'), 10);

		var dwLeft				= 1000;
		var dwTop				= 220;

		var dwMaxIndex		= dwWidth > dwHeight ? dwWidth : dwHeight;
		var dwNowWidth		= dwWidth;
		var dwNowHeight	= dwHeight;
		var dwNowLeft		= 110;
		var dwNowTop		= 50;
		dwMaxIndex		= dwNowLeft > dwMaxIndex ? dwNowLeft : dwMaxIndex;
		dwMaxIndex		= dwNowTop > dwMaxIndex ? dwNowTop : dwMaxIndex;

		var dwStepTime		= 20;
		var dwStep				= 0;
		var dwMaxStep		= 6;
		setTimeout(function (){fnHiddenInnerPopup_Proc(dwStepTime, dwMaxStep, dwStep, objInnerPopupDiv, dwMaxIndex, dwWidth, dwHeight, dwNowWidth, dwNowHeight, dwLeft, dwTop, dwNowLeft, dwNowTop);}, dwStepTime);
	}
}

function fnHiddenInnerPopup_Proc(dwStepTime, dwMaxStep, dwStep, objInnerPopupDiv, dwMaxIndex, dwWidth, dwHeight, dwNowWidth, dwNowHeight, dwLeft, dwTop, dwNowLeft, dwNowTop)
{
	var blsEnd		= false;

	if(dwNowWidth > 0)
	{
		dwNowWidth	= dwNowWidth - (dwNowWidth / (dwMaxStep - 1));
	}

	if(dwNowHeight > 0)
	{
		dwNowHeight	= dwNowHeight - (dwNowHeight / (dwMaxStep - 1));
	}

	if(dwLeft > dwNowLeft)
	{
		dwNowLeft		= dwNowLeft + ((dwLeft - dwNowLeft) / (dwMaxStep - 1));
	}

	if(dwTop > dwNowTop)
	{
		dwNowTop		= dwNowTop + ((dwTop - dwNowTop) / (dwMaxStep - 1));
	}

	dwNowWidth		= parseInt(dwNowWidth, 10);
	dwNowHeight		= parseInt(dwNowHeight, 10);
	dwNowLeft	 		= parseInt(dwNowLeft, 10);
	dwNowTop	 		= parseInt(dwNowTop, 10);

	var bZoom			= parseInt((dwMaxStep - dwStep) / dwMaxStep * 100, 10);
	if(bZoom < 0)
		bZoom		= 0;
	else if(bZoom > 100)
		bZoom		= 100;

	objInnerPopupDiv.style.display		= 'block';
//	objInnerPopupDiv.style.width		= dwNowWidth + 'px';
//	objInnerPopupDiv.style.height		= dwNowHeight + 'px';
	objInnerPopupDiv.style.left			= dwNowLeft + 'px';
	objInnerPopupDiv.style.top			= dwNowTop + 'px';
	objInnerPopupDiv.style.zoom		= bZoom +'%';

	objInnerPopupDiv.filters[0].Style		= 0;
	objInnerPopupDiv.filters[0].Opacity	= parseInt((dwMaxStep - dwStep) / dwMaxStep * 100, 10);
	objInnerPopupDiv.filters[0].FinishOpacity		= 0;
//window.document.title	= dwStep +':'+ dwNowWidth +','+ dwNowHeight +'/'+ dwNowLeft +','+ dwNowTop;

	if(dwStep > dwMaxStep)
	{
		blsEnd		= true;
	}
	else
	{
		dwStep++;
	}

	if(blsEnd)
	{
		objInnerPopupDiv.style.display		= 'none';
	}
	else
	{
		setTimeout(function (){fnHiddenInnerPopup_Proc(dwStepTime, dwMaxStep, dwStep, objInnerPopupDiv, dwMaxIndex, dwWidth, dwHeight, dwNowWidth, dwNowHeight, dwLeft, dwTop, dwNowLeft, dwNowTop);}, dwStepTime);
	}
}