	function chkFromToDate(sDate, eDate) {

		var SDATE = sDate.value;
		var EDATE = eDate.value;

		if(SDATE <= EDATE) {
			return false;
		}else{
			return true;
		}
	}

	/*
	 작성일 : 2002-07-18
	 작성자 : 김종기
	 내  용 : 날짜 형식체크
	 예  제 : checkDate(날짜형식이 있는 폼의 필드이름)
			  checkDate(formName.fieldName);
	*/
	function checkDate(srcDate) {
		var txtDate = srcDate.value;
		var sDate = txtDate.replace(/(\,|\.|\-)/g,"");
		var aDaysInMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);

		if(sDate.length != 0) {
			if(sDate.length == 8) {
				//길이가 맞으면 년,월, 일 단위로 검사한다.
				iYear=sDate.substr(0,4);
				iMonth=sDate.substr(4,2);
				iDay=sDate.substr(6,2);

				if ( !isNaN(iYear)) {
					if(iYear<1) {
						return true;
					}
					if(! isNaN(iMonth)) {
						if(! isNaN(iDay)) {
							// 윤달체크
							var iDaysInMonth=(iMonth!=2)?aDaysInMonth[iMonth-1]:((iYear%4==0 && iYear%100!=0 || iYear % 400==0)?29:28);

							if(iMonth<=0 || iMonth>=13) {
								return true;
							}else if(iDay<=0 || iDay>iDaysInMonth) {
								return true;
							}else {
								return false;
							}
						} else {
							return true;
						}
					} else {
						return true;
					}
				} else {
					return true;
				}
			} else {
				return true;
			}
		}
	}

	/*
	 *글자수(Bytes) 체크<BR>
	 *@param	OBJ					Check하는 폼필들
	 *@param	MAXLENGTH 폼필드의		DB Size
	 *@return	Boolean(true/false)		DB Size > OBJ Size : true(DB에 Insert 가능)
	 *	                                DB Size < OBJ Size : false(DB에 Insert시 에러발생)
	 */
	function chkBytes(OBJ , MAXLENGTH){
		var TEXT	= OBJ.value;
		var CODE	= '';
		var BYTES	= 0;
		var BOOLEAN	= false;

		if(TEXT){
			for(var i=0; i< TEXT.length; i++){

				CODE = TEXT.charCodeAt(i);

				if(32 < CODE && CODE < 128){
					BYTES++;
				}else{
					BYTES +=2;
				}

				if(BYTES > MAXLENGTH) {
					BOOLEAN = true;
					break;
				}
			}
		}

		return BOOLEAN;
	}

	//숫자여부확인 ONBLUR()
	function checkNumber(obj){
		if(!isNumber(obj.value)){
			alert("숫자로만 이루어진 항목입니다.");
			obj.value = "";
			obj.focus();
			return false;
		}

		return true;
	}

	function checkCode() {
		var key = String.fromCharCode(event.keyCode);
		var re = new RegExp('[0-9]');

		if(!re.test(key)) {
			event.returnValue = false;
		}
	}

	function chkCode(filter){		if(filter){			var key = String.fromCharCode(event.keyCode);			var re = new RegExp(filter);			if(!re.test(key)) {				event.returnValue = false;			}		}	}

	function checkEnter(e) {		if(e.keyCode == 13) {			event.returnValue = false;		}	}

	
	function searchCourse(returnUrl) {		win=window.open("","","status=1,menubar=0,scrollbars=0,resizable=0,width=650,height=640,align=left,left=0,top=0");		win.location="/eduport/front/common/course/comCourseSrchFrm.jsp?pURL="+returnUrl;	}

	function searchSeq(frm, frmAction) {
		if(frm.pYear.value == "") {			alert("년도를 먼저 선택하세요.");			frm.pYear.focus();			return;
		}
		frm.action = frmAction;		frm.target = "_self";		frm.submit();
	}

	// 차수검색 FrameSet
	function seqYearChanged(crsCode, year, sqNo, windowName, frm){
	    var formName = frm.name;
		if (year == "00") {			alert("년도를 먼저 선택하세요.");			return;		}		parent.resolver.document.location = "/eduport/front/common/dynamic/comCrsSqNoSrch.jsp?pCrsCode="+crsCode+"&pYear="+year+"&pSqNo="+sqNo+"&pFrameName="+windowName+"&pFormName="+formName;
    }

	// 차수검색 FrameSet
	function searchSequence(crsCode, year, sqNo, classNo, aspCode, windowName, frm, flag){
	    var formName = frm.name;		if (year == "00") {			alert("년도를 먼저 선택하세요.");			return;		}		if(flag == null){			parent.resolver.location ="/eduport/front/common/dynamic/comCrsSqNoSrch.jsp?pCrsCode="+crsCode+"&pYear="+year+"&pSqNo="+sqNo+"&pClassNo="+classNo+"&pAspCode="+aspCode+"&pFrameName="+windowName+"&pFormName="+formName;		} else {			parent.resolver.location ="/eduport/front/common/dynamic/comCrsSqNoSrch.jsp?pCrsCode="+crsCode+"&pYear="+year+"&pSqNo="+frm.pSqNo.options[frm.pSqNo.selectedIndex].value+"&pClassNo="+classNo+"&pAspCode="+aspCode+"&pFrameName="+windowName+"&pFormName="+formName;		}
    }
	function searchCodeMiddle(codeMain, frmName) {		//var codeMain = document.frmCourse.pCodeMain.value;		//var frmName = document.frmCourse.name;		parent.frmHidden.document.location = "/eduport/front/common/dynamic/comClassifyMiddleSrch.jsp?pCodeMain="+codeMain+"&pFrameName=frmMain&pFormName="+frmName;
	}
	function searchCodeSmall(codeMain, codeMiddle, frmName) {		//var codeMain = document.frmCourse.pCodeMain.value;		//var codeMiddle = document.frmCourse.pCodeMiddle.value		//var frmName = document.frmCourse.name;		parent.frmHidden.document.location = "/eduport/front/common/dynamic/comClassifySmallSrch.jsp?pCodeMain="+codeMain+"&pCodeMiddle="+codeMiddle+"&pFrameName=frmMain&pFormName="+frmName;
	}	function countOptions(linkFile, atchFile, atchYn) {		var len1, len2;		len1 = linkFile.length;		linkFile.options[0].selected = false;
		for(i = 1; i < len1; i++) {			linkFile.options[i].selected = true;		}
		len2 = atchFile.length;
		atchFile.options[0].selected = false;
		if(len2 > 1) {			atchYn.value = "Y";			for(i = 1; i < len2; i++) {				atchFile.options[i].selected = true;			}		} else {			atchYn.value = "N";		}	}

	function countOption(atchFile, atchYn) {
		var len = atchFile.length;

		atchFile.options[0].selected = false;

		if(len > 1) {
			atchYn.value = "Y";

			for (i = 1; i < len; i++) {
				atchFile.options[i].selected = true;
			}

		} else {
			atchYn.value = "N";
		}
	}		function submitFile(frmSubmit, formName, fieldName, type, saveKey, sizeKey) {		var loc1 = screen.availWidth;				//	화면 폭		var loc2 = screen.availHeight;				//	화면 높이				var wid = 279;		var hig = 179;		frmSubmit.action = "/common/upload/uplSubmitFileFrm.jsp";		if(type == 1) {			frmSubmit.pAllowType.value = "jpg,gif,jpeg";		//	허용 이미지 확장자			frmSubmit.pAtchType.value = "01";			} else if(type == 2) {			frmSubmit.pAllowType.value = "";			frmSubmit.pAtchType.value = "02";		} else if(type == 3) {			frmSubmit.pAllowType.value = "swf";			frmSubmit.pAtchType.value = "03";		} else if(type == 4) {			document.domain = "mcst.go.kr";			frmSubmit.pAllowType.value = "";			frmSubmit.pAtchType.value = "04";			frmSubmit.action = "http://vod.mcst.go.kr:8000/jsp/vodupload.jsp";			wid = 443;			hig = 690;		}		frmSubmit.pSaveKey.value = saveKey;		frmSubmit.pMaxSize.value = sizeKey;				frmSubmit.pFormName.value = formName;		frmSubmit.pFieldName.value = fieldName;		win = window.open("", "SUBMIT", "status=0,menubar=0,scrollbar=0,resizable=0,width="+wid+",height="+hig+",align=left,left="+(loc1-279)/2+",top="+(loc2-179)/2);		frmSubmit.target = "SUBMIT";		frmSubmit.submit();		return;	}
	//************************************************************************************************//	// fileUpload함수(파일첨부 최대갯수 확인 후 팝업 실행)	// Prameter : oNode(file Select Object)	//					nLimit : 최대갯수	//					strKey : filepath.properites의 path키나 MENU_CD값	//					nSize : 최대 첨부파일 용량 크기	//					nType : 1 : ONLY IMAGES FILE, 2 : NO LIMIT FILE TYPE	//************************************************************************************************//		function fileCheck(oNode, nLimit, strKey, nSize, nType) {		if(oNode.length - 1 < nLimit) {			if(nType == null) {				nType = 1;			}			//document.frmWrite.pAtchFile, 6, 'MenuCD', 20 ,2			var frm = document.frmSubmit;				if(document.frmSubmit == null) {				frm = document.createElement("form");				frm.method = "post";					var aData = new Array("pFormName", "pFieldName", "pSaveKey", "pMaxSize", "pAllowType", "pAtchType");							for(var i = 0; i < aData.length; i++) {					var strData = "<input type='hidden' name='" + aData[i] + "' value='' />";					frm.insertAdjacentHTML("beforeEnd", strData);				}					document.appendChild(frm);			}			submitFile(frm, oNode.form.name, oNode.name, nType, strKey, nSize);		}else{			alert("첨부파일은 최대 " + nLimit + "개까지 가능합니다.\n등록된 파일을 먼저 삭제하여 주십시오.");		}	}
	function deleteFile(frmDel, selectBox, saveKey) {	    var i, selected;		if(selectBox.length == 1) {	        alert("첨부된 파일이 없습니다.");	        return;	    }
		if(selectBox.selectedIndex <= 0) {	        alert("선택한 파일이 없습니다.");	        return;	    }
		selected = selectBox.selectedIndex;		// select box에서 선택한 위치
		if(confirm(selectBox.options[selected].text + "-" + "선택한 파일을 삭제하시겠습니까?") == false) {	        return;	    }
		if(frmDel == null) {			frmDel = document.createElement("form");			frmDel.method = "post";			var aData = new Array("pSaveKey", "pDelName");
			for(var i = 0; i < aData.length; i++) {				var strData = "<input type='hidden' name='" + aData[i] + "' value='' />";				frmDel.insertAdjacentHTML("beforeEnd", strData);			}			document.appendChild(frmDel);		}		var frame = document.getElementsByName("DELTEMPFILE");
		if(frame.length == 0) {			document.body.insertAdjacentHTML("beforeEnd", "<iframe name='DELTEMPFILE' style='display:none'></iframe>");		}

		frmDel.pSaveKey.value = saveKey;
		// 삭제할 파일 정보
		/**		 *	비동기적으로 파일을 삭제한다. 반드시 incAttachForm.jspf에 <iframe name="DELTEMPFILE" width="200" height="200"></iframe>		 *	ELEMENT가 존재해야한다.		 */
		frmDel.pDelName.value = selectBox.options[selected].value;		frmDel.target = "DELTEMPFILE";		frmDel.action = "/common/upload/uplDeleteFile.jsp";		frmDel.submit();
	    // 리스트의 위치를 한칸씩 위로 올린다.
	    for(i = selected; i < selectBox.length-1; i++) {	        selectBox.options[i].value = selectBox.options[i+1].value;	        selectBox.options[i].text = selectBox.options[i+1].text;	    }	    selectBox.length--;		// 길이를 줄여준다.		return;	}
	function preview(frmPreview, contents, type) {
		var previewWindow;
		frmPreview.pContents.value = contents.value; 		if(type[0].checked == true) {			frmPreview.pContentsType.value = "01"; 		// TEXT		} else if(type[1].checked == true ) {			frmPreview.pContentsType.value = "02"; 		// HTML		}
		previewWindow = window.open("","PREVIEW","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=650,height=550");		previewWindow.opener = self;		previewWindow.focus();
		frmPreview.target = "PREVIEW";		frmPreview.submit();		return;	}
	
	// 본문에 이미지링크를 추가하기 위한 메소드
	function checkLink(frmLink, formName, selectBox, linkField, saveKey, linkKey) {
		var index;				// select box에서 선택된 위치		var selectedValue;		// select box에서 선택된 위치의 값
		if(selectBox.length == 1) {			alert("첨부된 파일이 없습니다.");			return;		}		if(selectBox.selectedIndex <= 0) {			alert("선택한 파일이 없습니다.");			return;		}		index = selectBox.selectedIndex;		selectedValue = selectBox.options[index].value;		frmLink.pSaveKey.value = saveKey;		frmLink.pLinkKey.value = linkKey;		frmLink.pFileInfo.value = selectedValue;		frmLink.pFormName.value = formName;		frmLink.pLinkField.value = linkField;
		win = window.open("","CHECK","left=100,top=100,location=0,toolbar=0,menubar=0,width=450,height=80");		win.opener = self;		win.focus();
		frmLink.target = "CHECK";		frmLink.submit();		return;	}

	function downloadFile(frmDownload, selectBox, saveKey) {
		var index;				// select box에서 선택된 위치		var selectedValue;		// select box에서 선택된 위치의 값		if(selectBox.length == 1) {			alert("첨부된 파일이 없습니다.");			return;		}		if(selectBox.selectedIndex <= 0) {			alert("선택한 파일이 없습니다.");			return;		}		index = selectBox.selectedIndex;		selectedValue = selectBox.options[index].value;		var value = selectedValue;		var	intStr1	= 0;		var intStr2	= value.indexOf("|");		var intStr3	= value.indexOf("|", intStr2+1);		var intStr4	= value.indexOf("|", intStr3+1);		var intStr5	= value.length;
		frmDownload.pSaveKey.value = saveKey;		frmDownload.pFileName.value = value.substring(intStr3+1, intStr4);		// 파일명		frmDownload.pRealName.value = value.substring(intStr4+1, intStr5);		// 저장된 실제 파일명
		frmDownload.submit();	}

	function downloadTextFile(frmDownload, atchFile, saveKey) {
		if(atchFile.value == '') {
			alert("파일을 첨부하세요.");
			return;
		}

		var value = atchFile.value;

		var	intStr1	= 0;
		var intStr2	= value.indexOf("|");
		var intStr3	= value.indexOf("|", intStr2+1);
		var intStr4	= value.indexOf("|", intStr3+1);
		var intStr5	= value.length;

		frmDownload.pSaveKey.value = saveKey;
		frmDownload.pFileName.value = value.substring(intStr3+1, intStr4);		// 파일명
		frmDownload.pRealName.value = value.substring(intStr4+1, intStr5);		// 저장된 실제 파일명

		frmDownload.submit();
	}

	
	function submitTextFile(frmSubmit, formName, fieldName, hiddenName, hiddenField, saveKey, sizeKey, allowType, atchType) {
		if(hiddenField.value != "") {			alert("첨부파일은 하나만 등록가능합니다. 등록된 파일을 먼저 삭제하세요.");			return;		}
		frmSubmit.pFormName.value = formName;		frmSubmit.pFieldName.value = fieldName;		frmSubmit.pHiddenName.value = hiddenName;
		frmSubmit.pSaveKey.value = saveKey;		frmSubmit.pMaxSize.value = sizeKey;		frmSubmit.pAllowType.value = allowType;		frmSubmit.pAtchType.value = atchType;
		var loc1 = screen.availWidth;		var loc2 = screen.availHeight;
		win = window.open("", "SUBMIT", "status=0,menubar=0,scrollbar=0,resizable=0,width=279,height=179,align=left,left="+(loc1-279)/2+",top="+(loc2-179)/2);
		frmSubmit.target = "SUBMIT";		frmSubmit.submit();
		return;	}

	// 실제 첨부파일을 삭제하기 위한 메소드
	function deleteTextFile(frmDel, fieldName, hiddenName, saveKey, type) {
	    var textField = fieldName;
		var hiddenField = hiddenName;


		if(hiddenField.value == "") {
	        alert("첨부된 파일이 없습니다.");
	        return;
	    }

		var result = confirm( "첨부파일을 삭제하시겠습니까?");

	    if(!result) {
	        return;
	    }
	    // 삭제할 파일 정보
		frmDel.pDelName.value = hiddenField.value;
		frmDel.pSaveKey.value = saveKey;

		frmDel.submit();

		if(type == 1) {

			textField.value = "------------- TXT " + "파일" + " -------------";
			hiddenField.value = "";

		} else if(type == 2) {

			textField.value = "------------- HTML " + "파일" + " -------------";
			hiddenField.value = "";

		} else if(type == 3) {

			textField.value = "------------- ZIP " + "파일" + " -------------";
			hiddenField.value = "";

		} else if(type == 4) {
			textField.value = "----- jpeg,jpg,gif " + "파일" + " -----";
			hiddenField.value = "";

		} else if(type == 5) {
			textField.value = "---------- JPG, GIF " + "파일" + " ----------";
			hiddenField.value = "";

		} else if(type == 6) {
			textField.value = "------------ " + "첨부 파일" + " -------------";
			hiddenField.value = "";
		}
		return;
	}

	function sendMail(count, frm){
		if(count == 0) {
			return;
		}

		if(count == 1) {
			if(!frm.pCheck.checked) {
				alert("메일 발송 대상을 선택하세요.");
				return;
			}
		}

		var checked = false;

		if(count > 1) {
			for(var i = 0; i < frm.pCheck.length; i++) {
				if(frm.pCheck[i].checked) {
					checked = true;
				}
			}

			if(!checked) {
				alert("메일 발송 대상을 선택하세요.");
				return;
			}
		}

		var mailSendWindow;

		mailSendWindow = window.open("","Mmail","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=650,height=550");
		mailSendWindow.opener = self;
		mailSendWindow.focus();

		frm.target = "Mmail";
		frm.action = '/eduport/front/common/mail/comMailSendFrm2nd.jsp';
		frm.submit();
		return;
	}

	function sendMail2nd(count, frm){
		if(count == 0) {
			return;
		}

		if(count == 1) {
			if(!frm.pCheck.checked) {
				alert("메일 발송 대상을 선택하세요.");
				return;
			}
		}

		var checked = false;

		if(count > 1) {
			for(var i = 0; i < frm.pCheck.length; i++) {
				if(frm.pCheck[i].checked) {
					checked = true;
				}
			}

			if(!checked) {
				alert("메일 발송 대상을 선택하세요.");
				return;
			}
		}

		var mailSendWindow;

		mailSendWindow = window.open("","Mmail","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=650,height=550");
		mailSendWindow.opener = self;
		mailSendWindow.focus();

		frm.target = "Mmail";
		frm.action = '/eduport/front/common/mail/comMailSendFrm.jsp';
		frm.submit();
		return;
	}

	function sendMemo(count, frm){
		if(count == 0) {
			return;
		}

		if(count == 1) {
			if(!frm.pCheck.checked) {
				alert("쪽지 발송 대상을 선택하십시오.");
				return;
			}
		}

		var checked = false;

		if(count > 1) {
			for(var i = 0; i < frm.pCheck.length; i++) {
				if(frm.pCheck[i].checked) {
					checked = true;
				}
			}

			if(!checked) {
				alert("쪽지 발송 대상을 선택하십시오.");
				return;
			}
		}

		var memoSendWindow;

		memoSendWindow = window.open("","Mmemo","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=400,height=350");
		memoSendWindow.opener = self;
		memoSendWindow.focus();

		frm.target = "Mmemo";
		frm.action = '/eduport/front/common/memo/comMemoSendFrm.jsp';
		frm.submit();
		return;
	}

	var selectMode = 0;

	function selectCheckBox(num, checkValue) {
		if(num == 0) {
			return;
		}

		var value;

		if(selectMode == false) {
			value = true;
			selectMode = 1;
		} else {
			value = false;
			selectMode = 0;
		}

		if(num == 1) {
			checkValue.checked = value;
		}

		if(num > 1) {
			for(i = 0; i < checkValue.length; i++ ) {
				checkValue[i].checked = value;
			}
		}

		return;
	}

	function isChecked(num, checkValue) {
		var retVal = false;

		if (num == 1) {
			if (checkValue.checked) {
				retVal = true;
			}

		} else {

			for(i = 0; i < checkValue.length; i++) {
				if(checkValue[i].checked) {
					retVal = true;
				}
			}
		}

		return retVal;
	}

function addFile(oNode, strData) {
	var aData = strData.split("|");
	var strFileName = aData[2];

	var oOption = document.createElement("option");
	oOption.value = strData;
	oOption.text = strFileName;

	oNode.options.add(oOption);
}

function filePreview(oSelect, strSaveKey) {
	var strData = oSelect.options[oSelect.selectedIndex].value;
	var aData = strData.split("|");

	if(aData.length == null || aData.length != 4) {
		return;
	}

	download(aData[2], aData[3], strSaveKey);
}