	function chkFromToDate(sDate, eDate) {

		var SDATE = sDate.value;
		var EDATE = eDate.value;

		if(SDATE <= EDATE) {
			return false;
		}else{
			return true;
		}
	}

	/*
              checkDate(DATE time form tye)
			  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 check<BR>
	 *@param	OBJ					Check
	 *@param	MAXLENGTH form filed		DB Size
	 *@return	Boolean(true/false)		DB Size > OBJ Size : true(DB Insert ok)
	 *	                                DB Size < OBJ Size : false(DB Insert cancel)
	 */
	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;
	}

	//checknumber ONBLUR()
	function checkNumber(obj){
		if(!isNumber(obj.value)){
			alert("Only number.");
			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;
		}
	}

	// page open
	function searchCourse(returnUrl) {

		win=window.open("","","status=1,menubar=0,scrollbars=0,resizable=0,width=650,height=600,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("Select year.");
			frm.pYear.focus();
			return;
		}

		frm.action = frmAction;
		frm.target = "_self";
		frm.submit();
	}

	// select FrameSet
	function seqYearChanged(crsCode, year, sqNo, windowName, frm){
	    var formName = frm.name;

		if (year == "00") {
			alert("Select year.");
			return;
		}

		parent.resolver.document.location = "/eduport/front/common/dynamic/comCrsSqNoSrch.jsp?pCrsCode="+crsCode+"&pYear="+year+"&pSqNo="+sqNo+"&pFrameName="+windowName+"&pFormName="+formName;
    }

	// select FrameSet
	function searchSequence(crsCode, year, sqNo, classNo, aspCode, windowName, frm, flag){
	    var formName = frm.name;

		if (year == "00") {
			alert("Select year.");
			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;
		}
    }

	// 1ch 2ch combo select list
	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;
	}

	// 1ch 2ch 3ch combo select list
	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;
	}

	// attch count
	function countOptions(linkFile, atchFile, atchYn) {
		var len1, len2;

		len1 = linkFile.length;		// contenct count

		linkFile.options[0].selected = false;

		for(i = 1; i < len1; i++) {
			linkFile.options[i].selected = true;
		}

		len2 = atchFile.length;		// attch count

		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";
		}
	}

	// attch file
	function submitFile(frmSubmit, formName, fieldName, type, saveKey, sizeKey) {

		var loc1 = screen.availWidth;
		var loc2 = screen.availHeight;

		// contents attch
		if(type == 1) {
			frmSubmit.pAllowType.value = "jpg,gif,jpeg";
			frmSubmit.pAtchType.value = "01";

		// attch file
		} else if(type == 2) {
			frmSubmit.pAllowType.value = "";
			frmSubmit.pAtchType.value = "02";
		}

		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=279,height=179,align=left,left="+(loc1-279)/2+",top="+(loc2-179)/2);

		frmSubmit.target = "SUBMIT";
		frmSubmit.submit();

		return;
	}

	// attch delete
	function deleteFile(frmDel, selectBox, saveKey) {
	    var i, selected;

		// check attch YN
		if(selectBox.length == 1) {
	        alert("no file");
	        return;
	    }

	    // check attch select
		if(selectBox.selectedIndex <= 0) {
	        alert("no selection file");
	        return;
	    }

		selected = selectBox.selectedIndex;		// select box

	    if(confirm(selectBox.options[selected].text + "- delete ?") == false) {
	        return;
	    }

		frmDel.pSaveKey.value = saveKey;

	    // delete file location
		frmDel.pDelName.value = selectBox.options[selected].value;

		frmDel.submit();

	    // list up
	    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--;		// length delete
		return;
	}

	// view open
	function preview(frmPreview, contents, type) {
		var previewWindow;
		
		frmPreview.pContents.value = contents.value; 		// contents

		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;
	}
	
	// contents images attch
	function checkLink(frmLink, formName, selectBox, linkField, saveKey, linkKey) {
		var index;				// select box select location
		var selectedValue;		// select box select location value

		if(selectBox.length == 1) {
			alert("Not attachment file");
			return;
		}

		if(selectBox.selectedIndex <= 0) {
			alert("Not attachment file");
			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;		// images insert text area name

		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 location
		var selectedValue;		// select box location values

		if(selectBox.length == 1) {
			alert("No attachment file.");
			return;
		}

		if(selectBox.selectedIndex <= 0) {
			alert("No attachment file.");
			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);		// file name
		frmDownload.pRealName.value = value.substring(intStr4+1, intStr5);		// save file name

		frmDownload.submit();
	}

	function downloadTextFile(frmDownload, atchFile, saveKey) {
		if(atchFile.value == '') {
			alert('Inner attachment file');
			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);		// file name
		frmDownload.pRealName.value = value.substring(intStr4+1, intStr5);		// save file name

		frmDownload.submit();
	}

	// attch file method
	function submitTextFile(frmSubmit, formName, fieldName, hiddenName, hiddenField, saveKey, sizeKey, allowType, atchType) {

		if(hiddenField.value != "") {
			alert("Only one attachment file");
			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;
	}

	// file delete method
	function deleteTextFile(frmDel, fieldName, hiddenName, saveKey, type) {
	    var textField = fieldName;
		var hiddenField = hiddenName; 				// attch file hidden Field inner

		// file YN
		if(hiddenField.value == "") {
	        alert("Not attachment file");
	        return;
	    }

		var result = confirm("Delete attachment file");

	    if(!result) {
	        return;
	    }

	    // delete file info
		frmDel.pDelName.value = hiddenField.value;
		frmDel.pSaveKey.value = saveKey;

		frmDel.submit();

		if(type == 1) {
			textField.value = "------------- TXT File -------------";
			hiddenField.value = "";

		} else if(type == 2) {
			textField.value = "------------- HTML File -------------";
			hiddenField.value = "";

		} else if(type == 3) {

			textField.value = "------------- ZIP File -------------";
			hiddenField.value = "";

		} else if(type == 4) {
			textField.value = "----- jpeg,jpg,gif File -----";
			hiddenField.value = "";

		} else if(type == 5) {
			textField.value = "---------- JPG, GIF File ----------";
			hiddenField.value = "";

		} else if(type == 6) {
			textField.value = "------------ Attachment file -------------";
			hiddenField.value = "";
		}

		return;
	}

	function sendMail(count, frm){
		if(count == 0) {
			return;
		}

		if(count == 1) {
			if(!frm.pCheck.checked) {
				alert("Select Send e-mail");
				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("Select Send e-mail");
				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("Select Send e-mail");
				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("Select Send e-mail");
				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("Select Send Memo");
				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("Select Send Memo");
				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;
	}

