var intValue = '0123456789.';
var upperValue = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var lowerValue = 'abcdefghijklmnopqrstuvwxyz';
var etcValue = '~`!@#$%%^&*()-_=+\|[{]};:\'\",<.>/';
var etcEmailValue = ' ~`!#$%%^&*()-_=+\|[{]};:\'\",<>/?';
var dateType = 1;	// 1: yyyymmdd, 2: ddmmyyyy

var len_4 = 4;
var len_10 = 10;
var len_13 = 13;
var len_15 = 15;
var len_20 = 20;
var len_30 = 30;
var len_40 = 40;
var len_50 = 50;
var len_100 = 100;
var len_200 = 200;
var len_400 = 400;
var len_500 = 500;
var len_2000 = 2000;
var len_1500 = 1500;
var len_1000 = 1000;
var len_4000 = 4000;

function checkLen(obj, len) {
	var str = obj.value;

	if (bytes(str) > len) {
		alert(JS_MSG_COMMON_100);
		obj.value = cut(str, len);
		obj.focus();
	}  
}

function bytes(str) {
	var l = 0;
	
	for(var i = 0; i < str.length; i++) {
		l += (str.charCodeAt(i) > 128) ? 2 : 1;
	}

	return l;
}

function cut(str, len) {
	var l = 0;

	for(var i = 0; i < str.length; i++) {
		l += (str.charCodeAt(i) > 128) ? 2 : 1;

		if (l > len) {
			return str.substring(0, i);
		}
	}

	return str;
}

// ?? ?????? ???? ?????????? ????
function isUpper(value) {
	var i;

	for(i = 0; i < upperValue.length; i++) {
		if(value == upperValue.charAt(i)) {
			return true;
		}
	}

	return false;
}

// ?? ?????? ???? ?????????? ????
function isLower(value) {
	var i;

	for(i = 0; i < lowerValue.length; i++) {
		if(value == lowerValue.charAt(i)) {
			return true;
		}
	}

	return false;
}

// ?? ?????? ???????? ????
function isInt(value) {
	var j;

	for(j = 0; j < intValue.length; j++) {
		if(value == intValue.charAt(j)) {
			return true;
		}
	}

	return false;
}

// 툭수문자 처리
function isEtc(value) {
	var j;
	
	for(j = 0; j < etcValue.length; j++) {

		if(value == etcValue.charAt(j)) {
			return true;
		}
	}

	return false;
}

// ???????? ???? ?????????? ???????? ????
function getBytes(str) {
	var i, ch, bytes;
	var app, isNe = 0;

	if(str == '') {
		return 0;
	}

	app = navigator.appName;

	if(app == 'Netscape') {
		isNe = 1;
	}

	for(i = 0, bytes = 0; i < str.length; i++) {
		ch = str.charAt(i);

		if(isInt(ch)) {
			bytes++;
		} else if(isLower(ch)) {
			bytes++;
		} else if(isUpper(ch)) {
			bytes++;
		} else if(isEtc(ch)) {
			bytes++;
		} else {
			bytes += 2;

			if(isNe) {
				i++;
			}
		}
	}

	return bytes;
}

// ?????? ?????? ???? ???? ???? ????
function ltrim(para) {
	while(para.substring(0, 1) == ' ') {
		para = para.substring(1, para.length);
	}

	return para;
}

// ?????? ?????? ???? ???? ???? ????
function rtrim(para) {
	while(para.substring(para.length-1, 1) == ' ') {
		para = para.substring(0, para.length-1);
	}

	return para;
}

// ?????? ???????? ???? ???? ???? ????
function trim(para) {
	return rtrim(ltrim(para));
}

function checkBytes(obj, len){
	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 > len) {
				BOOLEAN = true;
				break;
			}
		}
	}

	return BOOLEAN;
}

function isFloat(value) {
	var count = 0;
	var ch;

	for(i = 0; i < value.length; i++) {
		ch = value.charAt(i);

		if(isNaN(ch)) {
			if(ch == ".") {
				count++;
			} else {
				return false;
			}
		}
	}

	if(count > 1) {
		return false;
	} else {
		return true;
	}

	return result;
}

// ???????? ???????? ??????
function isNumber(value) {
	var result = true;

	for(j = 0; result && (j < value.length); j++) {

		if((value.substring(j, j+1) < "0") || (value.substring(j, j+1) > "9")) {
			result = false;
		}
	}

	return result;
}

function monthArray(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11) {
	this[0] = m0; this[1] = m1; this[2] = m2; this[3] = m3;
	this[4] = m4; this[5] = m5; this[6] = m6; this[7] = m7;
	this[8] = m8; this[9] = m9; this[10] = m10; this[11] = m11;
}

function isDay(yyyy, mm, value) {
	var result = false;
	var monthDay = new monthArray(31,28,31,30,31,30,31,31,30,31,30,31);

	var im = eval(mm) - 1;

	if (value.length != 2) {
		return false;
	}

	if (!isNumber(value)) {
		return false;
	}

	if (((yyyy % 4 == 0) && (yyyy % 100 != 0)) || (yyyy % 400 == 0)) {
		monthDay[1] = 29;
	}

	var dd = eval(value);

	if ((0 < dd) && (dd <= monthDay[im])) {
		result = true;
	}

	return result;
}

function isMonth(value) {
	return((value.length > 0) && (isNumber(value)) && (0 < eval(value)) && (eval(value) < 13));
}

function isYear(value) {
	return((value.length == 4) && (isNumber(value)) && (value != "0000"));
}

function isDate(value) {
	var year, month, year;

	if(dateType == 1) {
		//Korea Version 2004.1.16
		year  = value.substring(0, 4);
		month = value.substring(4, 6);
		day   = value.substring(6, 8);

	} else if(dateType == 2) {
		//Malay Version 2004.1.16
		day   = value.substring(0, 2);
		month = value.substring(2, 4);
		year  = value.substring(4, 8);
	}

	return(isYear(year) && isMonth(month) && isDay(year, month, day));
}

function isHour(value) {
	if(!isNumber(value)) {
		return false;
	}

	if(value > 23 || value < 0) {
		return false;
	}

	if(getBytes(value) != 2) {
		return false;
	}

	return true;
}

function isMinute(value) {
	if(!isNumber(value)) {
		return false;
	}

	if(value > 59 || value < 0) {
		return false;
	}

	if(getBytes(value) != 2) {
		return false;
	}

	return true;
}

function isSecond(value) {
	if(!isNumber(value)) {
		return false;
	}

	if(value > 59 || value < 0) {
		return false;
	}

	if(getBytes(value) != 2) {
		return false;
	}

	return true;
}

function checkDateFormat(strDate) {
	if(dateType == 1) {
		return strDate;
	} else if(dateType == 2) {
		return strDate.substring(4, 8) + strDate.substring(2, 4) + strDate.substring(0, 2);	    
	}
}

function checkFromToDate(sDate, eDate) {

	var SDATE = checkDateFormat(sDate.value);
	var EDATE = checkDateFormat(eDate.value);

	if(SDATE <= EDATE) {
		return false;
	} else {
		return true;
	}
}

function checkNumber() {
	var key = String.fromCharCode(event.keyCode);
	var re = new RegExp('[0-9]');

	if(!re.test(key)) {
		event.returnValue = false;
	}
}

function checkCode(filter) {

	if(filter){
		var key = String.fromCharCode(event.keyCode);
		var re = new RegExp(filter);

		if(!re.test(key)) {
			event.returnValue = false;
		}
	}
}

function checkFilter(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;
	}
}

// ?????? "-" ?????????????? Check (????????, ????????????) (??????)
function isDigitOrBar( str ) {
	for(var i=0; i < str.length; i++) {
		var ch= str.charAt(i);
		if((ch < "0" || ch > "9") && ch!="-") {
			return false;
		}
	}
	return true;
}

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 sendSms(count, frm){
	if(count == 0) {
		return;
	}

	if(count == 1) {
		if(!frm.pCheck.checked) {
			alert("SMS ???? ?????? ????????????.");
			//alert("Please select 'Target Group' to send Short Message.");
			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("SMS ???? ?????? ????????????.");
			//alert("Please select 'Target Group' to send Short Message.");
			return;
		}
	}

	var memoSendWindow;

	memoSendWindow = window.open("","Msms","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=660,height=490");
	memoSendWindow.opener = self;
	memoSendWindow.focus();

	frm.target = "Msms";
	frm.action = '/common/back//sms/smsSendForm.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 sendMemo(count, frm){
	if(count == 0) {
		return;
	}

	if(count == 1) {
		if(!frm.pCheck.checked) {
			alert(JS_MSG_MEMBER_122);
			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(JS_MSG_MEMBER_122);
			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 = window.open("","Mmemo","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=390,height=430");
	memoSendWindow.opener = self;
	memoSendWindow.focus();

	frm.target = "Mmemo";
	frm.action = '/common/back//memo/comMemoSendFrm.jsp';
	frm.submit();
	return;
}

function sendMail(count, frm){
	if(count == 0) {
		return;
	}

	if(count == 1) {
		if(!frm.pCheck.checked) {
			alert(JS_MSG_MEMBER_104);
			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(JS_MSG_MEMBER_104);
			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=600");
	mailSendWindow.opener = self;
	mailSendWindow.focus();

	frm.target = "Mmail";
	frm.action = '/common/back/mail/comMailSendFrm2nd.jsp';
	frm.submit();
	return;
}

function sendMail2nd(count, frm){
	if(count == 0) {
		return;
	}

	if(count == 1) {
		if(!frm.pCheck.checked) {
			alert(JS_MSG_MEMBER_104);
			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(JS_MSG_MEMBER_104);
			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=600");
	mailSendWindow.opener = self;
	mailSendWindow.focus();

	frm.target = "Mmail";
	frm.action = '/common/back//mail/comMailSendFrm.jsp';
	frm.submit();
	return;
}

function sendMailOne(frm){

	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=600");
	mailSendWindow.opener = self;
	mailSendWindow.focus();

	frm.target = "Mmail";
	frm.action = '/common/back//mail/comMailSendFrm.jsp';
	frm.submit();
	return;
}

function fn_order_asc(orderKey, orderValue, frm, url) {
	frm.pOrderKey.value = orderKey;
	frm.pOrderValue.value = orderValue;
	frm.pOrderMethod.value = "ASC";

	frm.action = url;
	frm.submit();
}

function fn_order_desc(orderKey, orderValue, frm, url) {
	frm.pOrderKey.value = orderKey;
	frm.pOrderValue.value = orderValue;
	frm.pOrderMethod.value = "DESC";

	frm.target = "_self";
	frm.action = url;
	frm.submit();
}

function fn_send_mail(count, frm) {
	if(count == 0) {
		return;
	}

	if(count == 1) {
		if(!frm.pCheck.checked) {
			alert(JS_MSG_MEMBER_104);
			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(JS_MSG_MEMBER_104);
			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=600");
	mailSendWindow.opener = self;
	mailSendWindow.focus();

	frm.target = "Mmail";
	frm.action = '/common/back//mail/comMailSendCompanyFrm.jsp';
	frm.submit();
	return;
}

//???????????? ???? ????(INPUT: object)
function addComma(theObj)
{
    var data = theObj.value;
	var len  = data.length;
	if(len>3) {
	  var rest = len%3;
	  var commaCnt = (len - rest)/3;
	  if(rest == 0) {
         temp = data.substr(0,3);
		 commaCnt -- ;
		 rest = 3 ;
	  } else {
        temp = data.substr(0,rest);
	  }

      for(i=0;i<commaCnt;i++) {
        temp = temp + "," + data.substr(rest,3);
		rest+=3;
	  }
	  theObj.value = temp;
	}
}

//?????????? ???? ????????(INPUT: object)
function delComma(theObj) {
    var data = theObj.value;
    //alert("***"+data);
    var len  = data.length;
    var temp = "";
	for ( i=0;i<len;i++) {
      if( data.substr(i,1) != ",") {
          temp = temp + data.substr(i,1);
	   }
	}
	theObj.value = temp;
}

var isSelected = 0;

function fn_select_check_box(num, checkValue) {
	if(num == 0) {
		return;
	}

	var value;

	if(isSelected == false) {
		value = true;
		isSelected = 1;
	} else {
		value = false;
		isSelected = 0;
	}

	if(num == 1) {
		if(!checkValue.disabled) {
			checkValue.checked = value;
		}
	}

	if(num > 1) {
		for(i = 0; i < checkValue.length; i++ ) {
			if(!checkValue[i].disabled) {
				checkValue[i].checked = value;
			}
		}
	}

	return;
}


function createObject(obj) {
	var str1 = obj
	document.writeln(str1);
}

/* ===================================================================
	Function : moneyFormTwo(obj)
	Return 	 :
	Usage 	 : form을 넘겨받아 소수점 처리 후 Setting한다.
=================================================================== */
function moneyFormTwo(obj){
  var nums = obj.value;
  var indexInt = nums.indexOf('.');
	var nLength = nums.length;
	var num  = "";
	var jjum = "";
	if(indexInt <= 0) {
		 num  = nums;
		 jjum = "";
	}else {
		num  = nums.substring(0, indexInt);
		jjum = nums.substring(indexInt, nLength);
	}
	if(num.length >= 4){
		// "$" and "," 입력 제거
		re = /^\$|,/g;
		num = num.replace(re, "");

		fl = "";
		if(isNaN(num)){
			alert("문자는 사용할 수 없습니다.");
			obj.value = "";
			return 0;
		}
		if(num==0) return num;

		if(num<0){
			num = num * (-1);
			fl = "-";
		}else{
			num = num * 1; //처음 입력값이 0부터 시작할때 이것을 제거한다.
		}

		num = new String(num);
		temp = "";
		co = 3;
		num_len = num.length;
		while(num_len>0){
			num_len = num_len-co;
			if(num_len < 0){
				co = num_len + co;
				num_len = 0;
			}
			temp = "," + num.substr(num_len, co) + temp;
		}
		if(indexInt <= 0) {
			obj.value =  fl+temp.substr(1)+jjum;
		}else{
			if(indexInt > 4) {
				obj.value =  fl+temp.substr(1)
				obj.focus();
				obj.value = obj.value+jjum
			}else{
				obj.value =  fl+temp.substr(1)+jjum;
			}
		}
 	}
}
/* ===================================================================
	Function : onlyNumberInput()
	Return 	 :
	Usage 	 : 숫자만 입력 가능 (onKeyDown 이벤트)
=================================================================== */
function onlyNumberInput() {
	var code = window.event.keyCode;
	if ((code > 32 && code < 48) || (code > 57 && code < 65) || (code > 90 && code < 97) || (code > 34 && code < 41) || (code > 47 && code < 58) || (code > 95 && code < 106) || code == 8 || code == 9 || code == 13 || code == 46){
		window.event.returnValue = true;
		return;
	}
	window.event.returnValue = false;
}

/* ===================================================================
	Function : onlyNumberInput2()
	Return 	 :
	Usage 	 : 0-9, 소수점, 백스페이스, delete키 만 입력 가능 
=================================================================== */
function onlyNumberInput2(aaa) {

	var code = window.event.keyCode;
	
	if ((code >= 48 && code <= 57) || code == 190 || code == 8 || code == 46) {
		window.event.returnValue = true;
		return;
	}

	window.event.returnValue = false;
	
}
/* ===================================================================
	Function : commaCut(money)
	Return 	 :
	Usage 	 : 입력된 문자열의 ','를 없앤 문자열을 리턴한다.
=================================================================== */
function commaCut(money){
	if(money == '') return '';
	return money.split(",").join("");
}

/* ============================================================================
	Function : getToday('')
	Return   : 오늘날짜
	Usage    : 현재 날짜(20030101 or 2003/01/01)를 리턴
	사용법   : getToday('')  ==> 20030101
			   getToday('/') ==> 2003/01/01
============================================================================ */
function getToday(gubun) 
{
	today = new Date();

	var year  = today.getFullYear();
	var month = today.getMonth()+1;
	var day   = today.getDate();

	if(month < 10)
		month = "0" + month;
	if(day < 10)
		day = "0" + day;

	return year+gubun+month+gubun+day;
}

/* ============================================================================
	Function : fOpenBanks('')
	Return   : 은행코드 
	Usage    : 은행코드.명 
	사용법   : 은행코드 팝업 호출 
============================================================================ */
function fOpenBanks(){
	window.open("/lms/back/common/popup/comBankPopupList.jsp","banks","height=400,width=450,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

/* ============================================================================
	Function : fOpenBanks('')
	Return   : 강사찾기 팝업  
	Usage    : 강사찾기 팝업  
	사용법   : 강사찾기 팝업  
============================================================================ */
function fOpenLecturer(){
	window.open("/lms/back/common/popup/comLecturerPopupList.jsp","banks","height=540,width=650,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

function fOpenLecturer1(gubun){
	window.open("/lms/back/common/popup/comLecturerPopupList.jsp?gubun=" + gubun,"banks","height=540,width=650,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

function fOpenLecturer2(gubun1, gubun2){
	window.open("/lms/back/common/popup/comLecturerPopupList.jsp?gubun1=" + gubun1 + "&gubun2=" + gubun2,"banks","height=540,width=650,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

/* ============================================================================
	Function : fOpenLecturer('')
	Return   : 직급코드 찾기  팝업  
	Usage    : 직급코드 팝업  
	사용법   : 직급코드 팝업  
============================================================================ */
function fOpenCodeManagerChk(){
	window.open("/lms/back/common/popup/comCodeManagerPopupList.jsp","Code","height=250,width=450,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

/*
 *	숫자만 입력하는 함수 - style='ime-mode:disabled' onkeypress="chkNumber(this)"
 */
function chkNumber(obj) { 
	if((event.keyCode<48) || (event.keyCode>57)) { 
		event.returnValue=false; 
	}
}

/*
 *	입력 disabled,readOnly 색깔 표시
 */
function fDisabledInit(obj){

	if(obj){
		for(var i=0;i<obj.elements.length;i++){
			if(obj.elements[i].disabled){
				obj.elements[i].style.backgroundColor = "#F0F5FB";
			}
			if(obj.elements[i].readOnly){
				obj.elements[i].style.backgroundColor = "#F0F5FB";
			}
		}
	}
	
}

/**
 *	숫자입력체크
 */
function jsOnlyNumberKey() {
	if ( event != null) {
		if ( event.keyCode < 48 || event.keyCode > 57 ) {
			event.returnValue = false;
		}
	}
}

function delComma(fValue) {
	var tmp = fValue.split(",")
	var rtnTmp="";
	for(i=0;i<tmp.length;i++) {
		rtnTmp+=tmp[i];
	}
	return rtnTmp;
}
	
function addComma(aString)		{				
	var reverseMaskedNumber = "", maskedNumber = "";
	var integerCount = 0, maskCount = 0, isPoint = 0;	
	var integerIndex ;												
	var tmpValue, i;

	//	aString = Number(aString);							

	integerIndex = aString.length;							

	for (i = aString.length - 1 ; i >= 0 ; i--)	{
		reverseMaskedNumber += aString.charAt(i);			
		if (aString.charAt(i) == ".")			{
			integerIndex = i - 1
			isPoint = 1;			
			break;
		}
	}

	if (isPoint == 0)	{
		reverseMaskedNumber = "";
		integerIndex -= 1;			
	}

	for ( i = integerIndex ; i >= 0 ; i--)		{
		integerCount++;							
		reverseMaskedNumber += aString.charAt(i);
		if (integerCount % 3 == 0 && i != 0 && aString.charAt(i-1) != "-")		{
			reverseMaskedNumber += ",";						
			maskCount++;											
		}
	}

	for ( i = maskCount + aString.length ; i >= 0 ; i--)			{
		maskedNumber += reverseMaskedNumber.charAt(i);	
	}

	return maskedNumber;											
}

// 숫자와 소수점만 입력 가능
/* ===================================================================
	Function : onlyNumDecimalInput(obj, number, maxDecimal)
	Return 	 :
	Usage 	 : 숫자만 입력 가능 (onKeyDown 이벤트)
=================================================================== */
	function onlyNumDecimalInput(){
		var code = window.event.keyCode;

 		if ((code >= 48 && code <= 57) || (code >= 96 && code <= 105) || code == 110 || code == 190 || code == 8 || code == 9 || code == 13 || code == 46){
			window.event.returnValue = true;
	 		return;
 		}
 		window.event.returnValue = false;
	}
//	특수문자 검토
	function com_checkChar(inputStr){
		var isTheChar = false;

		var temp = inputStr;

		for (var i =0; i < temp.length; i ++) {
			if(isEtc(temp.charAt(i))) {
				isTheChar = true;
				break;
			}
		}
		return isTheChar;
	}

//	특수문자 검토(email)
function com_checkEmailChar(inputStr){
	var isTheChar = false;
	
	var temp = inputStr.replace('@', '');

	//	etcEmailValue


	for (var i =0; i < temp.length; i ++) {
		for(var j=0; j<etcEmailValue.length; j++){
			if(temp.charAt(i) == etcEmailValue.charAt(j)){
				isTheChar = true;
				alert(JS_MSG_ERROR_205);
				break;
			}
		}
	}
	return isTheChar;
}

//aNodes : Email Field(TEXT), 단.복수 가능(두개의 필드 배열이라면 둘의 내용을 @로 합쳐서 검사한다.
//bFlag : 메일주소가 틀렸을 경우에 경고문을 띄울지의 여부.
function checkEmail(aNodes, bFlag)
{
	if(aNodes.length == undefined) {
		aNodes = new Array(aNodes);
	}

	var email = "";
	var flag = true;

	for(var i = 0; i < aNodes.length; i++) {
		email += aNodes[i].value;
	}

	if(email == "") {
		return flag;
	}
	if (email.indexOf("gmail.com") > 1)
		email = "gmail"+email.substring(email.indexOf("@"));


	var atsym = email.indexOf("@");
	var period = email.indexOf(".");
	var space = email.indexOf(" ");
	var length = email.length -1;

    if((atsym < 1)||(period <=atsym+1)|| (period==length)|| (space != -1)) {
		flag = false;
	}

	if(!flag) {
		if(bFlag) {
			alert("Email형식이 틀렸습니다.");
			alertElement(aNodes[0]);
		}
	}

	return flag;
}

function checkResident(oNode1, oNode2, bFlag)
{
	var resident1 = oNode1.value;
	var resident2 = oNode2.value;
	
	if(resident2.substring(0,1) == "5" || resident2.substring(0,1) == "6" || resident2.substring(0,1) == "7" || resident2.substring(0,1) == "8") {
		check_fgnno(resident1+""+resident2);
	} else { 

		var chk =0;
	
		for (var i = 0; i <=5 ; i++) {
			chk = chk + ((i % 8 + 2) * parseInt(resident1.substring(i, i + 1)));
		}
	
		for (var i = 6; i <= 11 ; i++) {
			chk = chk + ((i % 8 + 2) * parseInt(resident2.substring(i-6, i-5)));
		}
	
		chk = 11 - (chk % 11);
		chk = chk % 10;
	
		if (chk != resident2.substring(6, 7)) {
			if(bFlag) {
				alert("주민번호가 올바르지 않습니다.");
			}
	
			return false;
		} else {
			return true;
		}
	}
}

//	전화번호 검토
	function com_checkTel(telStr){
		temp = trim(telStr);

		while(temp.indexOf('-') != -1){
			temp = temp.replace('-', ''); 
		}

		if(com_checkChar(temp)){
			alert("전화번호 형태가 잘못되었습니다.");
			return true;
		}

		if(isNaN(temp)){
			alert("숫자로 입력해주세요.");
			return true;
		}

		if(telStr == ""){
			alert("전화번호를 입력하여 주십시오.");
			return true;
		}
		
		if(telStr.length < 10){
			alert("전화번호 형태가 잘못되었습니다.");
			return true;
		}

		return false;
	}
//	Email 검토
	
	function com_checkEmail(emailStr){
		emailStr = trim(emailStr);

		if(com_checkEmailChar(emailStr)){
			return true;
		}
		if(emailStr.indexOf('@') <= -1){
			alert("이메일 입력이 잘못되었습니다.\n검토하여 주십시오.");
			return true;
		}

		if(emailStr == ""){
			alert("이메일을 입력하여 주십시오.");
			return true;
		}
		return false;
	}

	function com_emailCheck(oNode){
		var email = oNode.value;

		if(email.length > 0) {
			var regExp = /[a-z0-9]{2,}@[a-z0-9-]{2,}\.[a-z0-9]{2,}/i;
			if(!regExp.test(email)) {	//잘못된 이메일주소
				alert("이메일 입력이 잘못되었습니다.\n검토하여 주십시오.");
				return false;
			}else{	//정상적인 이메일주소
				return true;
			}
		}
	}

	function com_checkTitle(strTitle){
		var temp = trim(strTitle);
		if(com_checkChar(temp)){
			alert(JS_MSG_ERROR_207);
			return true;
		}
		if(temp == ""){
			alert(JS_MSG_ERROR_206);
			return true;
		}

		if(!isNaN(temp)){
			alert(JS_MSG_ERROR_208);
			return true;
		}
		return false;
	}

	function com_checkName(strName){
		var temp = trim(strName);

		if(com_checkChar(temp)){
			alert(JS_MSG_ERROR_211);
			return true;
		}

		if(temp == ""){
			alert(JS_MSG_ERROR_209);
			return true;
		}
		if(!isNaN(temp)){
			alert(JS_MSG_ERROR_210);
			return true;
		}
	}

	//	printWindow 호출
	function printWindow(){
		window.open('/common/menu/windowPrint.jsp', 'null', "scrollbars=yes, status=no, toolbar=no, resizable=1, location=no,menu=no, width=726, height=621, style=overflow-y:hidden, left=200");
	}


//Form List
function getFormList(bFrm)
{
	if(document.g_form_list == undefined || bFrm == true) {
		var frm = document.createElement("form");
		
		frm.method = "post";
		try{
			document.body.appendChild(frm);
			//document.appendChild(frm);
		}catch(e){
			alert(e);
		}

		return frm;
	} else {
		return document.g_form_list;
	}
}

function getCData(oForm)
{
	if(oForm == "") {
		return "";
	}

	var aElements = oForm.elements;
	var cData = new CData();

	for(var i = 0; i < aElements.length; i++) {
		cData.add(aElements[i].name, aElements[i].value);
	}

	return cData;
}

function getURL(strAction, aData, strTarget, bFrm) {
try{
	if(strAction == null) {
		strAction = "";
	}

	var frm = getFormList(bFrm);

	if(strAction.indexOf("?") > -1) {
		
		var aGet = strAction.split("?");
		strAction = aGet[0];
		aGet = aGet[1].split("&");
		aData = new Array();

		for(var i = 0; i < aGet.length; i++) {
			aData.push(aGet[i].split("="));
		}
	}

	if(aData != null && aData.length > 0) {
		if(typeof(aData[0]) != "object") {
			aData = new Array(aData);
		}
		for(var i = 0; i < aData.length; i++) {
			var strName = aData[i][0];
			var strValue = aData[i][1];
			var oNode = null;
			for(var j = 0; j < frm.elements.length; j++) {
				if(frm.elements[j].name == strName) {
					oNode = frm.elements[j];
				}
			}
			if(oNode != null) {
				oNode.value = strValue;
			} else {
				var oHidden = document.createElement("INPUT");
				oHidden.type = "hidden";
				oHidden.name = strName;
				oHidden.value = strValue;

				frm.appendChild(oHidden);
			}
		}
	}

	if(strTarget == null) {
		strTarget = "_self";
	} else {
		var oTarget = document.getElementsByName(strTarget);

		if(oTarget.length == 0) {
			var inObj = document.createElement("IFRAME");
			inObj.setAttribute("NAME", strTarget);
			inObj.style.display = "none";
			document.body.appendChild(inObj);
			//document.body.insertAdjacentElement("beforeEnd", inObj);
			//document.body.insertAdjacentHTML("beforeEnd", "<iframe style='display:none' name='" + strTarget + "'></iframe>");
		}
	}

	if(strAction != "") {
		frm.target = strTarget;
		frm.action = strAction;
		frm.submit();
	}
}catch(e){
	alert(e);
}
}

function getMsg(strMsg, strAction) {
	var strResult = "";
	if(strMsg == "commit") {
		if(strAction == "DELETE") {
			strResult = "삭제하였습니다.";
		} else {
			strResult = "데이터를 처리하였습니다.";
		}
	} else if(strMsg == "rollback") {
		strResult = "데이터 값을 확인하여 주십시오.";
	} else if(strMsg == "error_auth") {
		strResult = "인증에 실패하였습니다.";
	} else {
		strResult = "오류발생.";
	}

	return strResult;
}

function addReplyTitle(strTitle)
{
	return "[Re] " + strTitle;
}

function addReplyConts(strConts)
{
	var strPre = "\n\n---------------------[Source]---------------------\n";

	return strPre + strConts;
}

var gURL = null;

function download(strFileNM, strSavedFileNM, strPath, bMenuCD) {
	if(bMenuCD == null) {
		bMenuCD = "";
	}

	if(gURL == null) {
		gURL = document.URL;
		
		if(gURL.indexOf("localhost") != -1) {
			gURL = "";
		}else if(gURL.indexOf(":8000") > -1) {
			gURL = "";			
		} else {
			gURL = "http://www.mcst.go.kr";
		}
	}

	location.href = gURL + "/servlets/eduport/front/upload/UplDownloadFile?pFileName=" + encodeURIComponent(strFileNM) + "&pRealName=" + strSavedFileNM + "&pPath=" + strPath + "&pFlag=" + bMenuCD;
}

function openZip() {
	window.open("/web/mctMember/registMember/joinSearchAddr.jsp", "", "width=350px, height=292px");
}

function openZipAction(pAction , pFormNm , pZipNm1 , pZipNm2 , pAddrNm1 , pAddrNm2) {
	
	if(pAction == "1") {
		window.open("/web/mctMember/registMember/joinSearchAddrAction.jsp?pFormNm="+pFormNm+"&pZipNm1="+pZipNm1+"&pZipNm2="+pZipNm2+"&pAddrNm1="+pAddrNm1+"&pAddrNm2="+pAddrNm2, "", "width=350px, height=288px");
	}
	// 필요에 따라 추가 하십시요
}

//nType : 1 - 로그인, 2 - 실명확인, 3 - 로그인 | 실명확인, 4 - 공공I-PIN | 실명인증
function checkLogin(oNode, nType, flag, strAction) {
	var strMsg = null;

	if(flag == null) {
		flag = true;
	}

	if((nType == 3 && flag) || (nType == 4 && flag) ) {
		strMsg = "로그인이나 실명인증이 필요합니다.";
	}

	if(oNode.value == "") {
		if(strMsg != null && strMsg != "") {
			alert(strMsg);
		}
		if (strAction != null && strAction != "" ) {

			openLogin(nType, strAction);
			
		}
		else
			openLogin(nType);

		return false;
	} else {
		return true;
	}
}

function openLogin(nType, strAction) {

	var strURL = null;
	var nWidth = 0;
	var nHeight = 0;

	if(strAction == null) {
		strAction = "login";
	}

	if(nType == 1) {	
		strURL = "/web/mctMember/login/loginPop.jsp?pAction=" + strAction;
		nWidth = 384;
		nHeight = 268;
	} else if(nType == 2) {
		strURL = "/web/mctMember/login/authPop.jsp?pAction=" + strAction;
		nWidth = 384;
		nHeight = 390;
	} else if(nType == 3) {
		strURL = "/web/mctMember/login/authIdentity.jsp?pAction=" + strAction;
		nWidth = 735;
		nHeight = 451;
	} else if(nType == 4) {
		strURL = "/web/mctMember/login/authPop2.jsp?pAction=" + strAction;
		nWidth = 384;
		nHeight = 496;
	} else if(nType == 33) {
		strURL = "/web/mctMember/login/authIdentity_t.jsp?pAction=" + strAction;
		nWidth = 735;
		nHeight = 451;
	}

	window.open(strURL, "wLogin", "width=" + nWidth + ", height=" + nHeight);
}

function logout() {
	getURL("/web/mctMember/login/loginAction.jsp", new Array("pAction", "LOGOUT"));
}

function setUser(oUserObject) {
	oUser = oUserObject;

	if(oUserObject.strAction == "scrap") {
		openScrap();
	}
}

function setDefaultUser(oUserObject) {
	oUser = makeUserObject(oUserObject);
}

function openScrap() {
	if(oUser.isLogined) {
		var oForm = document.g_scrap_frm;
		var strFrameName = "hiddenScrap";
		var oFrame;

		if(document.all) {
			oFrame = document.createElement("<iframe name='" + strFrameName + "'></iframe>");
		} else {
			oFrame = document.createElement("iframe");
			oFrame.setAttribute("name", strFrameName);
		}

		oFrame.style.display = "none";
		document.body.appendChild(oFrame);

		oForm.target = strFrameName;
		oForm.action = "/web/mctMember/myPage/memberScrapAction.jsp";
		oForm.submit();
	} else {
		openLogin(1, "scrap");
	}
}

function resultScrap(strAction, strResult) {
	if(strAction == "INSERT") {
		if(strResult == "commit") {
			if(confirm("스크랩에 등록되었습니다.\n지금 확인하시겠습니까?")) {
				location.href = "/web/mctMember/myPage/memberScrap.jsp";
			}
		} else {
			alert(getMsg(strResult));
		}
	} else {
		setResult(strResult);
	}
}

function makeUserObject(oUserObject) {
	var oObject = new Object();

	oObject.isLogined = false;
	oObject.loginUserId = "";
	oObject.loginUserName = "";
	oObject.loginTel = "";
	oObject.loginEmail = "";
	oObject.loginIPAddress = "";

	if(oUserObject != null) {
		oObject.isLogined = oUserObject.isLogined;
		oObject.loginUserId = oUserObject.loginUserId;
		oObject.loginUserName = oUserObject.loginUserName;
		oObject.loginTel = oUserObject.loginTel;
		oObject.loginEmail = oUserObject.loginEmail;
		oObject.loginIPAddress = oUserObject.loginIPAddress;
	}

	return oObject;
}

function openPasswd() {
	window.open("/web/mctMember/login/authPasswd.jsp", "wPasswd", "width=300, height=150");
}

//이미지가 에러시 발생되는 콜백함수
function imgError(oImg, imgName) {
	var imgPath = "/html/images/etc/";

	if(imgName == null) {
		imgName = "img_error.gif";
	}

	oImg.src = imgPath + imgName;
}


//이미지가 에러시 발생되는 콜백함수
function mainImgError(oImg, imgName) {
	var imgPath = "/html/images/nmain/";

	if(imgName == null) {
		imgName = "mv.gif";
	}

	oImg.src = imgPath + imgName;
}

function checkTogle(oNode) {
	oNode.checked = !oNode.checked;
}

function resizewindow(d,v) {
	d = window.document;

	if(v == null) {
		d.body.style.zoom = 0;
		return;
	}

	if(d.body.style.zoom == 0 ){
		d.body.style.zoom = v;
	} else{ 
		d.body.style.zoom *= v;
	}
}

//=======================================================================================================
/// GetCookie
//=======================================================================================================

function getCookie(name)
{
	var nameOfCookie = name + "=";
	var x = 0;

	while (x <= document.cookie.length)
	{
		var y = (x + nameOfCookie.length);

		if (document.cookie.substring(x, y) == nameOfCookie) 
		{
			if((endOfCookie = document.cookie.indexOf(";", y)) == -1)
				endOfCookie = document.cookie.length;
				
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}

		x = document.cookie.indexOf(" ", x) + 1;

		if(x == 0)
			break;
	}

	return "";
}

//=======================================================================================================
/// SetCookie
//=======================================================================================================

function setCookie(name, value, expiredays)
{
	var todayDate = new Date();
	
	todayDate.setTime(todayDate.getTime() + (1000*30*24*60*60));

	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function checkTel(oNode) {
	var strData = oNode.value;
	var bFlag = com_checkTel(strData);

	if(bFlag) {
		alertElement(oNode);
		oNode.select();
	}

	return !bFlag;
}

function alertElement(oNodes, bDel) {
	if(oNodes.length == null) {
		oNodes = new Array(oNodes);
	}

	for(var i = oNodes.length - 1; i >= 0; i--) {
		oNode = oNodes[i];

		if(oNode.type == 'text' || oNode.type == 'password' || oNode.tagName == 'TEXTAREA') {
			if(bDel) {
				oNode.value = "";
			}

			oNode.focus();
			oNode.style.backgroundColor = "#F0F0F8";
		}
	}
}

function hideStatus(oNode) {
	window.status = "";

	if(oNode != null) {
		oNode.blur();
	}

	return true;
}

//=======================================================================================================
/// 특정 개수의 값이 들어오면 포커스 넘겨주기
//=======================================================================================================

function sendFocus(source, target, number) {
	if(source.value.length >= number) {
		target.focus();
	}
}

//************************************************************************************************//
// Search
//************************************************************************************************//

//Year
var nLimitYear = 10;



//======================
function swf_include(url, wN, hN, vars, id) {

	var codeStr =
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+wN+"' height='"+hN+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='sameDomain' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='loop' value='false' />"+
	"<param name='menu' value='false' />"+
	"<param name='wmode' value='transparent' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='#FFFFFF' />"+
	"<embed src='"+url+"' FlashVars='"+vars+"' quality='high' bgcolor='#EEF8FF' width='"+wN+"' height='"+hN+"' name='"+id+"' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";
	document.write(codeStr);
}


//플래시출력
function getFlash(id,url,w,h,t,bg){
	if(!t) var t='transparent'; if(!bg) var bg='none';
	var flashOut='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width='+w+' height='+h+' id='+id+'>';
	flashOut+='<param name="movie" value='+url+' /><param name="wmode" value='+t+' /><param name="bgcolor" value='+bg+' />';
	flashOut+='<param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="menu" value="false" />';
	flashOut+='<embed src='+url+' width='+w+' height='+h+' name='+id+' wmode='+t+' bgcolor='+bg+' swLiveConnect="true" allowScriptAccess="sameDomain" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	flashOut+='</object>';
	document.write(flashOut);
}

//플래시출력(base url)
function getFlashWithBase(id,url,w,h,t,bg){
	if(!t) var t='transparent'; if(!bg) var bg='none';
	var flashOut='<object title="퀵 베너 영역입니다." classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width='+w+' height='+h+' id='+id+'>';
	flashOut+='<param name="movie" value='+url+' /><param name="wmode" value='+t+' /><param name="bgcolor" value='+bg+' /><param name="base" value=".">';
	flashOut+='<param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="menu" value="false" />';
	flashOut+='<embed src='+url+' base="." width='+w+' height='+h+' name='+id+' wmode='+t+' bgcolor='+bg+' swLiveConnect="true" allowScriptAccess="sameDomain" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	flashOut+='</object>';
	document.write(flashOut);
}

function printWindow(){
	window.open('/common/menu/windowPrint.jsp', "null", "scrollbars=yes, status=no, toolbar=no, resizable=1, location=no,menu=no, width=726, height=621, style=overflow-y:hidden, left=200");
}


//메인 배너 롤링
function mainrollingbanner(){
	var obj=document.getElementById('brinside');
	var moveobj=obj.getElementsByTagName('ul')[0];
	var banners=obj.getElementsByTagName('li');
	obj.style.width='730px';
	obj.style.height='35px';
	moveobj.style.marginLeft='0px';
	moveobj.style.display='block';

	this.canimove=true;
	
	var temp,nowm,speed=50,onew=-105;
	var rolling=function(){
		nowm=parseInt(moveobj.style.marginLeft);
		if(onew<nowm){
			setm(nowm+(Math.floor((onew-nowm)/speed)));
			moveobj.action=setTimeout(rolling,10);
		}else if(onew>nowm || onew==nowm){
			setm(0);
			items=moveobj.getElementsByTagName('li');
			temp=items[0].cloneNode(true);
			moveobj.removeChild(items[0]);
			moveobj.appendChild(temp);
			autorolling();
		}
	}
	
	var autorollingtime=8000;
	var autorollingtimer=0;
	var autorollingtimerid;
	var autorolling=function(){
		clearTimeout(autorollingtimerid);
		if(!mainrolling.canimove){
			autorollingtimer=0;
		}else{
			if(autorollingtime>autorollingtimer){
				autorollingtimer+=100;
				autorollingtimerid=setTimeout(autorolling,100);
			}else if(autorollingtime<=autorollingtimer){
				clearTimeout(autorollingtimerid);
				autorollingtimer=0;
				rolling();
			}
		}
	}
	this.restart=function(){
		autorolling();
	}

	var setm=function(newm){
		moveobj.style.marginLeft=newm+'px';
	}

	obj.onmouseover=function(){
		mainrolling.canimove=false;
	}
	obj.onmouseout=function(){
		mainrolling.canimove=true;
		mainrolling.restart();
	}

	var vabtn=document.getElementById('brviewallbtn');
	vabtn.style.display='none';
	vabtn.onclick=function(){mainrolling.viewallbanners();	}

	this.viewallbanners=function(hide){
		if(!hide){
			obj.style.height='';
			vabtn.onclick=function(){mainrolling.viewallbanners(true);}
			mainrolling.canimove=false;
			obj.onmouseout=null;
		}else{
			obj.style.height='35px';
			vabtn.onclick=function(){mainrolling.viewallbanners();}
			mainrolling.canimove=true;
			obj.onmouseout=function(){
				mainrolling.canimove=true;
				mainrolling.restart();
			}
			mainrolling.restart();
		}
	}

	rolling();

}

function goBanner(url, target){
	if(target == "Y"){
		location.href = url;
	}else{
		window.open(url);
	}
}

function goBanner2(url,  strTarget, strWidth, strHeight){
	var popUrl = url;
	var pop_w = strWidth;
	var pop_h = strHeight;
	var popTar = strTarget;

	if(popUrl.indexOf("http://") < 0)
	{
		popUrl = "http://"+popUrl;
	}

	var bannerWin = window.open(popUrl, popTar,"left=20,top=20, toolbar=no, location=no, directories=no, status=no, menubar=no, width="+ pop_w+",height="+pop_h+",scrolling=no, scrollbars=yes,resizable=no");

}

function imgchange(imgobj){
	if(imgobj.src.indexOf('on.gif')==-1){
		imgobj.src=imgobj.src.replace('.gif','on.gif');
		imgobj.onmouseout=function(){if(this.src.indexOf('on.gif')!=-1) this.src=this.src.replace('on.gif','.gif');}
	}
}

//이미지 변환 
function imgchange2(imgid){
	var imgobj=document.getElementById(imgid);	
	if(imgobj.src.indexOf('on.gif')==-1){
		imgobj.src=imgobj.src.replace('.gif','on.gif');
		imgobj.onmouseout=function(){if(this.src.indexOf('on.gif')!=-1) this.src=this.src.replace('on.gif','.gif');}
	}
}

//이미지 변환 
function imgchangeout(imgid){
	var imgobj=document.getElementById(imgid);	
	if(imgobj.src.indexOf('on.gif')!=-1){
		imgobj.src=imgobj.src.replace('on.gif','.gif');
	}
}

function openImgViewer(img_src)
{
	var o_preload = new Image();
	o_preload.src = img_src;

			
	var str_buffer = new String (
		"<html>\n"+
		"<head>\n"+
		"	<title>이미지 뷰어</title>\n"+
		"</head>\n"+
		"<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>\n"+
		"<img src='"+img_src+"' border='0' alt=''>\n"+				
		"</body>\n"+
		"<html>\n"
	);	
	
		
	var vWinImgViewer = window.open("", "imgViewer", "width="+o_preload.width+",height="+o_preload.height+",status=no,resizable=yes,top=200,left=200");

	vWinImgViewer.opener = self;
	var viewer_doc = vWinImgViewer.document;

	viewer_doc.write (str_buffer);

	viewer_doc.close();

}


//다중 레이어 변환
function layerChange(show,hide){
	for(var i = 0; i < show.length; i++) document.getElementById(show[i]).style.display='block';
	for(var i = 0; i < hide.length; i++) document.getElementById(hide[i]).style.display='none';
}

function sellang(hide){
	var obj=document.getElementById('sellanglayer');
	var clickobj=document.getElementById('sellangbtn');
	if(!hide){
		obj.style.top='17px';
		clickobj.onclick=function(){sellang(true);return false};
	}else{
		obj.style.top='-50px';
		clickobj.onclick=function(){sellang();return false};
	}
}

var g_css = 0;

function zoomFont(nSize) {
	var strCssName = "/html/script/common/css/kor/css";

	if(nSize == 0) {
		g_css = nSize;
	} else {
		g_css += nSize;

		if(g_css > 3) {
			g_css = 3;
		}

		if(g_css < -3) {
			g_css = -3;
		}
	}

	strCssName += g_css + ".css";

	var oStyle = document.getElementById("idStyle");
	oStyle.href = strCssName;
}

function openIDSearch(type, bClose) {
	if(type == null) {
		window.open("/web/mctMember/login/searchID.jsp", "_blank", "width=350, height=187");
	} else {
		window.open("/web/mctMember/login/searchPWD.jsp", "_blank", "width=350, height=187");
	}

	if(bClose) {
		self.close();
	}
}

function writeObject(strName) {
	var oNode = document.getElementById(strName);

	document.write(oNode.value);
}

function resizeImg(oImg, nWidth) {
	var nCwidth = oImg.width;

	if(nCwidth > nWidth) {
		nCwidth = nWidth;
	}

	oImg.width = nCwidth;
}

function CDirect(oSelect) {
	this.value = "";
	this.onOpen = onOpen;
}

var oDirect1 = new CDirect();
var oDirect2 = new CDirect();

function onOpen(oNode){

	var strUrl = oNode.value;

	//if((event.type == "keydown" && event.keyCode == 13) || event.type == "click" ||  event.type == "change") {
		if(this.value != strUrl) {
			this.value = strUrl;
			if(strUrl != "") {
				window.open(strUrl, "", "");
				oNode.options.selectedIndex = 0;
			}
		}
	//}
}

function searchStaff() {
	var oForm = document.topTotalSearchFrm;

	oForm.pKeyword.value = oForm.refineStr.value;

	oForm.action = "/web/introCourt/introStaff/introStaffList.jsp";
	oForm.submit();
}

function checkTotalSearch(oForm) {
	var strData = oForm.refineStr.value;

	if(strData == "") {
		alert("검색어를 입력해주세요");
		alertElement(oForm.refineStr);

		return false;
	}

	if(strData.indexOf('*') == 0) {
		alert("*는 검색어로 사용할 수 없습니다");
		alertElement(oForm.refineStr, true);

		return false;
	}

	return true;
}

function checkTotalSearchEng(oForm) {
	var strData = oForm.refineStr.value;

	if(strData == "") {
		alert("Enter your search terms");
		alertElement(oForm.refineStr);

		return false;
	}

	if(strData.indexOf('*') == 0) {
		alert("* You can not use the term.");
		alertElement(oForm.refineStr, true);

		return false;
	}

	return true;
}

function checkTotalSearchJpn(oForm) {
	var strData = oForm.refineStr.value;

	if(strData == "") {
		alert("検索用語を入力してください");
		alertElement(oForm.refineStr);

		return false;
	}

	if(strData.indexOf('*') == 0) {
		alert("*は、検索キーワードとして使用することはできません。");
		alertElement(oForm.refineStr, true);

		return false;
	}

	return true;
}

function checkTotalSearchChi(oForm) {
	var strData = oForm.refineStr.value;

	if(strData == "") {
		alert("輸入您的搜索字詞");
		alertElement(oForm.refineStr);

		return false;
	}

	if(strData.indexOf('*') == 0) {
		alert("*您不能使用這個詞。");
		alertElement(oForm.refineStr, true);

		return false;
	}

	return true;
}

function preViewImage(oImage) {
	window.open(oImage.src, "", "");
}

function getSSLURL(strData) {
	if(document.domain.indexOf("local") != -1) {
		return strData;
	} else {
		return 	"https://" + document.domain + strData;
	}
}


function IpinRealNameCheck() {
    wWidth = 360;
    wHight = 120;
    
    wX = (window.screen.width - wWidth) / 2;
    wY = (window.screen.height - wHight) / 2;
    
    var w = window.open("/GPIN/AuthRequest.jsp?pAction=REALNAME", "gPinLoginWin", "directories=no,toolbar=no,left="+wX+",top="+wY+",width="+wWidth+",height="+wHight);
}

/* 콘텐츠 부분 출력 */
var initBody;
function beforePrint() {
	initBody = document.body.innerHTML;
	document.body.innerHTML = document.getElementById("contents").innerHTML;
}
function afterPrint() { 
	document.body.innerHTML = initBody;
}
function printArea() { 
	window.print();
}
window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint;

// 재외국인 번호 체크 
function check_fgnno(fgnno) 
{  
	var sum=0;  
	var odd=0;  
	buf = new Array(13);  
	for(i=0; i<13; i++) { 
		buf[i]=parseInt(fgnno.charAt(i)); 
	}  
	odd = buf[7]*10 + buf[8];  
	if(odd%2 != 0) { 
		return false; 
	}  
	if( (buf[11]!=6) && (buf[11]!=7) && (buf[11]!=8) && (buf[11]!=9) ) 
	{    
		return false;  
	}  
	multipliers = [2,3,4,5,6,7,8,9,2,3,4,5];  
	for(i=0, sum=0; i<12; i++) { 
		sum += (buf[i] *= multipliers[i]); 
	}  
	sum = 11 - (sum%11);  
	if(sum >= 10) { sum -= 10; }  sum += 2;  
	if(sum >= 10) { sum -= 10; }  
	if(sum != buf[12]) { return false; }  
	return true; 
}