/**
	CopyRight Kwon yun kil
	
	1. replaceAll(replace_string, str1, str2)
		-- º¯È¯¹®ÀÚ¿­ ¸ðµÎ º¯°æÇÑ´Ù, 
	2. confirmMessage()
		-- dbÃ³¸®ÇÑ ¸Þ½Ã¸®¸¦ º¸¿©ÁØ´Ù.
	3. urlEscape()
		-- ¹®ÀÚ¿­À» ÀÎÄÚµùÇÑ´Ù.
	4. lTrim ¿ÞÂÊ°ø¹éÁ¦°Å, rTrim ¿À¸¥ÂÊ°ø¹éÁ¦°Å, trim ¾çÂÊ°ø¹éÁ¦°Å
	5. changeParamEncodeURI 
		-- get¹æ½ÄÀÇ parameter¸¸ ÀÎÄÚµùÇÑ´Ù. 							
	6. resizeFrame()
		-- iframe À» ³»¿ë¿¡ ¸ÂÃç ¼¼·ÎÅ©±â¸¦ ÀÚµ¿À¸·Î ´Ã¸°´Ù.
	7. displayManagedFormLayer()
		-- ÆË¾÷Ã¢À» ·¹ÀÌ¾î·Î ¶ç¿î´Ù.
	8. displayLayer()
		-- ÆË¾÷·¹ÀÌ¾î À§Ä¡¸¦ Á¶Á¤ÇÑ´Ù.
	9. hiddenLayer()
		-- ÆË¾÷·¹ÀÌ¾î¸¦ ¼û±ä´Ù.
	10. nextObject()
		-- ¿£ÅÍÅ°¸¦ Ä¥°æ¿ì Æ÷Ä¿½º¸£ ´ÙÀ½°´Ã¼·Î ¿È±ä´Ù. 
	11. showLoading() Ã³¸®Áß ÇÃ·¡½¬ ÀÌ¹ÌÁö¸¦ º¸¿©ÁØ´Ù. 
	12. insertProcess()
		-- µî·ÏÃ³¸®ÇÒ ¸Þ½ÃÁö¸¦ Ã³¸®ÇÑ´Ù.
	13. updateProcess()
		-- ¼öÁ¤Ã³¸®ÇÒ ³»¿ëÀ» Ã³¸®ÇÑ´Ù.
	14. deleteProcess()
		-- »èÁ¦Ã³¸®ÇÒ ³»¿ëÀ» Ã³¸®ÇÑ´Ù.
	15. cancleProcess()
		-- ÆË¾÷·¹ÀÌ¾î¸¦ Ãë¼ÒÇÑ´Ù. 
	16. process() 
		-- dmlType:SELECT:Á¶È¸, INSERT:µî·Ï, UPDATE:¼öÁ¤, DELETE:»èÁ¦
	17. reportWindow()
		-- ¸®Æ÷Æ® ÆË¾÷À©µµ¿ì Ãâ·Â
	18. reportIFrame()
		-- ¸®Æ÷Æ® ¾ÆÀÌÇÁ·½ÀÓ Ãâ·Â
	19. windowClose()
		-- È­¸é´Ý±â(ÆË¾÷, ·¹ÀÌ¾î)		
	20. checkAll()
		-- Ã¼Å©¹Ú½º ÀüÃ¼ ¼±ÅÃ	
	20-1. checkSelect()
		-- ¼±ÅÃ°³Ã¼È®ÀÎ		
	21. checkNull()
	    -- Null Ã¼Å©
	22. checkJumin()
	    -- ÁÖ¹Î¹øÈ£ Ã¼Å©
	23. checkSaupja()
	    -- »ç¾÷ÀÚ Ã¼Å©
	24. checkBubin()
	    -- ¹ýÀÎ¹øÈ£ Ã¼Å©
	25. checkEmail()	    
	25. windowResizing(this)
		-- ÆË¾÷Ã¢ ÀÚµ¿Á¶Àý
	25-1. windowReset(this)
    26. tabMenu()
        -- ÅÇ¸Þ´º ÀÌµ¿
	27. onlyNumber()
		-- ¼ýÀÚ¸¸ ÀÔ·ÂÇÏµµ·Ï ÀÔ·Â°ª Á¦ÇÑ
	28. ¿µ¹®ÀÚ
	29. ÇÑ±ÛÀÔ·Â
	30. show()
		-- °´Ã¼º¸ÀÌ±â	
	31. hide()
		-- °´Ã¼¼û±â±â		   
	32. setFocus()
		-- °´Ã¼Æ÷Ä¿½º ÁÖ±â		
	33. dispAnimalNo()
		-- °³Ã¼½Äº°¹øÈ£ ÀÚ¸® ÀÚ¸£±â		
	34. setDisabled()
		-- °´Ã¼ disable ½ÃÅ°±â		
	35. setEnabled()
		-- °´Ã¼ enabled ½ÃÅ°±â		
	36. iframeProcess()
		-- ¾ÆÀÌÇÁ·¹ÀÓÀ¸·Î Ã³¸®ÇÏ±â 		
	37. $()
	
	38. copyClipBoard()
		-- °´Ã¼¹ÝÈ¯ÇÔ¼ö		
	39. getBytes()
		-- ¸Þ½ÃÁö ±æÀÌ ¹ÙÀÌÆ® Ã¼Å©
    40. dispJuminCorpNo(param) 
        -- ÁÖ¹Î/»ç¾÷ÀÚ/¹ýÀÎ¹øÈ£ º¸¿©ÁÖ±â
**/
	var currentUrl		= new String(location).split("?")[0];
   var startNum		= 0;
   var DF 				= document.forms[0];
   var arrUrl        ;
   var reportFolder 	= "";
   var currentUrlName= "";
   var currentUrlExt = "";
           
   currentUrl      = currentUrl.replace("//", "");
   startNum        = currentUrl.indexOf('/');
   stringLength    = currentUrl.length - startNum;

   currentUrl      = currentUrl.substr(startNum, stringLength);
   if(currentUrl.indexOf(".") > -1){
   	arrUrl         = currentUrl.split("/");
   	reportFolder   = currentUrl.replace(arrUrl[arrUrl.length-1], "rpt");
		currentUrlName = currentUrl.split(".")[0];
		currentUrlExt  = currentUrl.split(".")[1];
   }

	// °´Ã¼¹ÝÈ¯
	function $(objId){
		return document.getElementById(objId);	
	}
	
	// String replace
	function replaceAll(replace_string, str1, str2) {
		var pos;
		while (replace_string.indexOf(str1)>-1) {
			pos 					= replace_string.indexOf(str1);
			replace_string	= "" + (replace_string.substring(0, pos) + str2 + replace_string.substring((pos + str1.length), replace_string.length));
		}
		return replace_string;
	}

	// DB INSERR, UPDATe, DELETE Ã³¸® ÈÄ ¾Ë¸² ¸Þ½ÃÁö
	function confirmMessage(confirmType){
		var message 		= $("message");
		var confirm_type 	= (confirmType == undefined || confirmType == "") ? "MESSAGE" : confirmType;
		var tempMessage 	= "";
		var parentMessage = "";

		if(message){
			tempMessage = message.value;	

			if(tempMessage != ""){
				if(confirm_type == "MESSAGE"){
					alert(tempMessage);
					message.value = "";	
				}else if(confirm_type == "MESSAGE_CLOSE"){
					if(parent){
						parentMessage = eval("parent.document.forms[0].message");
						if(parentMessage){
							parentMessage.value = tempMessage;	
						}
						parent.searchAll();
					}else if(opener){
						parentMessage = eval("opener.document.forms[0].message");
						if(parentMessage){
							parentMessage.value = tempMessage;	
						}
						opener.searchAll();
					}
					windowClose();
				}
			}
		}
	}
	

	// URL Encoding
	function urlEscape( str_url ){
		if( ( typeof str_url ) == "undefined" || str_url== "" ) return;

		var str, ch;
		var bEncURI = "N";
		eval( "try{bEncURI=encodeURI('O');}catch(_e){ }" );
		if( bEncURI == "O" ) str=encodeURI(str_url);
		else str = escape(str_url);

		str=str.split("+").join("%2B");
		str=str.split("/").join("%2F");
		str=str.split("&").join("%26");
		str=str.split("?").join("%3F");
		str=str.split(":").join("%3A");
		str=str.split("#").join("%23");

		return str;
	}
	
	// change program_url encodeURI
	function changeParamEncodeURI(program_url){
		var arr1=program_url.split('&');
		for(var i=0;i<arr1.length;i++) 
		{
			arrStr = arr1[i].split('=');
			if (i== 0)
			{
				returnValue = arr1[i]; 
			}else{
				if(arrStr.length<2) { 
			 		returnValue = returnValue +'&' + arr1[i]; 
				  }else{ 
			  	  	returnValue = returnValue + '&' + arrStr[0] + '='+ encodeURI(arrStr[1]);
	     	  	  }
		    	}
	  	   }
		return returnValue;		
	}
	
	// ¿ÞÂÊ°ø¹é Á¦°Å
	function lTrim(str){
	   var whitespace = new String(" \t\n\r");
	   var s = new String(str);
	   if (whitespace.indexOf(s.charAt(0)) != -1) {
	      var j=0, i = s.length;
	      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
	         j++;
	      s = s.substring(j, i);
	   }
	   return s;
	}
	
	// ¿À¸¥ÂÊ°ø¹éÁ¦°Å
	function rTrim(str){
	   var whitespace = new String(" \t\n\r");
	   var s = new String(str);
	   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
	      var i = s.length - 1;       // Get length of string
	      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
	         i--;
	      s = s.substring(0, i+1);
	   }
	   return s;
	}
	
	// °ø¹éÁ¦°Å
	function trim(str) {
   	return rTrim(lTrim(str));
	}	

      // ¾ÆÀÌÇÁ·¹ÀÓ »çÀÌÁî Á¶Á¤ÇÏ±â
   function resizeFrame(iframeObj){ 
      var innerBody = iframeObj.contentWindow.document.body; 
      oldEvent = innerBody.onclick; 
      innerBody.onclick = function(){ resizeFrame(iframeObj, 1);oldEvent; }; 

      var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight); 
      var innerWidth  = innerBody.scrollWidth  + (innerBody.offsetWidth  - innerBody.clientWidth); 

      iframeObj.style.height = innerHeight; 
      iframeObj.style.width  = innerWidth; 

      if( !arguments[1] )       
         this.scrollTo(1,1); 
   } 	
   
   // ·¹ÀÌ¾î Display
   function displayManagedFormLayer(layerId, resizeWHTL, programUrl, parameter){      
      var obj        	= $(layerId);
      var sizeWidth     = "786";
      var sizeHeight    = "400";
      var positionTop	= "";
      var positionLeft	= "";    
      var positionTL		= "";  
      var arrSize;
      
      if(!obj){
      	//if(parent){
      	//	alert("test111");
      	//	obj        	= parent.document.getElementById(layerId);	
      	//}else{
	      	//alert("·¹ÀÌ¾î°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù. ");
	      	//return;
	      	var hiddenLayer;
	      	hiddenLayer = document.createElement("div");
	      	hiddenLayer.id = "divManage";
	      	hiddenLayer.style.border = "2px blue solid";
	      	hiddenLayer.backgroundColor = "white";
	      	hiddenLayer.style.position = "absolute";
	      	document.body.appendChild(hiddenLayer);
	      	//alert("test");
	      	//obj = $("divManage");
      	//}
      }
      
      if(obj){
	      
	      if(resizeWHTL != ""){
				if(resizeWHTL.indexOf("|") > -1){
					arrSize	= resizeWHTL.split("|");
					if(arrSize[0] != ""){
						sizeWidth	= arrSize[0];
					}
					if(arrSize[1] != ""){
						sizeHeight	= arrSize[1];
					}
					if(arrSize.length == 4){
						if(arrSize[3] != ""){
							positionTop = arrSize[2];
						}
						if(arrSize[4] != ""){
							positionLeft= arrSize[3]; 
						}
					}
				}
	      }
	      
	      positionTL = positionTop + "|" + positionLeft;
	      displayLayer(layerId, "block", positionTL);
	      
	      programUrl += parameter;      
	      
	      obj.innerHTML = "<iframe src='" + programUrl + "' width='" + sizeWidth + "' height='" + sizeHeight + "' onload='resizeFrame(this)' frameborder='0' scrolling='no'></iframe>"; 
   	}
   }
   
   // ·¹ÀÌ¾î Hidden
   function hiddenLayer(layerId, displayValue, param){
      var arrParam;
      var manageLayer = $(layerId);

      if(param != ""){
			search();
			if(param.indexOf("|") > -1){
				arrParam = param.split("|");
			}      
      }
      
      if(manageLayer){
			$(layerId).style.display =  displayValue;
      }else{
			alert("Á¦¾îÇÒ ·¹ÀÌ¾î°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.\n·¹ÀÌ¾î ID°ªÀ» È®ÀÎÇÏ½Ê½Ã¿ä.");
      }
      
   }
   
   
   // ·¹ÀÌ¾î Display Á¦¾î
	function displayLayer(layerId, displyValue, moveTL){
		var obj				= $(layerId);
		var positionTop	= 120;
		var positionLeft	= 190;
		var arrPostion;

		if(obj){
	      if(moveTL != ""){
				if(moveTL.indexOf("|") > -1){
					arrPostion	= moveTL.split("|");
					if(arrPostion[0] != ""){
						positionTop	= arrPostion[0];
					}
					if(arrPostion[1] != ""){
						positionLeft= arrPostion[1];
					}
				}
	      }

			obj.style.display	= displyValue;
			obj.style.position= "absolute";
			obj.style.top		= positionTop;
			obj.style.left		= positionLeft;
		}
	}	   

	// ´ÙÀ½ Æ÷Ä¿½º ÀÌµ¿
	function nextObject(nextObj){	
      if(event.keyCode == 13){ 
      	if(nextObj != ""){
      		if($(nextObj)){
      			$(nextObj).focus();
      		}
      	}
      }
	}
	
	// showLoading ÀÌ¹ÌÁö
	function showLoading(){
		var divSearchMessage = $("t_divProcessIng");
		
//		if(divSearchMessage){
//			divSearchMessage.style.display = "block";		
//		}		
	}
		
	// hideLoading ÀÌ¹ÌÁö
	function hideLoading(){
		var divSearchMessage = $("t_divProcessIng");
		
//		if(divSearchMessage){
//			divSearchMessage.style.display = "none";		
//		}		
	}	

	// ÀÔ·Â(INSERT)
	function insertProcess(dmlType, message){	
		var programUrl		= location.href;
		var parameter		= "";
		var actionMethod	= "";
		
		//alert(programUrl	 +" + "+ message +" + "+dmlType);
		
		var dml_type		= (dmlType != undefined && dmlType != "") ? dmlType : "INSERT";
		/* »ç¿ëÀÚ Á¤ÀÇ ÇÔ¼ö Ãß°¡*/
		if(!checkForm(dml_type)){return;}


		//alert(programUrl	 +" + "+ actionMethod +" + "+dml_type);
		
		if(confirm((message != undefined && message !="") ? message : "µî·Ï ÇÏ½Ã°Ú½À´Ï±î?")){
			process(programUrl, actionMethod, dml_type);
		}
	}
		
	// ¼öÁ¤(UPDATE)
	function updateProcess(dmlType, message){
		var programUrl		= location.href;
		var parameter		= "";
		var actionMethod	= "";
		var dml_type		= (dmlType != undefined && dmlType != "") ? dmlType : "UPDATE";
		/* »ç¿ëÀÚ Á¤ÀÇ ÇÔ¼ö Ãß°¡*/
		if(!checkForm(dml_type)){return;}
		if(confirm((message != undefined && message != "") ? message : "¼öÁ¤ ÇÏ½Ã°Ú½À´Ï±î?")){
			process(programUrl, actionMethod, dml_type);
			return;
		}	
	}
	
	// »èÁ¦(DELETE)
	function deleteProcess(dmlType, message){
		var programUrl		= location.href;
		var parameter		= "";
		var actionMethod	= "";
		var dml_type		= (dmlType != undefined && dmlType != "") ? dmlType : "DELETE";
		/* »ç¿ëÀÚ Á¤ÀÇ ÇÔ¼ö Ãß°¡*/
		if(!checkForm(dml_type)){return;}
		if(confirm((message != undefined && message !="") ? message :"»èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?")){
			process(programUrl, actionMethod, dml_type);
			return;
		}
	}	
	
	// Ãë¼Ò(CANCLE)
	function cancleProcess(layerId){
	   var manageLayerId = (layerId) ? layerId : "divManagedForm";
	   if(parent){
			parent.hiddenLayer(manageLayerId, "none", "");
		}
	}			

	// °øÅëÇÁ·Î¼¼½º
	function process(programUrl, actionMethod, dml_type){
		var DF		= document.forms[0];		
		var dmlType = $("dml_type");
		
		if(DF){
			if (dml_type != undefined && dml_type != ""){
				if(dmlType){dmlType.value = dml_type;}
			}
			
			showLoading();
			
			DF.action = (programUrl != undefined && programUrl != "") ? programUrl : currentUrl;
			DF.method = (actionMethod != undefined && actionMethod != "") ? actionMethod : "post";
			//alert(DF +" + "+ DF.action +"+"+ DF.method);
			DF.submit();
		}
	}		
		
	// ¸®Æ÷Æ® ÆË¾÷À©µµ¿ì Ãâ·Â
	function reportWindow(reportName, reportParam, reportViewer, windowWHDL){
		var _REPORT_WINDOW_VIEWER = (reportViewer != undefined) ? reportViewer : "/report/rexpert/reportOpenWindow.asp"; 
		//[20101001] rexport ºÎºÐ¿¡¼­ ¶óÀÌ¼¾½º ¹®Á¦¶§¹®¿¡ ¿¡·¯ »ý±ä´Ù...
	   var programUrl  			= "http://" + location.hostname + _REPORT_WINDOW_VIEWER;
		//var programUrl  			= "http://172.16.1.151" + _REPORT_WINDOW_VIEWER;
		//alert(location.hostName);
	   var popupName				= "reportPoupViewer";
	   var objReportNameText 	= document.createElement("<input type=\"hidden\" name=\"reportUrl\" />");
	   var objReportParamText 	= document.createElement("<input type=\"hidden\" name=\"reportParam\" />");
		var sizeW					= "940";
		var sizeH					= "640"; 	
		var parameter   			= "";
		var formActionUrl			= location.href;
		
		if(windowWHDL != undefined){

			var arrWHDL = 	(windowWHDL.indexOf("|") > -1) ? windowWHDL.split("|") : "";

			if(arrWHDL.length > 1){
				sizeW = arrWHDL[0];
				sizeH = arrWHDL[1];
			} 
		}

		if(!$("reportUrl")){
			document.forms[0].appendChild(objReportNameText);
		}
		if(!$("reportParam")){
			document.forms[0].appendChild(objReportParamText);		
		}
		document.forms[0].reportUrl.value 	= reportName;
		document.forms[0].reportParam.value = reportParam;
		
		openWindowReport = window.open("/blank.html", popupName, "width=" + sizeW + " height=" + sizeH + " top='5' left='5' scrollbars='no' toolbar='no', location='no', directories='no', status='no', menubar='no', resizable=yes");
	   document.forms[0].action = programUrl;
	   document.forms[0].target = popupName;
	   document.forms[0].submit();
	   openWindowReport.focus();

	   /** Å¸°ÙÀ» ÆË¾÷ÀåÀ¸·Î Çß±â¶§¹®¿¡ ¿ø·¡ ÇöÀçÆäÀÌÁö·Î µ¹·Á¾ß ÇÑ´Ù. */
	   document.forms[0].action = formActionUrl;
	   document.forms[0].target = "_self";
	}

	// ¸®Æ÷Æ® ÆË¾÷À©µµ¿ì Ãâ·Â - formÁßº¹ »ý¼ºÀ¸·Î ·¹Æ÷Æ® Ãâ·Â ¿À·ù ÇØ°á - reportWindow·Î º¯°æ½Ã ¿µÇâ
	function reportWindow2(reportName, reportParam, reportViewer, windowWHDL){
		var _REPORT_WINDOW_VIEWER = (reportViewer != undefined) ? reportViewer : "/report/rexpert/reportOpenWindow.asp"; 
		//[20101001] rexport ºÎºÐ¿¡¼­ ¶óÀÌ¼¾½º ¹®Á¦¶§¹®¿¡ ¿¡·¯ »ý±ä´Ù...
		var programUrl  			= "http://" + location.hostname + _REPORT_WINDOW_VIEWER;
		var popupName				= "reportPoupViewer";

		if(document.forms[0].reportUrl == undefined) {
			var objReportNameText 	= document.createElement("\<input type=\"hidden\" name=\"reportUrl\" /\>");
			if(!$("reportUrl")){
				document.forms[0].appendChild(objReportNameText);
				document.forms[0].reportUrl.value 	= reportName;
			}
		}else{
			document.forms[0].reportUrl.value 	= reportName;
		}

		if(document.forms[0].reportParam == undefined) {
			var objReportParamText 	= document.createElement("\<input type=\"hidden\" name=\"reportParam\" /\>");
			if(!$("reportParam")){
				document.forms[0].appendChild(objReportParamText);
				document.forms[0].reportParam.value = reportParam;
			}
		}else{
			document.forms[0].reportParam.value = reportParam;
		}

		var sizeW					= "940";
		var sizeH					= "640"; 	
		var parameter   			= "";
		var formActionUrl			= location.href;

		if(windowWHDL != undefined){

			var arrWHDL = 	(windowWHDL.indexOf("|") > -1) ? windowWHDL.split("|") : "";

			if(arrWHDL.length > 1){
				sizeW = arrWHDL[0];
				sizeH = arrWHDL[1];
			} 
		}		

		openWindowReport = window.open("/blank.html", popupName, "width=" + sizeW + " height=" + sizeH + " top='5' left='5' scrollbars='no' toolbar='no', location='no', directories='no', status='no', menubar='no', resizable=yes");
		document.forms[0].action = programUrl;
		document.forms[0].target = popupName;
		document.forms[0].submit();
		openWindowReport.focus();

		/** Å¸°ÙÀ» ÆË¾÷ÀåÀ¸·Î Çß±â¶§¹®¿¡ ¿ø·¡ ÇöÀçÆäÀÌÁö·Î µ¹·Á¾ß ÇÑ´Ù. */
		document.forms[0].action = formActionUrl;
		document.forms[0].target = "_self";
	}
	
	// »õÃ¢ÀÇ Å©±â¿Í À§Ä¡ Àç¼³Á¤
	function windowReset(win){
		//while(win.document.readyState != 'complete'){}
		
		var winBody = win.document.body; 
		
		
		var marginHeight = parseInt(winBody.topMargin)+parseInt(winBody.bottomMargin); 
		var marginWidth = parseInt(winBody.leftMargin)+parseInt(winBody.rightMargin); 
		
		var wid = winBody.scrollWidth + (winBody.offsetWidth - winBody.clientWidth) + marginWidth-5; 
		var hei = winBody.scrollHeight + (winBody.offsetHeight - winBody.clientHeight) + marginHeight+17; 

		win.resizeTo(wid, hei); 
	} 
		// ¸®Æ÷Æ® ¾ÆÀÌÇÁ·¹ÀÓ Ãâ·Â
	function reportIFrame(reportName, reportParam){
		var _REPORT_IFRAME_VIEWER = "/report/rexpert/reportOpenIframe.asp"; 
	   var programUrl  = "http://" + location.hostname + _REPORT_IFRAME_VIEWER;
		var parameter 	= "";
		
      parameter += "?reportUrl=" + reportName;
      parameter += "&reportParam=" + reportParam;
      
      programUrl += parameter;
      
      if(iReport){
      	iReport.location.href = programUrl;	
   	}	
	}		
	
	// ÆË¾÷, ºÎ¸ðÃ¢ ·¹ÀÌ¾î´Ý±â
	function windowClose(layerId){
		var objId = "divManage";
      // À©µµ¿ì open ÇÔ¼ö·Î È£Ãâ½Ã 
      if (opener) {
          self.close();
      } else {
      // ·¹ÀÌ¾î·Î È£Ãâ½Ã 
          if (parent) {
          		if(layerId != "undefined" && layerId){ objId = layerId;}
              	cancleProcess(objId);
          }
      }		
	}
	
	// ÀüÃ¼¼±ÅÃ/ÇØÁ¦
	function checkAll(obj, checkName){
		var message =  "¼±ÅÃÇÒ Ç×¸ñÀÌ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.";
		var checkBoxName = eval("document.forms[0]." + checkName);
		
		if( checkBoxName) {
			var size = checkBoxName.length;
			if( !size ) size = 1;
		}else{
			alert(message);
			obj.checked = false;
			return;
		}

		if(obj.checked){
			if( size > 1 ){
				for( var i = 0 ; i < size ; i++ ){
					if(!checkBoxName[i].disabled){
						checkBoxName[i].checked = true;
					}
				}
			}else if( size == 1 ){
				if(!checkBoxName.disabled){
					checkBoxName.checked = true;
				}
			}
		}else{
			if( size > 1 ){
				for( var i = 0 ; i < size ; i++ ){ 
					if(!checkBoxName[i].disabled){
						checkBoxName[i].checked = false;	
					}
				}
			}else if( size == 1 ){
				if(!checkBoxName.disabled){
					checkBoxName.checked = false;
				}
			}
		}

		return;
	}	
	
    // ¼±ÅÃ°³Ã¼ È®ÀÎ
    function checkSelect(checkName) {
        var checkBoxName = eval("document.forms[0]." + checkName);
        var checkCnt = 0;

        if (checkBoxName) {
            var size = checkBoxName.length;
            if (!size) size = 1;
        }

        if (size > 1) {
            for (var i = 0; i < size; i++) {
                if (checkBoxName[i].checked) {
                    checkCnt++;
                }
            }
        } else if (size == 1) {
            if (checkBoxName.checked) {
                checkCnt++;
            }
        }

        if (checkCnt == 0) {
            return "false|";
        } else {
            return "true|" + checkCnt;
        }
    }
    
    
	// ¼±ÅÃ°³Ã¼ °ª È®ÀÎ
	function checkSelectValue(checkName, objectName, selectIndex, quoteYn) {
		var checkBoxName 	= eval("document.forms[0]." + checkName);
		var hiddenObject 	= eval("document.forms[0]." + objectName);
		var quote 			= (quoteYn != undefined && quoteYn == "Y") ? "'" : "";
		var hiddenValue  	= "";
		var checkCnt 		= 0;
		var selectYn		= (selectIndex != undefined && selectIndex != "") ? "Y" : "N";

		if (checkBoxName) {
		   var size = checkBoxName.length;
		   if (!size) size = 1;
		}

		if (size > 1) {
			for (var i = 0; i < size; i++) {
				if(selectYn == "N"){
			      if (checkBoxName[i].checked) {
			      	hiddenValue += quote + hiddenObject[i].value + quote + ",";		
			   		checkCnt++;		   		
			      }
		   	}
		   }
		   if(selectYn == "Y"){
	   		if ( selectIndex != ""){
	   			hiddenValue += quote + hiddenObject[selectIndex].value + quote + ",";		
		   		checkCnt++;		   
	   		}	
	   	}		   

		} else if (size == 1) {
			if(selectYn == "N"){
			   if (checkBoxName.checked) {		   	
			      hiddenValue = quote + hiddenObject.value + quote + ",";
			   	checkCnt++;
			   }
			}else{
				if ( selectIndex != ""){
					hiddenValue = quote + hiddenObject.value + quote + ",";
				   checkCnt++;
				}
			}
		}
		
		if (checkCnt == 0) {
			return "";
		}else{
			hiddenValue = hiddenValue.substring(0, hiddenValue.length-1);	
		}

		return hiddenValue;
	}    
    	    
    	
	
   function MM_preloadImages() { //v3.0
     var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
       var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
       if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
   }
   
   function MM_swapImgRestore() { //v3.0
     var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
   }
   
   function MM_findObj(n, d) { //v4.01
     var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
       d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
     if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
     for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
     if(!x && d.getElementById) x=d.getElementById(n); return x;
   }
   
   function MM_swapImage() { //v3.0
     var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
      if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
   }
   
   function MM_openBrWindow(theURL,winName,features) { //v2.0
     window.open(theURL,winName,features);
   }


   /*--------------------------------------------------
   ±â´É   : Check Null RETURN T/F
   INPUT  : check  data
   RETURN : true  -> NULL
   false -> NOT NULL
   ----------------------------------------------------*/
   function checkNull(toCheck) {
       var chkstr = toCheck + "";
       var is_Space = true;

       if ((chkstr == "") || (chkstr == null))
           return (true);

       for (j = 0; is_Space && (j < chkstr.length); j++) {
           if (chkstr.substring(j, j + 1) != " ") {
               is_Space = false;
           }
       }
       return (is_Space);
   }

   /*--------------------------------------------------
   ±â´É   : Check ÁÖ¹Îµî·Ï¹øÈ£ RETURN T/F
   INPUT  : toCheck
   RETURN : true  -> ¿Ã¹Ù¸¥ ¹øÈ£
   false ->
   ----------------------------------------------------*/
   function checkJumin(toCheck) {
       var isJumin = true;
       if (checkNull(toCheck)) {
           return false;
       } else if (toCheck.length < 13 || toCheck.length > 13) {
           return false;
       } else if (toCheck.substring(2, 3) > "1" || toCheck.substring(6, 7) > "2" || toCheck.substring(6, 7) == "0") {
           return false;
       } else if (toCheck.substring(2, 3) == "1" && toCheck.substring(3, 4) > "2") {
           return false;
       } else if (!(toCheck.substring(4, 6) >= "01" && toCheck.substring(4, 6) <= "31")) {
           return false;
       }
       for (j = 0; isJumin && (j < toCheck.length); j++) {
           if (((toCheck.substring(j, j + 1) < "0") || (toCheck.substring(j, j + 1) > "9"))) {
               isJumin = false;
           }
       }

       var a1 = toCheck.substring(0, 1)
       var a2 = toCheck.substring(1, 2)
       var a3 = toCheck.substring(2, 3)
       var a4 = toCheck.substring(3, 4)
       var a5 = toCheck.substring(4, 5)
       var a6 = toCheck.substring(5, 6)
       var check_digit = a1 * 2 + a2 * 3 + a3 * 4 + a4 * 5 + a5 * 6 + a6 * 7
       var b1 = toCheck.substring(6, 7)
       var b2 = toCheck.substring(7, 8)
       var b3 = toCheck.substring(8, 9)
       var b4 = toCheck.substring(9, 10)
       var b5 = toCheck.substring(10, 11)
       var b6 = toCheck.substring(11, 12)
       var b7 = toCheck.substring(12, 13)

       var check_digit = check_digit + b1 * 8 + b2 * 9 + b3 * 2 + b4 * 3 + b5 * 4 + b6 * 5
       check_digit = check_digit % 11
       check_digit = 11 - check_digit
       check_digit = check_digit % 10
       if (check_digit != b7) {
           isJumin = false;
       }

       return isJumin;
   }

   /*--------------------------------------------------
   ±â´É   : Check »ç¾÷ÀÚ µî·Ï¹øÈ£ RETURN T/F
   INPUT  : toCheck
   RETURN : true  -> ¿Ã¹Ù¸¥ ¹øÈ£
   false ->
   ----------------------------------------------------*/
   function checkSaupJa(toCheck) {
       var isSaupJa = true;
       if (checkNull(toCheck)) {
           return false;
       } else if (toCheck.length < 10 || toCheck.length > 10) {
           return false;
       }
       for (j = 0; isSaupJa && (j < toCheck.length); j++) {
           if (((toCheck.substring(j, j + 1) < "0") || (toCheck.substring(j, j + 1) > "9"))) {
               isSaupJa = false;
           }
       }
       return isSaupJa;
   }

   // ¹ýÀÎ¹øÈ£ Ã¼Å©
   function checkBubin(num) {
       var arrNum = new Array(13);
       var arrMul = new Array("1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2");
       var checkNum = 0;
       var checkSum = 0;
       var validNum = 0;

       if (num.length != 13) {
           //alert("Àß¸øµÈ ¹ýÀÎ¹øÈ£ÀÔ´Ï´Ù.");
           return false;
       } else {
           for (var i = 0; i < 13; i++) {
               arrNum[i] = parseInt(num.charAt(i));
               if (i == 12) {
                   checkNum = arrNum[i];
               } else {
                   checkSum += parseInt(arrNum[i]) * parseInt(arrMul[i]);
               }
           }

           if ((checkSum % 10) > 9) {
               validNum = 0;
           } else {
               validNum = 10 - (checkSum % 10);
               validNum = validNum % 10;
           }

           if (checkNum == validNum) {
               return true;
           } else {
               return false;
           }
       }
   }   
   
   // ÀÌ¸ÞÀÏ Ã¼Å© 
   function checkEmail(email){
   	var checkEmail = /(\S+)@(\S+)\.(\S+)/;
   	
   	if(!checkEmail.test(email)){
   		return false;
   	}else{
   		return true;
   	}	
   }
   
   // »õÃ¢ÀÇ Å©±â¿Í À§Ä¡ Àç¼³Á¤
   function windowResizing(win){ 
		window.resizeTo(100, 100);
		var thisX 		= parseInt(document.body.scrollWidth);
		var thisY 		= parseInt(document.body.scrollHeight);
		var maxThisX 	= screen.width - 50;
		var maxThisY 	= screen.height - 50;
		var marginY 	= 0;
		
		//alert("ÀÓ½Ã ºê¶ó¿ìÀú È®ÀÎ : " + navigator.userAgent);
		// ºê¶ó¿ìÀúº° ³ôÀÌ Á¶Àý. (Ç¥ÁØ Ã¢ ÇÏ¿¡¼­ Á¶ÀýÇØ ÁÖ½Ê½Ã¿À.)
		if (navigator.userAgent.indexOf("MSIE 6") > 0) marginY = 60;        // IE 6.x
		else if(navigator.userAgent.indexOf("MSIE 7") > 0) marginY = 80;    // IE 7.x
		else if(navigator.userAgent.indexOf("Firefox") > 0) marginY = 50;   // FF
		else if(navigator.userAgent.indexOf("Opera") > 0) marginY = 30;     // Opera
		else if(navigator.userAgent.indexOf("Netscape") > 0) marginY = -2;  // Netscape
		
		if (thisX > maxThisX) {
			window.document.body.scroll = "yes";
			thisX = maxThisX;
		}
		if (thisY > maxThisY - marginY) {
			window.document.body.scroll = "yes";
			thisX += 19;
			thisY = maxThisY - marginY;
		}
		
		window.resizeTo(thisX+10, thisY+marginY+20);    
		  
  }

  // ÅÇ¸Þ´º ÀÌµ¿
  function tabMenu(programUrl) {
      process(programUrl, "post");
  }

  // ÀÔ·Â°ª ¼ýÀÚ¸¸ ÀÔ·Â 
  // style="ime-mode:disabled;" ¹Ýµå½Ã ÀÔ·ÂÇØ¾ß ÇÔ. onkeyup="onlyNumber(this)"
  function onlyNumber(obj) {
      if (event.keyCode) {
          // 0 ~ 9, backspace, delete, .
          if ((escape(event.keyCode) >= 48 && escape(event.keyCode) <= 57) ||
				 escape(event.keyCode) == 8 || escape(event.keyCode) == 190 || escape(event.keyCode) == 46) {
              return true; ;
          } else {
              var val = obj.value;
              var re = /[^0-9]/gi;
              obj.value = val.replace(re, "");
          }
      }
  } 	
	
	// °´Ã¼ º¸ÀÌ±â
	function show(objId){
		var obj = $(objId);
		
		if(obj){
			obj.style.display = "block";
		}else if(objId){
			objId.style.display = "block";
		}		
	}		
	
	// °´Ã¼ º¸ÀÌ±â
	function hide(objId){
		var obj = $(objId);
		
		if(obj){
			obj.style.display = "none";		
		}else if(objId){
			objId.style.display = "none";
		}			
	}			
	
	// °´Ã¼ Æ÷Ä¿½ºÁÖ±â
	function setFocus(objId, resetValue, message){
		var obj = $(objId);
		
		if(message != undefined && message != ""){
			alert(message);	
		}
		
		if(obj){
			if(resetValue != undefined && resetValue == ""){
				obj.value = "";				
			}
			obj.focus();
         obj.style.backgroundColor = "yellow";
           	
		}else if(objId){
			if(resetValue != undefined && resetValue == ""){
				objId.value = "";			
			}
			objId.focus();
         objId.style.backgroundColor = "yellow";         
		}				
	}
	
	// °³Ã¼¹øÈ£ °¡Á®¿À±â
	function dispAnimalNo(animalNo, dispType){
		var temp = "";
		
		if(animalNo.length == 15){
			animalNo = animalNo.substr(3, 12);
		}

		if(animalNo.length == 12){
			temp  = animalNo.substr(0, 3);
			temp += " " + animalNo.substr(3, 4);  	
			
			if(dispType == ""){
				temp += " " + animalNo.substr(7, 4);  	
			}else{
				temp += " <strong>" + animalNo.substr(7, 4) + "</strong>";  	
			}
			temp += " " + animalNo.substr(11, 1); 
		}
		
		return temp;		
	}
	
	// °´Ã¼ disabled ½ÃÅ°±â
	function setDisabled(objId){
		var obj;
		
		if(objId){
		 	obj = objId;
		}else{
			obj = $(objId);	
		}
		
		if(obj){
			if(obj.type == "select-one" || obj.type == "text"){
				obj.disabled = true;
				obj.style.backgroundColor = "#dcdcdc";						
			}else if(obj.type == "checkbox"){
				obj.checked = false;
			}else if(obj.type == "radio"){
				obj.checked = false;
			}
		}
	}
	
	// °´Ã¼ enabled ½ÃÅ°±â
	function setEnabled(objId){
		var obj;
		
		if(objId){
		 	obj = objId;
		}else{
			obj = $(objId);	
		}
		
		if(obj){
			if(obj.type == "select-one" || obj.type == "text"){
				obj.disabled = false;
				obj.style.backgroundColor = "#FFFFFF";						
			}else if(obj.type == "checkbox"){
				obj.checked = true;
			}else if(obj.type == "radio"){
				obj.checked = true;
			}
		}
	}	
	
	// iframeÀ¸·Î Ã³¸®ÇÏ±â
	function iframeProcess(programUrl, objId, windowProperty){
		var obj 			= $((objId == undefined) ? "divManage" : objId);
		var sizeWidth 	= "1000";
		var sizeHeight = "200";
		
		if(windowProperty != undefined){
			if(windowProperty.indexOf("|") > -1){
				sizeWidth = windowProperty.split("|")[0];	
				sizeHeight = windowProperty.split("|")[1];	
			}	
		}
		
		if(obj){
			obj.innerHTML = "<iframe id='iframeForm' src='" + ((programUrl != undefined) ? programUrl : "") + "' width='" + sizeWidth + "' height='" + sizeHeight + "' onload='resizeFrame(this)' frameborder='0' scrolling='no'></iframe>"; 
		}
	}
	
	// Å¬¸³º¸µå¿¡ º¹»ç
	function copyClipBoard(contents){
        window.clipboardData.setData('Text', contents);
	}
	
    // ¸Þ½ÃÁö ±æÀÌ 
    function getBytes(contents) {
        var bytesLen = 0;

        for (var i = 0; i < contents.length; i++) {
            var oneChar = contents.charAt(i);
            if (escape(oneChar).length > 4) {
                bytesLen += 2;
            } else if (oneChar != '\r' || oneChar != '\n') {
                bytesLen++;
            }
        }
        return bytesLen;
    }


    // ÁÖ¹Î/»ç¾÷ÀÚ/¹ýÀÎ¹øÈ£ º¸¿©ÁÖ±â
    function dispJuminCorpNo(param) {
        var temp = (param != undefined) ? param : "";

        if (temp != "") {
            temp = replaceAll(temp, " ", "");
            if (temp.length == 10) {
                temp = temp.substr(0, 3) + "-" + temp.substr(3, 2) + "-" + temp.substr(5, 5);
            } else if (param.length == 13) {
                temp = temp.substr(0, 6) + "-" + temp.substr(6, 1) + "******";
            }
        }

        return temp;
    }    
    
	//ÅØ½ºÆ® ¹Ú½º¿¡ ¿£ÅÍÅ° ÀÔ·Â½Ã Æ÷½ºÆ®¹é ¹æÁö & ¿£ÅÍÅ°¸¦ ÅÜÅ°·Î ¹Ù²ã ÁÜ
	function checkCR(evt) {
	   var evt = (evt) ? evt : ((event) ? event : null);
	   var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
	   if ((evt.keyCode == 13) && (node.type == "text" || node.type == "select-one" ||  node.type == "checkbox" || node.type == "radio")) {
	       window.event.keyCode = 9;
	       return true;
	   }
	}
	
	//document.onkeydown = checkCR;
