
/*
	function fncSetControlReadOnly(objCtl)											: HTML ÄÜÆ®·ÑÀ» ReadOnly·Î ¸¸µç´Ù
	function fncSetControlWrite(objCtl)												: HTML ÄÜÆ®·ÑÀ» ReadOnly·Î µÇ¾îÀÖ´Â°ÍÀ» ÇØÁ¦ÇÑ´Ù.
	function fncSetBrowserStatusBar(strViewMsg)										: ºê¶ó¿ìÀú Status¿¡ ¸Þ¼¼Áö¸¦ º¸¿©ÁØ´Ù.
	function fncAddCtlSelectItem(objWnd, objWndFrmName, strValue, strText, objCtrl)	: SELECT Control¿¡ ³»¿ëÀ» Ã¤¿öÁØ´Ù.
	function fncCheck_Ctrlitem(strSelectItem, objCtrl)								: SELECT ControlÀÇ ¾ÆÀÌÅÛ Áßº¹Ã¼Å©.
	function fncGetHtmlControlStatus(objDoc, ctlName)								: 'objDoc'Æû¿¡ ÀÖ´Â 'ctlName'ÄÁÆ®·ÑÀÇ »óÅÂ¸¦ Ã¼Å©
	function fncSetBrowserStatusBar(strDefaultMsg, strViewMsg)						: window statusÇ¥½Ã, strDefaultMsg:µðÆúÆ®¸Þ½ÃÁö, strViewMsg:onMouseOver½Ã ¸Þ½ÃÁö
	function fncSetItemTextCtrl(strValue, strText, objCtrl)							: SELECTÈÄ ÀÌÀü È­¸é TEXT¿¡ ¼±ÅÃµÈ °ªÀ» ³Ñ±è. 
	function fncOnlyOneCheck(strURL,strOnlyOneMsg,strNoCountMsg)					: check box½Ã ¿ÀÁ÷ ÇÑ°³¸¸ ¼±ÅÃµÇ¾î¼­ ÇØ´ç url·Î ³Ñ±è..
	function fncCheckBoxDisabled()													: check box ¼ýÀÚ¸¸Å­ disabled µÊ
	function fncCheckBoxEnabled()													: check box °¡ disabledµÈ °ÍÀ» ¿ø·¡ »óÅÂ·Î ¸¸µç´Ù.
	function fncOnlyOneRadio(strURL,strNoCountChkMsg,strNoCountRdoMsg,intWidth,intHeight,objWndPopup) : ÇÁ¸°Æ® Æû¿¡¼­ radio¹öÆ° check¿Í Ç×¸ñ ¼³Á¤½Ã check °Ë»ç ÇÏ°í ÇØ´ç Url·Î ÀÌµ¿

	--- Combo Box Function ---
	fncObjCboDelItems(objCboTarget)													: ÄÞº¸¹Ú½º(Select)ÀÇ ¼±ÅÃµÈ ³»¿ëÀ» »èÁ¦ÇÑ´Ù.
	fncObjCboDelItemsAll(objCboTarget)												: ÄÞº¸¹Ú½º(Select)ÀÇ ¸ðµç ³»¿ëÀ» »èÁ¦ÇÑ´Ù.
	fncObjCboAddItem(objCboTarget, strItemText, strItemValue)						: ÄÞº¸¹Ú½º¿¡ ÇÏ³ªÀÇ ³»¿ëÀ» ÀÔ·ÂÇÑ´Ù.
	fncObjCboAddItems(objCboSource, objCboTarget)									: ¼Ò½º ÄÞº¸¹Ú½º¿¡ ÀÖ´Â ¼±ÅÃµÈ ³»¿ëÀ» ´ë»ó ÄÞº¸¹Ú½º¿¡ ÀÔ·ÂÇÑ´Ù.
	fncObjCboGetItemIndex(objCboTarget, strItemText, strItemValue)					: ÄÞº¸¹Ú½º¿¡ ¼±ÅÃµÈ ³»¿ëÀÇ ÀÎµ¦½º¸¦ ±¸ÇÑ´Ù.
	fncObjCboIsItemsExisit(objCboTarget, strItemText, strItemValue)					: ÄÞº¸¹Ú½º¿¡ ¼±ÅÃµÈ ³»¿ëÀÌ ÀÖ´ÂÁö Ã¼Å©ÇÑ´Ù.
	fncObjCboSort(objCboSource, objCboTarget)										: ¼Ò½º ÄÞº¸¹Ú½º¿¡ ÀÖ´Â ³»¿ë°ú ´ë»ó ÄÞº¸¹Ú½º¿¡ ÀÖ´Â ³»¿ëÀÇ ¼ø¼­¸¦ °°°ÔÇÑ´Ù.
*/

	// Language Define of Message
	//var DFN_LCL_FNC_OBJECT_CONTROL_AGREE_REQUEST 	= "¿¡ µ¿ÀÇ(Ã¼Å©) ÇÏ¼Å¾ß ÇÕ´Ï´Ù.";
	//var DFN_LCL_FNC_OBJECT_ITEM_EXIST_MESSAGE		= "´Â ÀÌ¹Ì Ãß°¡µÇ¾î ÀÖÀ¸¹Ç·Î Ãß°¡µÇÁö ¾Ê½À´Ï´Ù.";
	//var	DFN_GBL_FNC_ONLY_ONE_CHECK_MSG				= "¼öÁ¤ Ã¼Å©¼±ÅÃÀº 1°³¸¸ ¼±ÅÃÇÏ¼Å¾ß ÇÕ´Ï´Ù."
	//var DFN_GBL_DEL_MODIFY_NO_COUNT_MSG				= "¼öÁ¤ÇÏ½Ã°íÀÚ ÇÏ´Â µ¥ÀÌÅ¸¸¦ ¼±ÅÃÇÏ¼¼¿ä!"
	var strExistMbr = '';

	function fncSetControlReadOnly(objCtl, blnStatus)	{	objCtl.readOnly = blnStatus;	}

	function fncSetControlsReadOnly(objDoc, htmlCtl, blnStatus)	{
		for(var i = 0; i < objDoc.length; i++)	{
			var ele = objDoc[i];
			if(ele.name == htmlCtl)	ele.readOnly = blnStatus;
		}
	}

	function fncSetControlEnable(objCtl, blnStatus)		{	objCtl.disabled	= blnStatus;	}
	function fncSetControlsEnable(objDoc, htmlCtl, blnStatus)	{
		for(var i = 0; i < objDoc.length; i++)	{
			var ele = objDoc[i];
			if(ele.name == htmlCtl)	ele.disabled = blnStatus;
		}
	}

	function fncSetControlChecked(objCtl, blnStatus)	{	objCtl.checked	= blnStatus;	}
	function fncSetControlsChecked(objDoc, htmlCtl)	{
		var blnStatus;
		for(var i = 0; i < objDoc.length; i++)	{
			var ele = objDoc[i];
			if (fncGetControlChecked(ele))	blnStatus = false;
			else							blnStatus = true;
			if(ele.name == htmlCtl)	fncSetControlChecked(ele, blnStatus);
		}
	}

	function fncGetControlChecked(objCtl)	{
		if (objCtl.checked)	return true;
		else				return false;
	}

	function fncGetControlsChecked(objDoc, ctlName)	{
		var ele;
		var	i;

		for (i=0; i<objDoc.length; i++)	{
			ele = objDoc[i];

			if (ele.type == ctlName)	{	if (ele.checked) return true;	}
		}
		return false;
	}


	function fncCheckBoxSelect(objCtl, strCtlTitle)	{
		if (!objCtl.checked)	{
			//alert(strCtlTitle + DFN_LCL_FNC_OBJECT_CONTROL_AGREE_REQUEST);
			objCtlCompare.focus();
			return false;
		}
		return true
	}

	function fncSetBrowserStatusBar(strDefaultMsg, strViewMsg)	{
		window.defaultStatus = strDefaultMsg
		window.status = strViewMsg
	}


	function fncAddCtlSelectItem(objWnd, objWndFrmName, strValue, strText, objCtrl)	{
		var objOption;
		var strMsg;

		objOption		= objWnd.createElement("OPTION");
		objOption.text	= strText;
		objOption.value	= strValue;
		objCtrl.add(objOption);	
		strExistMbr = '';
	}

	function fncSetItemTextCtrl(strText, objCtrl)	{
		objCtrl.value 	= strText;
	}


	function fncCheck_Ctrlitem(strSelectItem, objCtrl) {
		var inti;

		for(inti = 0; inti < objCtrl.length; inti++) {
			if(objCtrl.options[inti].value == strSelectItem) {
				return true;
			}
		}

		return false;
	}

	function fncGetCtlSelectItem(objWndFrmCtlName)	{
		if (objWndFrmCtlName.selectedIndex > 0 )	return false;
		else										return true;
	}
	
	function fncGetCtlSelectCount(objWndFrmCtlName)	{
		return objWndFrmCtlName.length;
	}

	function fncGetCtlSelectFindValue(objWndFrmCtlName, strFindText, strFindValue)	{
		for(var inti = 0; inti < objWndFrmCtlName.length ; inti++) {
			if(objWndFrmCtlName.options[inti].text == strFindText && 
				objWndFrmCtlName.options[inti].value == strFindValue)	return true;
		}
		return false;
	}

	function fncDelCtlSelectItem(objWndFrmCtlName, intDelPos)	{
		objWndFrmCtlName.options[objWndFrmCtlName.selectedIndex] = null;
	}

	function fncGetHtmlControlStatus(objDoc, ctlName)	{
		var ele, i;

		for (i=0; i<objDoc.length; i++)	{
			ele = objDoc[i];

			if (ele.type == ctlName)	{
				if (ele.checked) return true;
			}
		}
		return false;
	}

	var blnStatus = false;
	function fncCheckBoxStatusAllChange(){
   		var inti;
   		var ele;

        for (inti=0; inti<document.frm.elements.length; inti++){
			ele = document.frm.elements[inti];

			if (ele.value != ''){ 
				if(ele.checked == blnStatus){
					ele.checked = !ele.checked;
				} else {}
			}
		}
		blnStatus = !blnStatus;
	}

  	function fncOnlyOneCheck(strURL,strOnlyOneMsg,strNoCountMsg) {
		var inti, intChkCnt;
		var objEle;
		
		intChkCnt = 0;
		if (fncGetHtmlControlStatus(document.frm.elements, 'checkbox'))	{
			for (inti=0; inti<document.frm.elements.length; inti++)	{
				objEle = document.frm.elements[inti];
				if (objEle.type == 'checkbox')	{
					if(objEle.checked == true)  {
						intChkCnt = intChkCnt + 1;
						
						if(intChkCnt == 2) {
							alert(strOnlyOneMsg);
							for (inti=0; inti<document.frm.elements.length; inti++)	{
								objEle = document.frm.elements[inti];
								if (objEle.type == 'checkbox')	{
									  objEle.checked = false;
								}
							}		
							return;
						}
					}
				}
			}
			document.frm.action = strURL;
			document.frm.submit();
		} else {
			alert(strNoCountMsg);
		}	
	}
	
	function fncCheckReset() {
		var inti, intChkCnt;
		var objEle;
		var strUrl
		
		intChkCnt = 0;
	
		for (inti=0; inti<document.frm.elements.length; inti++)	{
			objEle = document.frm.elements[inti];
			if (objEle.type == 'checkbox')	{
				if(objEle.checked == true) {
					intChkCnt = intChkCnt + 1;
					if(intChkCnt == 2) {
						for (inti=0; inti<document.frm.elements.length; inti++)	{
							objEle = document.frm.elements[inti];
							if (objEle.type == 'checkbox')	{
								  objEle.checked = false;
							}
						}		
						return;
					}
				}
			}
		}
		
	}
	
	function fncCheckBoxDisabled(){
		var objEle
		var inti		 
 		
 		for (inti=0; inti<document.frm.elements.length; inti++)	{
			objEle = document.frm.elements[inti];
				if (objEle.type == 'checkbox')	{
					objEle.disabled = true;
				}
		}
	}
			
	function fncCheckBoxEnabled() {
		var objEle
		var inti		 

		for (inti=0; inti<document.frm.elements.length; inti++)	{
		objEle = document.frm.elements[inti];
			if (objEle.type == 'checkbox')	{
				objEle.disabled = false;
			}
		}
	
	} 
	
	function fncOnlyOneRadio(strURL,strNoCountChkMsg,strNoCountRdoMsg, intWidth, intHeight, intElePosition, objWndPopup) {
		var inti, intCheckedCnt;
		var objEle;

		intCheckedCnt = 0;
		
		if (fncGetHtmlControlStatus(document.frm.elements, 'radio'))	{
			if(document.frm.elements[intElePosition].checked == true) {
				fncPopup(strURL, intWidth, intHeight, objWndPopup);			
			}

			if (!fncGetHtmlControlStatus(document.frm.elements, 'check'))	{
				for (inti=0; inti<document.frm.elements.length; inti++)	{
					objEle = document.frm.elements[inti];
					if (objEle.type == 'checkbox')	{
						if(objEle.checked == true) {
							 intCheckedCnt = intCheckedCnt + 1;
						} else  {
						
						}
					}	
				}
				
				if(intCheckedCnt != 0) {
					fncPopup(strURL, intWidth, intHeight, objWndPopup);		
				} else {
					if(document.frm.elements[intElePosition].checked == true) {}
					else{
						alert(strNoCountChkMsg);
						return;
					}
				}
			}						
		} else {
			alert(strNoCountRdoMsg);				
		}	
	//	self.close();
	}


	/**************************************************************************************************************
	*	Name 		: fncObjCboDelItems(objCboTarget)
	*	Parameter	: objCboTarget(ex:document.FormName.cboName)
	*	Desc		: Delete Combo Items
	*	Creater		: 
	**************************************************************************************************************/
	function fncObjCboDelItems(objCboTarget)	{
		for (var i=objCboTarget.length; 0 < i; i--)	{
			if (objCboTarget.options[i-1].selected)	objCboTarget.options[i-1]=null;
		}
	}

	/**************************************************************************************************************
	*	Name 		: fncObjCboDelItemsAll(objCboTarget)
	*	Parameter	: objCboTarget(ex:document.FormName.cboName)
	*	Desc		: All Delete Combo Items
	*	Creater		: 
	**************************************************************************************************************/
	function fncObjCboDelItemsAll(objCboTarget)	{
		for (var i=objCboTarget.length; 0 < i; i--)	{
			objCboTarget.options[i-1]=null;
		}
	}

	/**************************************************************************************************************
	*	Name 		: fncObjCboAddItem(objCboTarget, strItemText, strItemValue)
	*	Parameter	: objCboTarget(ex:document.FormName.cboName), strItemText(ex:text), strItemValue(ex:value)
	*	Desc		: Add Item
	*	Creater		: 
	**************************************************************************************************************/
	function fncObjCboAddItem(objCboTarget, strItemText, strItemValue){
		objCboTarget.options[objCboTarget.options.length]=new Option(strItemText, strItemValue, false, false);
	}

	/**************************************************************************************************************
	*	Name 		: fncObjCboAddItems(objCboSource, objCboTarget)
	*	Parameter	: objCboSource(ex:document.FormName.cboName), objCboTarget(ex:document.FormName.cboName)
	*	Desc		: ComboBox To ComboBox Add Items
	*	Creater		: 
	**************************************************************************************************************/
	function fncObjCboAddItems(objCboSource, objCboTarget)	{
		var strText, strValue;
		
		for (var i=0; objCboSource.length > i; i++)	{
			if (objCboSource.options[i].selected)	{
				strText	= objCboSource.options[i].text;
				strValue= objCboSource.options[i].value;
				if ((!fncObjCboIsItemsExisit(objCboTarget, strText, strValue)) && ((strText !="") && (strValue != "")))	{
					objCboTarget.options[objCboTarget.options.length]=new Option(strText, strValue, false, false);
				}
			}
		}
	}

	/**************************************************************************************************************
	*	Name 		: fncObjCboParentWndAddItems(objWndParent, objCboSource, objCboTarget)
	*	Parameter	: objWndParent(ex:window.opener), objCboSource(ex:document.FormName.cboName)
	*				: objCboTarget(ex:document.FormName.cboName)
	*	Desc		: ComboBox To ComboBox Add Items
	*	Creater		: 
	**************************************************************************************************************/
	function fncObjCboParentWndAddItems(objWndParent, objCboSource, objCboTarget)	{
		var strText, strValue, objOption;

		for (var i=0; objCboSource.length > i; i++)	{
			strText	= objCboSource.options[i].text;
			strValue= objCboSource.options[i].value;
			strText= strText.substring(0, strText.length);

			if ((!fncObjCboIsItemsExisit(objCboTarget, strText, strValue)) && ((strText !="") && (strValue != "")))	{
				objOption		= objWndParent.createElement("OPTION");
				objOption.text	= strText;
				objOption.value	= strValue;
				objCboTarget.add(objOption);	
			}
		}
	}
	
	/**************************************************************************************************************
	*	Name 		: fncStrDecodeForMetaChar(arg)
	*	Parameter	: arg(string)
	*
	*	Desc		: Decoding Meta Character 
	*	Creater		: 
	**************************************************************************************************************/

	function fncStrDecodeForMetaChar(arg){

		var temp;

		temp = fncReplaceMetaChar(arg,"&#39;", "'") ;
		temp = fncReplaceMetaChar(temp,"&#34;", "\"") ;
		temp = fncReplaceMetaChar(temp,"&#92;", "\\") ;
		temp = fncReplaceMetaChar(temp,"&#47;", "\/") ;
		temp = fncReplaceMetaChar(temp,"&lt;", "<") ;
		temp = fncReplaceMetaChar(temp,"&gt;", ">") ;
		return temp;

	}
	
	/**************************************************************************************************************
	*	Name 		: fncReplaceMetaChar(text,strOriginal, strReplace)
	*	Parameter	: text,strOriginal, strReplace
	*
	*	Desc		: String to Converted String
	*	Creater		: 
	**************************************************************************************************************/

	function fncReplaceMetaChar(text,strOriginal, strReplace){ 
		
		var fp,lp;
        fp=0;
        lp=0;

		while (((fp=text.indexOf(strOriginal)) > -1) ) {
			lp = strOriginal.length;
			text = text.substring(0,fp) + strReplace + text.substring(fp+strOriginal.length,text.length);			

		}
		return text;
	}

	/**************************************************************************************************************
	*	Name 		: fncObjCboParentWndAddItemsForAddress(objWndParent, objCboSource, objCboTarget)
	*	Parameter	: objWndParent(ex:window.opener), objCboSource(ex:string)
	*				: objCboTarget(ex:document.FormName.cboName)
	*	Desc		: string To ComboBox Add Items
	*	Creater		: 
	**************************************************************************************************************/

	function fncObjCboParentWndAddItemsForAddress(objWndParent, objCboSource, objCboTarget)	{
		var strText, strValue, objOption;
		var strArrTemp, strTemp;

		strArrTemp = objCboSource.split("||");
			
		for (var i=0; strArrTemp.length - 1> i; i++)	{
			strTemp = strArrTemp[i].split("<>");

			strValue	= strTemp[0];
			strText= fncStrDecodeForMetaChar(strTemp[1]);
					
			if ((!fncObjCboIsItemsExisit(objCboTarget, strText, strValue)) && ((strText !="") && (strValue != "")))	{
				objOption		= objWndParent.createElement("OPTION");
				objOption.text	= strText;
				objOption.value	= strValue;
				objCboTarget.add(objOption);	
			}
		}
	}
	
	/**************************************************************************************************************
	*	Name 		: fncObjDeleteItem(listBox)
	*	Parameter	: listBox(combobox)
	*	Desc		: Delete in  ComboBox Items
	*	Creater		: 
	**************************************************************************************************************/

	function fncObjDeleteItem(listBox)
	{
   	
		for (i=listBox.length ; i >= 0 ; i-- )
			listBox.options[i]=null;
	
	}


	/**************************************************************************************************************
	*	Name 		: fncObjCboGetItemIndex(objCboTarget, strItemText, strItemValue)
	*	Parameter	: objCboTarget(ex:document.FormName.cboName), strItemText(ex:text), strItemValue(ex:value)
	*	Desc		: Get Item Index
	*	Creater		: 
	**************************************************************************************************************/
	function fncObjCboGetItemIndex(objCboTarget, strItemText, strItemValue)	{
		for (var i=0; i < objCboTarget.length; i++)	{
			if ((objCboTarget.options[i].text == strItemText) && (objCboTarget.options[i].value == strItemValue))
				return i;
		}
	}

	/**************************************************************************************************************
	*	Name 		: fncObjCboIsItemsExisit(objCboTarget, strItemText, strItemValue)
	*	Parameter	: objCboTarget(ex:document.FormName.cboName), strItemText(ex:text), strItemValue(ex:value)
	*	Desc		: Item Exisit Check
	*	Creater		: 
	**************************************************************************************************************/
	function fncObjCboIsItemsExisit(objCboTarget, strItemText, strItemValue)	{
		for (var i=0; i < objCboTarget.length; i++)	{
			if ((objCboTarget.options[i].text == strItemText) && (objCboTarget.options[i].value == strItemValue))
				return true;
		}
		return false;
	}

	/**************************************************************************************************************
	*	Name 		: fncObjCboSort(objCboSource, objCboTarget)
	*	Parameter	: objCboSource(ex:document.FormName.cboName), objCboTarget(ex:document.FormName.cboName)
	*	Desc		: objCboSource as like Sort
	*	Creater		: 
	**************************************************************************************************************/
	function fncObjCboSort(objCboSource, objCboTarget)	{
		var strText, strValue;
		var i;

		var intArrayCnt	= 0;
		var aryText		= new Array();
		var aryValue	= new Array();

		for (i=0; i < objCboSource.length; i++)	{
			strText	= objCboSource.options[i].text;
			strValue= objCboSource.options[i].value;
			if (fncObjCboIsItemsExisit(objCboTarget, strText, strValue))	{
				aryText[intArrayCnt]	= strText;
				aryValue[intArrayCnt]	= strValue;
				intArrayCnt = ++intArrayCnt;
			}
		}
		fncObjCboDelItemsAll(objCboTarget);
		for (i=0; i < aryText.length; i++)	fncObjCboAddItem(objCboTarget, aryText[i], aryValue[i]);
	}

	/**************************************************************************************************************
	*	Name 		: fncObjCboGetTextItems(objCboTarget, strDivision)
	*	Parameter	: objCboTarget(ex:document.FormName.cboName)
	*	Desc		: Get Item Index
	*	Creater		: 
	**************************************************************************************************************/
	function fncObjCboGetTextItems(objCboTarget, strDivision)	{
		var strTmp = "";
		for (var i=0; i < objCboTarget.length; i++)	strTmp = strTmp + objCboTarget.options[i].text + strDivision
		return strTmp;
	}

	/**************************************************************************************************************
	*	Name 		: fncObjCboGetValueItems(objCboTarget, strDivision)
	*	Parameter	: objCboTarget(ex:document.FormName.cboName)
	*	Desc		: Get Item Index
	*	Creater		: 
	**************************************************************************************************************/
	function fncObjCboGetValueItems(objCboTarget, strDivision)	{
		var strTmp = "";
		for (var i=0; i < objCboTarget.length; i++)	strTmp = strTmp + objCboTarget.options[i].value + strDivision
		return strTmp;
	}
