/***************************************
# prototype 추가 함수 리스트
/**************************************/
	String.prototype.number_format = function() {
		return this.replace(/(\d)(?=(?:\d{3})+(?!\d))/g,'$1,');
	}

	String.prototype.isUserid = function(str) {
		// 일반적인 아이디 체크
		var re_value;
		str = this != window ? this : str;
		var pattern = /^[a-zA-Z]{1}[a-zA-Z0-9_]{4,19}$/;
		re_value = (pattern.test(str)) ? true : false;
		try { 
			if(!re_value) {
				o_fcn_valid_cfg.error_msg = "첫글자는 영문자, 6자이상 20자 미만,\n영문,숫자,_문자만 사용할수 있습니다!!";
			}
		} catch(e) {}
		return re_value;
	}

	String.prototype.NotBlank = function(str) {
	// 공백 체크 사용불가
		var re_value;
		str = this != window ? this : str;
		var pattern = /\s/g;
		re_value = (pattern.test(str)) ? false : true;
		try { 
			if(!re_value) {
				o_fcn_valid_cfg.error_msg = "공백은 \n입력이 불가능합니다!!";
			}
		} catch(e) {}
		return re_value;
	}

	String.prototype.NotSpecial = function(str) {
	// 특수문자 체크 사용 불가
		str = this != window ? this : str;
		for(j=0; j < str.length; j++) {
			var A = str.charCodeAt(j);
			if((A>=33 && A<=47)||(A>=58 && A<=64)||(A>=91 && A<=96)||(A>=123 && A<=126)){
				try {o_fcn_valid_cfg.error_msg = "특수문자("+str.charAt(j)+")는 \n사용이 불가능합니다!!";} catch(e) {}
				return false;
			}
		}
		return true;
	}

	String.prototype.isHangulOnly=function(str) {
	// 한글만 가능가능(공백포함)
		str = this != window ? this : str;
		var pattern = /[가-힣\s]+$/;
		var re_value = (pattern.test(str)) ? true : false;
		try { 
			if(!re_value) {
				o_fcn_valid_cfg.error_msg = "한글만(공백포함) \n입력이 가능합니다!!";
			}
		} catch(e) {}
		return re_value;
	}


	String.prototype.isAlphaOnly=function(str) {
	// 영문만 가능(공백포함)
		str = this != window ? this : str;
		var pattern = /^[a-zA-Z\s]+$/;
		var re_value = (pattern.test(str)) ? true : false;
		try { 
			if(!re_value) {
				o_fcn_valid_cfg.error_msg = "영문만(공백포함) \n입력이 가능합니다!!";
			}
		} catch(e) {}
		return re_value;
	}

	String.prototype.isNumeric=function(str) {
	// 숫자만 가능
		str = this != window ? this : str;
		var pattern = /^[0-9]+$/;
		var re_value = (pattern.test(str)) ? true : false;
		try { 
			if(!re_value) {
				o_fcn_valid_cfg.error_msg = "숫자만 \n입력이 가능합니다!!";
			}
		} catch(e) {}
		return re_value;
	}

	String.prototype.isEmail=function(str) {
	// 이메일 주소 검사
		str = this != window ? this : str;
		var pattern = /[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+(\.[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+)*@[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+(\.[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+)*/;
		var re_value = (pattern.test(str)) ? true : false;
		try { 
			if(!re_value) {
				o_fcn_valid_cfg.error_msg = "이메일 형식이 잘못 되었습니다.";
			}
		} catch(e) {}
		return re_value;
	}

	String.prototype.isBusino=function(str) {
	// 사업자등록번호 체크
		str = this != window ? this : str;
		var sum = 0;
		var getlist =new Array(10);
		var chkvalue =new Array("1","3","7","1","3","7","1","3","5");
		for(var i=0; i<10; i++) { getlist[i] = str.substring(i, i+1); }
		for(var i=0; i<9; i++) { sum += getlist[i]*chkvalue[i]; }
		sum = sum + parseInt((getlist[8]*5)/10);
		sidliy = sum % 10;
		sidchk = 0;
		if(sidliy != 0) { sidchk = 10 - sidliy; }
		else { sidchk = 0; }

		try {
			if(sidchk != getlist[9]) o_fcn_valid_cfg.error_msg = "등록하신 번호는 잘못된 사업자등록번호 입니다.";
		} catch (e) {}
		return true;

}

/***************************************
# 폼체크시 기본함수들
/**************************************/
	/***************************************
	# space 가 있으면 true, 없으면 false
	/**************************************/
	function checkSpace( str ) {
		if(str.search(/\s/) != -1) {
			return true;
		} else {
			return false;
		}
	}

	/***************************************
	# NULL 체크함수
	/**************************************/
	function isnull( input ) {
		var flag = false;
		try{ flag = (input == null || typeof(input) == "undefined" || input == "");} 
		catch( e ) {}
		return flag;
	}

	/***************************************
	# 앞뒤 공백 제거
	/**************************************/
	String.prototype.trim = function(str) {
		str = this != window ? this : str;
		return str.replace(/^\s+/g,'').replace(/\s+$/g,'');
	}

	/***************************************
	# 글자 바이트 체크
	/**************************************/
	String.prototype.bytes = function(str) {
		str = this != window ? this : str;
		var len=0;
		for(j=0; j < str.length; j++) {
			var chr = str.charAt(j);
			len += (chr.charCodeAt() > 128) ? 3 : 1
		}
		return len;
	}


/***************************************
# 폼 체크 설정함수
/**************************************/
	function b_fcn_valid_cfg() {
		var wrestFldBackColor = req_color;
		this.o_form = null;                      // 현제 체크중인 폼객체
		this.o_el = null;                        // 현제 체크중인 엘리먼트 객체
		this.error_msg = "";                     // 에러 메시지
		this.split_char = "|";                   // 함수 구분 문자

		this.cfg_name = "f_name";                // 사용자 임의로 붙인 이름 속성
		this.cfg_focus = "f_focus";              // 체크중 에러시 포커스 처리 방법 [delete:select]

		this.cfg_item = new Array("f_min","f_max","f_fcn","f_user"); // 체크할 옵션들

		/***************************************
		# 옵션 처리 내부함수들
		/**************************************/
		this.item_0_pid = function() {
			// 최소글자 체크
			var re_value = true;
			var el_value = this.el_value();
			var el_attribute = parseInt(this.o_el.getAttribute(this.cfg_item[0]));

			switch(this.el_type()) {
				case 2 : // 체크박스
				case 3 : // 라디오박스
					var i_checked = 0;
					this.error_msg = " "+el_attribute+"개 이상\n필수 체크항목입니다!!";
					var t_o_obj = this.o_form[this.o_el.name];
					if(!isnull(t_o_obj[1])) {
						for(var i = 0, itotal = t_o_obj.length ; i < itotal ; i++) {
							if(t_o_obj[i].checked == true) i_checked++;
						}
					} else {
						if(t_o_obj.checked == true) i_checked++;
					}
					if(i_checked < el_attribute) re_value = false;
				break;
				case 1 : // 셀렉트 박스
					if(isnull(el_value) || el_value == '0') {
						re_value = false;
						this.error_msg = " 필수 선택 사항입니다!!";
					}
				break;
				default : 
					if(el_value.bytes() < el_attribute) {
						// 최소입력바이트보다 작을경우
						var tcnt = parseInt(el_attribute/3);
						this.error_msg = "최소 "+el_attribute+"Bytes(한글기준 "+tcnt+"글자) 이상 \n필수입력 사항입니다!!";
						re_value = false;
					}
			}
			return re_value;
		}

		this.item_1_pid = function() {
			if(this.el_type() != 0) return true; // 텍스트가 아닐경우 true

			var el_value = this.o_el.value.trim();
			var el_attribute = parseInt(this.o_el.getAttribute(this.cfg_item[1]));
			if(el_value.bytes() > el_attribute) {
				var tcnt = parseInt(el_attribute/3);
				this.error_msg = "최대 "+el_attribute+"Bytes(한글기준 "+tcnt+"글자) 이하 \n입력 사항입니다!!";
				return false;
			} else {
				return true;
			}
		}

		this.item_2_pid = function() {
			// prototype 함수 체크
			var el_value = this.el_value();
			var el_att = this.o_el.getAttribute(this.cfg_item[2]);
			var ar_el_att = el_att.split(this.split_char);
			var isTrue = true;

			for(var i = 0,itotal = ar_el_att.length ; i < itotal ; i++) {
				var c_prototype = "el_value."+ar_el_att[i]+"();";
				try { 
					isTrue = eval(c_prototype); 
				} catch(e) {}
				if(!isTrue) break;
			}
			return isTrue;
		}

		this.item_3_pid = function() {
			// 사용자 함수 체크 
			var el_value = this.el_value();
			var el_att = this.o_el.getAttribute(this.cfg_item[3]);
			var ar_el_att = el_att.split(this.split_char);
			var isTrue = true;

			for(var i = 0,itotal = ar_el_att.length ; i < itotal ; i++) {
				var c_prototype = ar_el_att[i]+"(el_value);";
				try { 
					isTrue = eval(c_prototype); 
				} catch(e) {}
				if(!isTrue) break;
			}
			return isTrue;
		}

		this.el_type = function (){
			// 엘리먼트 타입체크
			//[0] : 기본 input ,textarea ,password
			//[1] : select
			//[2] : check
			//[3] : radio
			var el_type = this.o_el.type;
			var el_tagName = this.o_el.tagName;
			switch(el_type) {
				//case "input" : case "password" :case "textarea" : el_type = 0; break;
				case "select-one" : el_type = 1; break;
				case "checkbox" : el_type = 2; break;
				case "radio" : el_type=3; break;
				default : el_type = 0;
			}
			return el_type;
		}

		this.el_value = function() {
			// 배열로된건가 체크하기[작업중]
			re_value = this.o_el.value.trim();
			return  re_value;
		}

		this.error = function() {
			var msg_name = "";
			var el_focus = '';
			if(!isnull(this.o_el.getAttribute(this.cfg_name))) {
				msg_name = this.o_el.getAttribute(this.cfg_name);
			} else {
				msg_name = this.o_el.name;
			}

			alert(msg_name+" : "+" "+this.error_msg);
			// 포커스 처리하는 부분 넣을것
			el_focus = this.o_el.getAttribute(this.cfg_focus);
			
			switch(el_focus) {
				case "delete" :
					this.o_el.value = "";
					this.o_el.focus();
				break;
				case "select" :
					this.o_el.select();
				break;
				default : 
					this.o_el.style.backgroundColor = wrestFldBackColor;
					this.o_el.focus();
			}
		}
	}

/***************************************
# 폼 체크함수 메인
/**************************************/
	var o_fcn_valid_cfg = new b_fcn_valid_cfg();

	function b_fcn_valid (o_form) {
		o_fcn_valid_cfg.o_form = o_form; // 폼객체

		for(var i = 0,i_el_len =  o_form.elements.length ; i < i_el_len ; i++) {
			// 폼의 엘리먼트 만큼 반복
			o_fcn_valid_cfg.o_el = o_form.elements[i]; // 엘리먼트 객체

			for(var k = 0 , k_len = o_fcn_valid_cfg.cfg_item.length ; k < k_len ; k++) {
				// 체크 항목만큼의 반복
				if(!isnull(o_fcn_valid_cfg.o_el.getAttribute(o_fcn_valid_cfg.cfg_item[k]))) {
					// 항목에 관한 속성 값이 있을경우
					try {
						if(!eval("o_fcn_valid_cfg.item_"+k+"_pid()")) {
							// 전송값이 false 일경우 for 종료
							o_fcn_valid_cfg.error();
							return false; 
						}
					} catch(e) {
						// 스크립트 에러 로그파일로 보내기
					}
				}
			}
		}
		return true;
	}

/***************************************
# 글쓰기 textarea 제어 함수
/**************************************/
	function textarea_decrease(id, row) {
		if (document.getElementById(id).rows - row > 0)
			document.getElementById(id).rows -= row;
	}
	
	function textarea_original(id, row) {
		document.getElementById(id).rows = row;
	}
	
	function textarea_increase(id, row) {
		document.getElementById(id).rows += row;
	}

/***************************************
# 팝업창 관련 함수
/**************************************/
	function openWin(sURL, sWindowName, w, h, sScroll, reSize, status, hUp){
		// 팝업창 위치 조정
		var x = parseInt((self.screen.width - w)/2);
		var y = parseInt((self.screen.height - h)/2);

		if(!hUp || hUp<0) hUp = 100;
		y = y - hUp

		if (sScroll==null) sScroll = "no";

		var sOption = "";
		sOption = sOption + "toolbar=no, channelmode=no, location=no, directories=no, menubar=no";
		sOption = sOption + ", scrollbars=" + sScroll + ", resizable=" + reSize + ", status=" + status +", left=" + x + ", top=" + y + ", width=" + w + ", height=" + h;

		var win = openUnNamedWindow(sURL, sWindowName, sOption);
		return win;
	}

	// 빠르게 띄우는 팝업/////////////////////////////////////////
	// 사용예 var win = controlOpenWindow("notice","/notice.php","...");
	var newWindow = new Array(); 
	function openNamedWindow(winURL,winID,winName,winOption) {
		newWindow[winID] = window.open(winURL,winName,winOption);
	}

	function openUnNamedWindow(winURL,winID,winOption) {
		if(newWindow[winID]) {
			newWindow[winID].close();
		}
		newWindow[winID] = window.open(winURL,'',winOption);
		}


	var arrWndOpenWindow = new Array();

	function push(array, arg){
		array[array.length] = arg;
	}
	function pop(array){
		var obj = array[0];
		var temp = new Array();
		for ( i = 1; i < array.length; i++ ){
			temp[i-1] = array[i];
		}
		array = temp;
		return obj;
	}
	function controlOpenWindow(strURL, strWndName, strOptions) {
		var arrTemp = new Array();
		var wndTemp;
		var wndName;
		
		var arrWndOpenWindow = getArrWndOpenWindow();
		if ( arrWndOpenWindow == null) {
			arrWndOpenWindow = this.arrWndOpenWindow;
		}
		for ( i = 0; i < arrWndOpenWindow.length; i++ ) {
			wndTemp = arrWndOpenWindow[i];
			if ( wndTemp == null) continue;
			if ( !wndTemp['window'] ) continue;
			if ( wndTemp['window'].closed ) {
				arrWndOpenWindow[i] = null;
				continue;
			}
			wndName = wndTemp['name'];
			if ( wndName != "" && strWndName == wndName ) {
				wndTemp['window'].location.replace(strURL);

				push(arrTemp, wndTemp);
				for ( j = 0; j < arrTemp.length; j++ ) {
					push(arrWndOpenWindow, arrTemp[j]);
				}
				return null;
			}
			push(arrTemp, wndTemp);
		}
		for ( i = 0 ; i < arrTemp.length; i++ ) {
			push(arrWndOpenWindow, arrTemp[i]);
		}

		var wndNewWindow = window.open(strURL, '', strOptions);
		var wndSaveWindow = new Array();
		wndSaveWindow['name'] = strWndName;
		wndSaveWindow['window'] = wndNewWindow;

		push(arrWndOpenWindow, wndSaveWindow);
		return wndNewWindow;
	}

	function getArrWndOpenWindow() {
		return top.arrWndOpenWindow;
	}
// 빠르게 띄우는 팝업관련 끝//////////////////////////////////



/***************************************
# 사용자 정의 추가 함수 리스트
/**************************************/
	function showLayer(obj) {
		document.getElementById(obj).style.visibility = "visible";
	}
	function hideLayer(obj) {
		document.getElementById(obj).style.visibility = "hidden";
	}

	function hideSelect() {
		var windows = window.frames.length;
		var selects = document.getElementsByTagName("SELECT");
		for (i=0;i < selects.length ;i++ ) {
			selects[i].style.visibility = "hidden";
		}
		if (windows > 0) {
			for(i=0; i < windows; i++) {
				try {
					var selects = window.frames[i].document.getElementsByTagName("SELECT");
					for (j=0;j<selects.length ;j++ ) {
						selects[j].style.visibility = "hidden";
					}
				} catch (e) {}
			}
		}
	}

	function showSelect() {
		var windows = window.frames.length;
		var selects = document.getElementsByTagName("SELECT");
		for (i=0;i < selects.length ;i++ ) {
			selects[i].style.visibility = "visible";
		}
		if (windows > 0) {
			for(i=0; i < windows; i++) {
				try {
					var selects = window.frames[i].document.getElementsByTagName("SELECT");
					for (j=0;j<selects.length ;j++ ) {
						selects[j].style.visibility = "visible";  
					}
				} catch (e) {}
			}
		}
	}

	function number_format2(data) {
		var tmp = '';
		var number = '';
		var cutlen = 3;
		var comma = ',';
		var i;
		len = data.length;
		mod = (len % cutlen);
		k = cutlen - mod;
		for (i=0; i<data.length; i++) {
			number = number + data.charAt(i);
			if (i < data.length - 1) {
				k++;
				if ((k % cutlen) == 0) {
					number = number + comma;
					k = 0;
				}
			}
		}
		return number;
	}

	function valid_date(inputText) {
		if(inputText.value == "" || inputText.value == null)
			return true;

		var pattern = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;

		if(inputText.value.match(pattern) == null) {
			alert("형식에 맞지 않습니다.\n0000-00-00 와같은 형식으로 입력하세요.");
			inputText.value = "";
			inputText.focus();
			return false;
		}

		dateItems = inputText.value.split("-");
		year	= eval(dateItems[0]);
		month	= eval(dateItems[1]); //자바스크립트 버그 parseInt("08")이 들어가면 --> 0
		day		= eval(dateItems[2]); //parseInt("09")이 들어가면 --> 0

		if(year < 1960 || month <= 0 || day <= 0) {
			alert("날짜 범위에 맞지 않습니다.\n0000-00-00 와같은 형식으로 입력하세요.");
			inputText.value = "";
			inputText.focus();
			return false;
		}

		var maxDays=31;
		// 2월의 경우, 윤년 확인
		if (month==2){
			if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) maxDays=29;
			else maxDays=28;
		}

		// 30일만 있는 달 확인
		if (month==4 || month ==6 || month ==9 || month ==11) maxDays=30;	

		if(day > maxDays) {
			alert("날짜 범위에 맞지 않습니다.\n0000-00-00 와같은 형식으로 입력하세요.");
			inputText.value = "";
			inputText.focus();
			return false;
		}
		return true;
	}

	try {
		function f_clientWidth() {
			return f_filterResults (
				top.window.innerWidth ? top.window.innerWidth : 0,
				top.document.documentElement ? top.document.documentElement.clientWidth : 0,
				top.document.body ? top.document.body.clientWidth : 0
			);
		}
		function f_clientHeight() {
			return f_filterResults (
				top.window.innerHeight ? top.window.innerHeight : 0,
				top.document.documentElement ? top.document.documentElement.clientHeight : 0,
				top.document.body ? top.document.body.clientHeight : 0
			);
		}
		function f_scrollLeft() {
			return f_filterResults (
				window.pageXOffset ? window.pageXOffset : 0,
				document.documentElement ? document.documentElement.scrollLeft : 0,
				document.body ? document.body.scrollLeft : 0
			);
		}
		function f_scrollTop() {
			return f_filterResults (
				window.pageYOffset ? window.pageYOffset : 0,
				document.documentElement ? document.documentElement.scrollTop : 0,
				document.body ? document.body.scrollTop : 0
			);
		}
		function f_filterResults(n_win, n_docel, n_body) {
			var n_result = n_win ? n_win : 0;
			if (n_docel && (!n_result || (n_result > n_docel)))
				n_result = n_docel;
			return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
		}
	} catch(E) {}

	// 사업자 등록번호 체크
	function check_worknum(obj) {
		var resno = obj.number11.value+"-"+obj.number12.value+"-"+obj.number13.value;
		var fmt = /^[0-9]{3}-[0-9]{2}-[0-9]{5}$/;
		if(!fmt.test(resno)) {
			obj.number11.style.backgroundColor=req_color;
			obj.number12.style.backgroundColor=req_color;
			obj.number13.style.backgroundColor=req_color;
			obj.number11.focus();
			return false; 
		}
		// Check Sum 코드의 유효성 검사
		buf = new Array(10);
		for (i = 0; i < 3; i++) buf[i] = parseInt(resno.charAt(i));
		for (i = 3; i < 5; i++) buf[i] = parseInt(resno.charAt(i + 1));
		for (i = 5; i < 10; i++) buf[i] = parseInt(resno.charAt(i + 2));
		multipliers = [1,3,7,1,3,7,1,3,5,1];
		for (i = 0, sum = 0; i < 10; i++){
			if(i==0 || i==9){
				sum += (buf[i] * multipliers[i]);
			}else{
				sum += (buf[i] * multipliers[i]%10);
				if(i==8) sum += Math.floor(buf[i] * multipliers[i] / 10);
			}
		}
		if (sum % 10 != 0) {
			obj.number11.style.backgroundColor=req_color;
			obj.number12.style.backgroundColor=req_color;
			obj.number13.style.backgroundColor=req_color;
			obj.number11.focus();
			return false;
		}
		return true;
	}

	// 법인등록번호 체크
	function check_corpnum(obj){
		var resno = obj.number21.value+"-"+obj.number22.value;
		var fmt = /^[0-9]{6}-[0-9]{7}$/;
		if(!fmt.test(resno)) {
			obj.number21.style.backgroundColor=req_color;
			obj.number22.style.backgroundColor=req_color;
			obj.number21.focus();
			return false;
		}
		// Check Sum 코드의 유효성 검사
		buf = new Array(13);
		for (i = 0; i < 6; i++) buf[i] = parseInt(resno.charAt(i));
		for (i = 6; i < 13; i++) buf[i] = parseInt(resno.charAt(i + 1));

		multipliers = [1,2,1,2,1,2,1,2,1,2,1,2];
		for (i = 0, sum = 0; i < 12; i++) sum += (buf[i] *= multipliers[i]);
		if(10 - sum.toString().substring(sum.toString().length*1 - 1,sum.toString().length*1)*1 != buf[12]) {
			obj.number21.style.backgroundColor=req_color;
			obj.number22.style.backgroundColor=req_color;
			obj.number21.focus();
			return false;
		}
		return true;
	}

	// 마우스 포커스 이동
	function controlFocus(obj, toID) {
		if (toID == null) return;
		var maxLen = obj.getAttribute("maxlength"); 
		if (obj.value.length >= maxLen) {
			focusThis(toID);
		}
	}
	function focusThis(id) {
		document.getElementById(id).focus();
	}

	// soft = 1 : 1000 단위 허용
	// kcut = Kbyte 단위 소수점 이하 생략
	function byteunit (num) {
		var unit,result,soft;
		var unit = 1024;

		if(!num) return num;

		if (num >= (unit*unit)) {
			result = (num / (unit*unit))+" M";
		}
		else if (num >= (unit)) {
			result = (num / (unit))+" K";
		}
		else { result = num+" "; }
		return result;
	}

	// 주민등록번호 검사
	function check_jumin(str) {
		if(!str) return false;
		
		var pattern = /(^[0-9]{13}$)/;
		if (!pattern.test(str)) {
			return false;
		} else {
			var sum_1 = 0;
			var sum_2 = 0;
			var at  = 0;
			var att = 0;
			var jumin_number= str;
			sum_1 = (jumin_number.charAt(0)*2) + (jumin_number.charAt(1)*3) + (jumin_number.charAt(2)*4) + (jumin_number.charAt(3)*5) + (jumin_number.charAt(4)*6) + (jumin_number.charAt(5)*7) + (jumin_number.charAt(6)*8) + (jumin_number.charAt(7)*9) + (jumin_number.charAt(8)*2) + (jumin_number.charAt(9)*3) + (jumin_number.charAt(10)*4) + (jumin_number.charAt(11)*5);
			sum_2 = sum_1 % 11;

			if (sum_2 == 0) at = 10;
			else {
				if (sum_2 == 1) at = 11;
				else at = sum_2;
			}

			att = 11 - at;

			if (jumin_number.charAt(12) != att || jumin_number.substr(2,2) < '01' || jumin_number.substr(2,2) > '12' || jumin_number.substr(4,2) < '01' || jumin_number.substr(4,2) > '31' || jumin_number.charAt(6) > 4) {
				return false;
			}
		}
		return true;
	}

	function get_request_exist(branch,view_div) {
		var sel,pv1,pv2,para,obj_sel;
		var today = new Date();
		var ts = today.getTime();
		var f = document.forms['WriteForm'];
		switch (branch) {
			case "loginid" :
				sel	= "loginid";
				pv1	= f.loginid.value.trim();
				if(pv1 == '') {
					alert('아이디를 입력해 주십시오.');
					return false;
				}
				para = 'ctype=id_check&id=' + pv1;
				break;

			case "email" :
				sel	= "email";
				pv1	= f.email.value.trim();
				if(pv1 == '') {
					alert('이메일주소를 입력해 주십시오.');
					return false;
				}
				para = 'ctype=email_check&email=' + pv1 + '&ts=' + ts;
				break;

			default :
				return;
				break;
		}
		sendRequest2(put_alert,sel,"/login/xml_process.php",para,"GET");
	}
	function get_request_exist2(branch,view_div) {
		var sel,pv1,pv2,para,obj_sel;
		var today = new Date();
		var ts = today.getTime();
		var f = document.forms['WriteForm'];
		switch (branch) {
			case "email" :
				sel	= "email";
				pv1	= f.email.value.trim();
				if(pv1 == '') {
					alert('이메일주소를 입력해 주십시오.');
					return false;
				}
				para = 'ctype=email_check&email=' + pv1 + '&ts=' + ts;
				break;

			default :
				return;
				break;
		}
		sendRequest2(put_alert,sel,"/modules/member/xml_process.php",para,"GET");
	}
	function put_alert(o, obj) {
		var ids, msg;
		var res = o.responseText;
		var f = document.forms['WriteForm'];

		switch (obj) {
			case "loginid" :
				f.check_id_enabled.value = res;
				if(res == 1) alert("사용 가능한 아이디 입니다.");
				else alert("이미 가입된 아이디 입니다.\r\n다른 아이디를 입력 후 다시 시도하십시오.");
				break;

			case "email" :
				f.check_email_enabled.value = res;
				if(res == 1) alert("사용 가능한 이메일 주소 입니다.");
				else alert("이미 등록된 이메일주소 입니다.\r\n다른 이메일 주소를를 입력 후 다시 시도하십시오.");
				break;

			default :
				return;
				break;
		}
	}

	function MakeFlash(Url,Width,Height){
		document.writeln("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + Width + "\" height=\"" + Height + "\">"); 
		document.writeln("<param name=\"movie\" value=\"" + Url + "\">"); 
		document.writeln("<param name=\"quality\" value=\"high\" />");
		document.writeln("<embed src=\"" + Url + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + Width + "\"  height=\"" + Height + "\">"); 
		document.writeln("</object>");
	}

	// 뉴스 프린트
	function news_print(n) {
		var sURL = cfg_path+"/modules/etc/print_news.php?no="+n;
		openWin(sURL, "PrintNews", 690, 600, "Yes", "Yes", "No", 0);
	}

	// 뉴스 메일
	function news_mail(n) {
		if(is_member==0) {
			var sURL = cfg_path+"/login/login.php?url="+encodeURIComponent(cfg_path+"/?job=news&no="+n);
			if(confirm("로그인 하셔야 메일보내기 기능을 이용하실 수 있습니다.\n로그인 하시겠습니까?"))
				document.location.href=sURL;
			else return;
		} else {
			var sURL = cfg_path+"/modules/etc/email_news.php?no="+n;
			openWin(sURL, "mailNews", 500, 550, "Yes", "Yes", "No", 0);
		}
	}

	// 동영상 파일 업로드 팝업창
	function inputVodFile(fname) {
		var sURL = cfg_path+"/modules/upload/uploader.php?form="+fname;
		openWin(sURL, "uploadvod", 600, 280, "No", "No", "No", 0);
	}

	function newsVodFile(fname) {
		var sURL = cfg_path+"/modules/uploadVod/uploader.php?form="+fname;
		openWin(sURL, "uploadvod", 600, 280, "No", "No", "No", 0);
	}
	function newsVodFile2(fname) {
		if(is_opera || is_gecko || is_mac) {
			alert("동영상 등록은 Explorer 버전에서만 이용가능합니다.");
		} else {
			var sURL = cfg_path+"/modules/uploadVod2/uploader.php?form="+fname;
			openWin(sURL, "uploadvod", 500, 220, "No", "No", "No", 0);
		}
	}

	// 보도자료 타겟 메일서비스용 자료찾기 팝업창
	function findNewsData(fname) {
		var sURL = cfg_path+"/modules/etc/findnewsdata.php?form="+fname;
		openWin(sURL, "findnews", 600, 280, "Yes", "No", "No", 0);
	}

	// 샘플 비디오 보기
	function ViewSampleVideo(n) {
		var sURL = cfg_path+"/modules/service/view_video.php?type="+n;
		openWin(sURL, "videoWin", 600, 450, "No", "No", "No", 0)
	}

	// 보도자료 이미지 보기
	function newsimgopen(id, no, mode, w, h) {
		if(is_member==0) {
			var sURL = cfg_path+"/login/login.php?url="+encodeURIComponent(cfg_path+"/?job=news&no="+id);
			if(confirm("로그인 하셔야 고해상도 사진을 볼 수 있습니다.\n로그인 하시겠습니까?"))
				document.location.href=sURL;
			else return;
		} else {
			var sURL = cfg_path+"/modules/etc/newsImageView.php?type="+mode+"&no="+no;
			openWin(sURL, "videoWin", w, h, "No", "No", "No", 0)
		}
	}

	function viewVod(n, w, h) {
		var ws = w;
		var hs = parseInt(h);
		var sURL = cfg_path+"/modules/etc/view_video.php?no="+n;
		openWin(sURL, "videoWin", ws, hs, "No", "No", "No", 0)
	}

	// 서비스 관련 이동
	function GoService(n) {
		if(n==74 && WES_flag==0) {alert("개설된 강좌가 없습니다."); return;}
		if(n==99) {alert("서비스 준비중입니다."); return;}
		var url = cfg_path+"/?sd="+n;
		document.location.href=url;
	}

	// 회원 가입 이동
	function GoMemberJoin(n) {
		var url = ssl_host+"/member/member_join.php?type="+n+"&step=1";
		document.location.href=url;
	}

	// 다운로드 이동
	function downloadFile(n) {
		var url = cfg_path+"/modules/download/downloadS.php?type="+n;
		document.location.href=url;
	}

	// 서비스 신청페이지 이동
	function GoSupport(n) {
		var surl = cfg_path+'/?sd=89';
		if(mem_type!="기업회원") {
			if(confirm("기업회원만 이용가능한 서비스입니다.\r\n회원님의 회원타입: "+mem_type+"\r\n기업회원으로 회원타입을 전환하시겠습니까?"))
				document.location.href=surl;
			else return;
		} else {
			var url = cfg_path+"/support/?prod="+n;
			document.location.href=url;
		}
	}

	// 대행사(에이젼시) 회원의 신규 기업정보 등록
	function AddCompany() {
		var sURL = cfg_path+"/modules/etc/AddCompany.php";
		openWin(sURL, "AddCompany", 780, 600, "Yes", "No", "No", 0)
	}

	function alerLogin(n) {
		var surl = cfg_path+"/login/login.php?type=1&url="+encodeURIComponent(cfg_path+"/?sd="+n);
		if(confirm("기업회원 전용 서비스입니다.\n로그인 하시겠습니까?"))
			document.location.href=surl;
		else return;
	}

	// 이미지 롤오버
	// onmouseover="paging_rollover(this, './img/bt_next', 'on')" onmouseout="paging_rollover(this, './img/bt_next', 'out')" 형태로 이용.
	function paging_rollover(obj, img, type) {
		if (type == "on") {
			obj.src = img + "_over.gif";
		} else {
			obj.src = img + ".gif";
		}
	}

	// 이미지 롤오버
	function image_rollover(obj, img, type) {
		if (type == "on") {
			obj.style.background= "url("+img+"_over.gif)";
		} else {
			obj.style.background= "url("+img+".gif)";
		}
	}

	// tr 부분 마우스 오버시
	function sbar (st) { st.style.backgroundColor = '#EAE9E9'; } // #F2F4EB // #E1E6D7
	function cbar (st) { st.style.backgroundColor = ''}

	function ssbar (st) { st.style.backgroundColor = '#FFE6E6'; } // #F2F4EB
	function ccbar (st) { st.style.backgroundColor = ''}

	function lsbar (st) { st.style.backgroundColor = '#EAE9E9'; } // #F2F4EB
	function lcbar (st) { st.style.backgroundColor = ''}

	// 우편번호 찾기
	function searchZipCode(form, zip1, zip2, address) {
		var sURL = cfg_path+"/modules/zipcode/zipcode.php?form="+form+"&zip1="+zip1+"&zip2="+zip2+"&address="+address;
		openWin(sURL, "SearchZipcode", 540, 330, "Yes", "No", "No", 0);
	}
	function searchZipCode2(form, zip1, zip2, address) {
		var sURL = ssl_host+"/modules/zipcode/zipcode.php?form="+form+"&zip1="+zip1+"&zip2="+zip2+"&address="+address;
		openWin(sURL, "SearchZipcode", 540, 330, "Yes", "No", "No", 0);
	}

	function scaleFont(val) {
		var content = document.getElementById("mainContent");
		var tmp = content.style.fontSize.split('px');
		if(!tmp[0]) fontSize=14;
		else fontSize = tmp[0];

		if (val > 0) {
			nfontSize = parseInt(fontSize) + parseInt(val);
			content.style.fontSize = nfontSize + "px";

		} else {
			if(fontSize>2) {
				nfontSize = parseInt(fontSize) + parseInt(val);
				content.style.fontSize = nfontSize + "px";
			} else {
				content.style.fontSize = fontSize + "px";
			}
		}
	}

	function image_window(img, w, h) {
		var img, w, h;
		if(!w) {
			if(img.tmp_width) { // this 1
				w = img.tmp_width;
				h = img.tmp_height;
				img = img.src;
			} else if(!img.width) { // this 2
				var imgObj = new Image();
				imgObj.src = img;
				img = imgObj.src;
				w = imgObj.width;
				h = imgObj.height;
			} else { // url
				w = img.width;
				h = img.height;
				img = img.src;
			}
		}
		// 로딩되지(읽지) 않은 이미지의 오류. beta 2006.06.26
		if(!parseInt(w)) {
			w = img.width;
			h = img.height;
		}

		wsw = window.screen.width;
		wsh = window.screen.height;
		winl = (w >= wsw) ? 0 : (wsw-w)/2;
		wint = (h >= wsh) ? 0 : (wsh-h)/3;

		win=window.open('','newWindow','width='+w+',height='+h+',top='+wint+',left='+winl+',scrollbars=no,resizable=no,status=no');
		win.document.open();
		win.document.write ("<html><head> \n<meta http-equiv='imagetoolbar' CONTENT='no'> \n<meta http-equiv='content-type' content='text/html; charset=UTF-8'>\n");
		win.document.write ("<title>이미지 "+w+" x "+h+"</title> \n");
		if(!winl || !wint) {
			var js_url = "<script language='JavaScript'> \n";
			js_url += "<!-- \n";
			js_url += "var is_ie=document.all; \n";
			js_url += "var isdrag=false; \n";
			js_url += "var x,y,dobj; \n";
			js_url += "function movemouse(e) { \n";
			js_url += "if (isdrag) { \n";
			js_url += "dobj.style.left = is_ie ? tx + event.clientX - x : tx + e.clientX - x; \n";
			js_url += "dobj.style.top  = is_ie ? ty + event.clientY - y : ty + e.clientY - y; \n";
			js_url += "return false; }} \n";
			js_url += "function selectmouse(e) { \n";
			js_url += "var fobj       = is_ie ? event.srcElement : e.target; \n";
			js_url += "var topelement = is_ie ? 'BODY' : 'HTML'; \n";
			js_url += "while (fobj.tagName != topelement && fobj.className != 'dragme') { \n";
			js_url += "fobj = is_ie ? fobj.parentElement : fobj.parentNode; } \n";
			js_url += "if (fobj.className=='dragme') { \n";
			js_url += "isdrag = true; \n";
			js_url += "dobj = fobj; \n";
			js_url += "tx = parseInt(dobj.style.left+0); \n";
			js_url += "ty = parseInt(dobj.style.top+0); \n";
			js_url += "x = is_ie ? event.clientX : e.clientX; \n";
			js_url += "y = is_ie ? event.clientY : e.clientY; \n";
			js_url += "document.onmousemove=movemouse; \n";
			js_url += "return false; }} \n";
			js_url += "document.onmousedown=selectmouse; \n";
			js_url += "document.onmouseup=new Function('isdrag=false'); \n";
			js_url += "//--> \n";
			js_url += "</"+"script> \n";
			win.document.write (js_url);
			var click = "ondblclick='window.close();' style='cursor:move'";
		} else
			var click = "onclick='window.close();' style='cursor:pointer'";
		win.document.write ("<style>.dragme{position:relative;}</style>\n");
		win.document.write ("</head> \n\n");
		win.document.write ("<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' bgcolor='#dddddd'> \n");
		win.document.write ("<table cellpadding='0' cellspacing='0' width='100%' height='100%'><tr><td align='center'><img src='"+img+"' name='imgs' width='"+w+"' height='"+h+"' "+click+" class='dragme'></td></tr></table> \n");
		win.document.write ("</body></html>");
		win.document.close();
		if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
	}
