
var ie = new RegExp(/MSIE/).test(navigator.userAgent) ? true : false; //IE 
var ff = new RegExp(/Firefox/).test(navigator.userAgent) ? true : false; //FF


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// °øÅë ÇÔ¼ö
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


//-----------------------------------------------------------------------------------------------------------------------------------
// »õÃ¢ ¶ç¿ì±â ÇÔ¼ö
// <a href="javascript:WinOpen('/temp/test.html', '100', '100', 'yes', 'no');">»õÃ¢</a>
// WinOpen('°æ·Î', '³ÐÀÌÅ©±â', '³ôÀÌÅ©±â', '½ºÅ©·ÑÀ¯¹«', '¸®»çÀÌÁîÀ¯¹«')
//-----------------------------------------------------------------------------------------------------------------------------------

	function WinOpen(url, target, width, height, left, top, scrollbars, resizable){
		window.open(url, target, "width="+ width +", height="+ height +",left="+left+", top="+top+", toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars="+ scrollbars +", resizable="+ resizable);  
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// Å¬¸¯½Ã ¸Þ´º º¸ÀÓ <--> ¾Èº¸ÀÓ ÇÔ¼ö
// <a href="#" onClick="MenuClick('0')">¸Þ´º</a>
// <span id="submenu_prodeval0" style="DISPLAY: none;">¼­ºê¸Þ´º</span>
//-----------------------------------------------------------------------------------------------------------------------------------

	function MenuClick(name){
		var old = '';
		submenu = eval(name+".style");
		if(old != submenu){
			if(old != ''){
				old.display='none';
			}
			submenu.display = 'block';
			old = submenu;
		}
		else{
			submenu.display = 'none';
			old = '';
		}
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// ¼ýÀÚ¸¸ ÀÔ·Â ÇÔ¼ö
// <input onkeypress="isNum(event);" STYLE="IME-MODE:DISABLED">
//-----------------------------------------------------------------------------------------------------------------------------------

	function isNum(Ev){
		if (ie){
			if (event.keyCode<48 || event.keyCode>57){
				event.returnValue = false;
			} else if (ff){
				 if (Ev.which<48 || Ev.which>57){
					Ev.preventDefault();
				}
			}
		}
	}

//-----------------------------------------------------------------------------------------------------------------------------------
// ¼ýÀÚ,"-" ¸¸ ÀÔ·Â ÇÔ¼ö
// <input onkeypress="isNumChar(event);" STYLE="IME-MODE:DISABLED">
//-----------------------------------------------------------------------------------------------------------------------------------

	function isNumChar(Ev){
		if (ie){
			if ((event.keyCode<48 || event.keyCode>57) && event.keyCode != 45 ){
				event.returnValue = false;
			}
		} else if (ff){
			if ((Ev.which<48 || Ev.which>57) && Ev.which != 45 ){
				Ev.preventDefault();
			}
		}    
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// ¿µ¹®ÀÚ(¼Ò)/¼ýÀÚ/Æ¯¼ö¹®ÀÚ(_) ¸¸ ÀÔ·Â ÇÔ¼ö
// if (!CheckChar(frm.memb_id.value)){
//		alert("¿µ¹® ¼Ò¹®ÀÚ, ¼ýÀÚ¿Í Æ¯¼ö±âÈ£(_) ¸¸ »ç¿ëÇÒ¼ö ÀÖ½À´Ï´Ù.");
//		return;
//	}
//-----------------------------------------------------------------------------------------------------------------------------------

	function CheckChar(fn) {// 
		var err_cnt = 0;
		for (var i = 0; i < fn.length; i++) {
			var val = fn.charAt(i);
			if (!((val >= "a" && val <= "z") || (val >= "0" && val <= "9") || (val == "_"))){
				err_cnt++;
			}
		}

		if (err_cnt == 0 ) return true;
		else return false;
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// ¿µ¹®ÀÚ(¼Ò)/¼ýÀÚ ¸¸ ÀÔ·Â ÇÔ¼ö
// if (!CheckEngNum(frm.memb_pass.value)){
//		alert("¿µ¹® ¼Ò¹®ÀÚ, ¼ýÀÚ ¸¸ »ç¿ëÇÒ¼ö ÀÖ½À´Ï´Ù.");
//		return;
//	}
//-----------------------------------------------------------------------------------------------------------------------------------
  
	function CheckEngNum(fn) {// 
		var err_cnt = 0;
		for (var i = 0; i < fn.length; i++) {
			var val = fn.charAt(i);
			if (!((val >= "a" && val <= "z") || (val >= "0" && val <= "9"))){
				err_cnt++;
			}
		}

		if (err_cnt == 0 ) return true;
		else return false;
	} 


//-----------------------------------------------------------------------------------------------------------------------------------
// ¿µ¹®ÀÚ(¼ýÀÚ)¸¸ Çã¿ë
// if (!CheckChar(document.form.temp.value)) {
//		alert("");
//		document.form.temp.focus();
//		return false;
//	}
// CheckChar(object¸í)
//-----------------------------------------------------------------------------------------------------------------------------------

	function CheckChar(fn) { 
	   var err_cnt = 0;
		for (var i = 0; i < fn.length; i++) {
			var val = fn.charAt(i);
			if (!((val >= "a" && val <= "z") || (val >= "A" && val <= "Z") || (val >= "0" && val <= "9")))
			err_cnt ++
		}
		if (err_cnt == 0 ) return true;
		else return false;
	} 


//-----------------------------------------------------------------------------------------------------------------------------------
// ¿Ã¹Ù¸¥ ÀüÈ­¹øÈ£ Çü½Ä(¼ýÀÚ-¼ýÀÚ-¼ýÀÚ) ÀÔ·Â ÇÔ¼ö
// if (!isPhone(frm.CC_TEL.value)){
//		alert("¿¬¶ôÃ³¸¦ Á¦´ë·Î ÀÔ·ÂÇÏ¼¼¿ä.");
//		frm.CC_TEL.focus();
//		return false;
//	}
//-----------------------------------------------------------------------------------------------------------------------------------

	function isPhone(str){
		if (str.search(/^(\d+)-(\d+)-(\d+)$/g)!=-1) return true;
		else return false;
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// Æ¯Á¤ÀÚ¸®¼ö¿¡ focus ÀÌµ¿ ÇÔ¼ö
// <input onKeyUp="javascript:txtFocus(4, this, document.all.txt);">
// txtFocus(Æ÷Ä¿½ºÀÌµ¿ÇÒ°ª, ÇöÀçobject, ´ÙÀ½object)
//-----------------------------------------------------------------------------------------------------------------------------------

	function txtFocus(maxnum, text, nextfocus){
		if (text.value.length == maxnum){
			nextfocus.focus();
		}
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// µå·¡±× & ¿À¸¥ÂÊ ¸¶¿ì½º ¸·±â ÇÔ¼ö
// contextmenu : ¸Þ´º, dragstart : ±Ü±â ½ÃÀÛ, selectstart : ¸¶¿ì½º±Ü±â 
//-----------------------------------------------------------------------------------------------------------------------------------

/*function window::onload(){
	document.body.oncontextmenu = function(){return false}
	document.body.onselectstart = function(){return false}
	document.body.ondragstart = function(){return false}
}*/

/*function eventBody(){
	document.attachEvent("onselectstart", rValue);
	document.attachEvent("ondragstart", rValue);
	document.attachEvent("oncontextmenu", rValue);
}
function rValue(){
	return false;
}*/


//-----------------------------------------------------------------------------------------------------------------------------------
// »õÃ¢ »çÀÌÁî ÇÔ¼ö
// uf_reSize(³ÐÀÌ, ³ôÀÌ) 
//-----------------------------------------------------------------------------------------------------------------------------------

	function uf_reSize(sizeW, sizeH){
		window.resizeTo( sizeW, sizeH );
	}

//-----------------------------------------------------------------------------------------------------------------------------------
// ÀÔ·Â°ª¿¡ ½ºÆäÀÌ½º ÀÌ¿ÜÀÇ ÀÇ¹ÌÀÖ´Â °ªÀÌ ÀÖ´ÂÁö Ã¼Å© ÇÔ¼ö
// if (isEmpty(document.form.keyword.value)) {alert("°ªÀ» ÀÔ·ÂÇÏ¼¼¿ä.");}
// isEmpty(object)
//-----------------------------------------------------------------------------------------------------------------------------------

	function isEmpty(input) {
		if (input == null || input.replace(/ /gi,"") == "") {
			return true;
		}
		return false;
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// Ã¼Å©¹Ú½º ÀüÃ¼ ¼±ÅÃ/ÇØÁ¦ ¼³Á¤ ÇÔ¼ö
// <input type="checkbox" name="chkall" onclick="toggleCheckBox(this, document.all.no)">ÀüÃ¼¼±ÅÃ
// <input type="checkbox" name="no" value="">
// toggleCheckBox(object, chkbox¸í)
//-----------------------------------------------------------------------------------------------------------------------------------

	function toggleCheckBox(chk_obj, chkbox) {
		if(chk_obj.checked){
			checkAll_FormsUtil(chkbox);
		}
		else{
			uncheckAll_FormsUtil(chkbox);
		}
	}

	/** ¸ðµç Ã¼Å©¹Ú½º¸¦ Ã¼Å©µÈ »óÅÂ·Î Ã³¸®ÇÑ´Ù.. */
	function checkAll_FormsUtil(pm_oCheck) {
		if(pm_oCheck == null) return;
		if(pm_oCheck.length) {
			for(var i=0; i < pm_oCheck.length; i++) {
				if(pm_oCheck[i].disabled == false)
					pm_oCheck[i].checked = true;
			}
			return false;
		}else {
			if(pm_oCheck.disabled == false)
				return pm_oCheck.checked = true;
			return false;
		}
	}

	/** ¸ðµç Ã¼Å©¹Ú½º¸¦ Ã¼Å©µÇÁö ¾ÊÀº »óÅÂ·Î Ã³¸®ÇÑ´Ù.. */
	function uncheckAll_FormsUtil(pm_oCheck) {
		if(pm_oCheck == null) return;
		if(pm_oCheck.length) {
			for(var i=0; i < pm_oCheck.length; i++) {
				pm_oCheck[i].checked = false;
			}
			return false;
		}else return pm_oCheck.checked = false;
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// ÇöÀç³âµµ ¼³Á¤ ÇÔ¼ö
// <select name="yy"><script>putYear(document.all.yy, '');</script></select>
// putYear(object¸í, ¼±ÅÃÇÒ³âµµ)
//-----------------------------------------------------------------------------------------------------------------------------------

	function putYear(frm, ryear){		
		var now = new Date();
		//var nowYear = now.getYear();
		var nowYear = now.getFullYear();
		var flag = false;
		nowYear += (nowYear < 2000) ? 1900 : 0;
		for(var i=nowYear-85, j=0; i<=nowYear+2; i++, j++){
			frm.options[j] = new Option(i, i);
			if(i==ryear) {
				frm.options[j].selected = true;
				flag = true;
			} 
			if (!flag){
				if (i==nowYear){
					frm.options[j].selected = true;
				}
			}
		}
	}

//-----------------------------------------------------------------------------------------------------------------------------------
// ÇöÀç¿ù ¼³Á¤ ÇÔ¼ö
// <select name="mm" onchange="putDate(document.all.dd, document.all.yy[document.all.yy.selectedIndex].value, document.all.mm[document.all.mm.selectedIndex].value, '')">
// <script>putMonth(document.all.mm, '');</script></select>
// putMonth(object¸í, ¼±ÅÃÇÒ¿ù)
//-----------------------------------------------------------------------------------------------------------------------------------

	function putMonth(frm, rmonth){	
		var now = new Date();
		var nowMonth = (rmonth=='' ? now.getMonth()+1: rmonth);
		for(var i=1, j=0; i<=12; i++, j++){
			var temp = (i<10?"0"+i:i);
			frm.options[j] = new Option(temp, temp);
			if(i==nowMonth) {
				frm.options[j].selected = true;
			}
		}
	}

//-----------------------------------------------------------------------------------------------------------------------------------
// ÇöÀçÀÏ ¼³Á¤ ÇÔ¼ö
// <select name="dd"><script>putDate(document.all.dd, '', '', '');</script></select>
// putDate(object¸í, ¼±ÅÃÇÒ³âµµ, ¼±ÅÃÇÒ¿ù, ¼±ÅÃÇÒÀÏ)
//-----------------------------------------------------------------------------------------------------------------------------------

	function putDate(frm, ryear, rmonth, rdate){	
		frm.length = 0;
		var now = new Date();
		var nowYear = (ryear=='' ? now.getYear(): ryear);;
		var nowMonth = (rmonth=='' ? now.getMonth()+1: rmonth);
		var nowDay = (rdate=='' ? now.getDate(): rdate);
		nowYear += (nowYear < 2000) ? 1900 : 0;
		for(var i=1, j=0; j<getLastDaysOfMonth(nowYear+'', nowMonth+''); i++, j++){
			var temp = (i<10?"0"+i:i);
			frm.options[j] = new Option(temp, temp);
			if(i==nowDay) {
				frm.options[j].selected = true;
			}
		}
	}

	/** À¯È¿ÇÑ(Á¸ÀçÇÏ´Â) ÀÏ(ìí)ÀÎÁö Ã¼Å©.. */
	function getLastDaysOfMonth(year, month) { 
		var DOMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];        // Non-Leap year Month days.. 
		var lDOMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];    // Leap year Month days.. 
		/* 
		Check for leap year .. 
		1.Years evenly divisible by four are normally leap years, except for... 
		2.Years also evenly divisible by 100 are not leap years, except for... 
		3.Years also evenly divisible by 400 are leap years. 
		*/ 
		if ((year % 4) == 0) {
			if ((year % 100) == 0 && (year % 400) != 0)
				return DOMonth[toInt2(month)-1];
		 
			return lDOMonth[toInt2(month)-1];
		} else 
			return DOMonth[toInt2(month)-1];
	} 

	function toInt2(str){
		while(1){
			if(str.substr(0,1)=='0') {
				str = str.substr(1,str.length)
			} else {
				break;
			}
		}
		return parseInt(str);
	}

//-----------------------------------------------------------------------------------------------------------------------------------
// ÇöÀç½Ã°£ ¼³Á¤ ÇÔ¼ö
// <select name="hh"><script>putDate(document.all.hh, '', '', '');</script></select>
// putHour(object¸í, ¼±ÅÃÇÒ½Ã°£)
//-----------------------------------------------------------------------------------------------------------------------------------
	
	function putHour(input, value){
		var text = "00";
		for(var i=0; i<=23; i++){
			if(i/10 < 1) text = "0"+i;
			else text = i;
			input.options[i] = new Option(text +'½Ã', text);
			if(text == value){
				input.options[i].selected = true;
			}
		}
	}
	

//-----------------------------------------------------------------------------------------------------------------------------------
// ÇöÀçºÐ ¼³Á¤ ÇÔ¼ö
// <select name="min"><script>putDate(document.all.min, '', '', '');</script></select>
// putHour(object¸í, ¼±ÅÃÇÒºÐ)
//-----------------------------------------------------------------------------------------------------------------------------------

	function putMin(input, value){
		var text = "00";
		/*
		for(var i=0; i<=50; i+=10){
			if(i/10 < 1) text = "0"+i;
			else text = i;
			input.options[i/10] = new Option(text +'ºÐ', text);
			if(i == value) input.options[i/10].selected = true;
		}
		*/
		for(var i=0; i<=60; i++){
			if(i/10 < 1) text = "0"+i;
			else text = i;
			input.options[i] = new Option(text +'ºÐ', text);
			if(i == value) input.options[i].selected = true;
		}
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// iframe »çÀÌÁî ÀÚµ¿Á¶Àý
//<iframe name="schedule" id="schedule" title="VTS½ºÄÉÁÙ" src="/dev/schedule_main.jsp" width="232" 
//  style="height: 1" border="0" frameborder="0" allowTransparency="true" scrolling="no" 
//  onload="js_Resize('schedule');"></iframe><noframe title="VTS½ºÄÉÁÙ">
// js_Resize(¾ÆÀÌÇÁ·¹ÀÓ¸í)
//-----------------------------------------------------------------------------------------------------------------------------------

	function js_Resize(fname){//iframe »çÀÌÁîÁ¶Àý
		if (ie){
			var Frame_Body = document.frames(fname).document.body;
		} else if (ff){
			var Frame_Body = document.getElementById(fname).contentDocument.body;
		}

		var Frame_Name = document.getElementById(fname);
		Frame_Name.style.width = Frame_Body.scrollWidth;
		Frame_Name.style.height = Frame_Body.scrollHeight;

		
	}

//-----------------------------------------------------------------------------------------------------------------------------------
// ÀÌ¸ÞÀÏ Á¤±Ô½Ä °Ë»ç
// if (isEmpty(frm.BdEmail.value) || !isEmail(frm.BdEmail.value)){
//		alert('E-Mail¸¦ Á¦´ë·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
//		frm.BdEmail.focus();
//		return false;
// }
// isEmail(object¸í)
//-----------------------------------------------------------------------------------------------------------------------------------

	function isEmail(email) {
		var fmt3 = /^[-!#$%&\'*+\\./0-9=?A-Z^_a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_a-z{|}~]+$/;
		
		if(!fmt3.test(email)) return false;
		else return true;	
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// Ã·ºÎÆÄÀÏ Æ¯Á¤È®ÀåÀÚ1 °Ë»ç
//	for (var i=1; i < fcnt; i++){
//			var FileInput = eval("frm.BfName"+ i +".value");
//			if (!isEmpty(FileInput) && isFileImg(FileInput)){
//				alert('Ã·ºÎÆÄÀÏÀº jpeg, jpg, bmp, gif¸¸ °¡´ÉÇÕ´Ï´Ù.');
//				return false;
//			}
//		}
// isFileImg(object¸í)
//-----------------------------------------------------------------------------------------------------------------------------------

	function isFileImg(Input) {
		var Ext = Input.toLowerCase(); //¼Ò¹®ÀÚ º¯È¯
		if(Ext.lastIndexOf("jpeg") == -1 && Ext.lastIndexOf("jpg") == -1 && 
			Ext.lastIndexOf("gif") == -1 && Ext.lastIndexOf("bmp") == -1) {
			return true;
		}
	}

//-----------------------------------------------------------------------------------------------------------------------------------
// Ã·ºÎÆÄÀÏ Æ¯Á¤È®ÀåÀÚ2 °Ë»ç
//	for (var i=1; i < fcnt; i++){
//			var FileInput = eval("frm.BfName"+ i +".value");
//			if (!isEmpty(FileInput) && isFileMov(FileInput)){
//				alert('Ã·ºÎÆÄÀÏÀº wmv, asf, avi, mpeg¸¸ °¡´ÉÇÕ´Ï´Ù.');
//				return false;
//			}
//		}
// isFileImg(object¸í)
//-----------------------------------------------------------------------------------------------------------------------------------

	function isFileMov(Input) {
		var Ext = Input.toLowerCase(); //¼Ò¹®ÀÚ º¯È¯
		if(Ext.lastIndexOf("wmv") == -1 && Ext.lastIndexOf("asf") == -1 && 
			Ext.lastIndexOf("avi") == -1 && Ext.lastIndexOf("mpeg") == -1) {
			return true;
		}
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// textarea ±ÛÀÚ¼ö Á¦ÇÑ
//	<textarea name="content" onfocus="javascript:ChkTextLen(this, '10');" 
//   onkeyup="javascript:ChkTextLen(this, 10);"></textarea> 
//	(<span id="wLength">0</span> / 10ÀÚ)</font>
// ChkTextLen(object¸í, Á¦ÇÑ±ÛÀÚ¼ö)
//-----------------------------------------------------------------------------------------------------------------------------------

	function ChkTextLen(Input, txtLength) {
		var txtInput = trim(Input.value);

		if (txtInput.length > txtLength){
			alert("´ñ±ÛÀÇ ³»¿ëÀº "+ txtLength +"ÀÚ±îÁö¸¸ ÀÔ·ÂÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
			Input.value = trim(Input.value).substring(0, txtLength);
			Input.focus();
			return;
		}
		document.getElementById("wLength").innerHTML = txtInput.length;
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// °ø¹é Á¦°Å(Á¤±Ô½Ä)
//	var txtInput = trim(Input.value);
// trim(object¸í)
//-----------------------------------------------------------------------------------------------------------------------------------

  function trim(str){
	  return str.replace(/(^[ \f\n\r\t]*)|([ \f\n\r\t]*$)/g, "");
  }


//-----------------------------------------------------------------------------------------------------------------------------------
// Æ¯¼ö¹®ÀÚÀÔ·Â Á¦ÇÑ (Á¤±Ô½Ä)
//if (isEmpty(frm.txtRemark.value) && !LetterChk(frm.txtRemark.value)){
//		alert("Æ¯¼ö¹®ÀÚ´Â ÀÔ·ÂÀÌ Á¦ÇÑµË´Ï´Ù");
//		event.returnValue = false;
//		frm.txtRemark.focus();
//		return false;
//	}
// LetterChk(object¸í)
//-----------------------------------------------------------------------------------------------------------------------------------

  function LetterChk(Input){
		var regMust = /[^°¡-ÆRa-zA-Z0-9¤¡-¤¾\t *\r?\n]/; //ÇÑ±Û, ¿µ¹®, ¼ýÀÚ, ÅÇÀÌ³ª °ø¹éÀ» Æ÷ÇÔÇÑ ºóÁÙ
		if (regMust.exec(Input) != null){
			return false;
		}
		return true;
  }


//-----------------------------------------------------------------------------------------------------------------------------------
// Äõ¸®½ºÆ®¸µ ÆÄ½Ì (get -> post)
//	<a href="javascript:popupVista('./test.asp?val1=1234&val2=5678', '', '')" >Äõ¸®½ºÆ®¸µÆÄ½ÌÇÏ±â</a>
// popupVista(°æ·Î, ÆË¾÷¸í, ÆË¾÷¿É¼Ç)
//-----------------------------------------------------------------------------------------------------------------------------------

	document.write("<div id=vistaDiv></div>");
	function popupVista(actionUrl, winName, popArg) {
		if ( popArg == null ) popArg = "";
			var content = "<form name=visActionForm>";
		if ( actionUrl.indexOf("?") == -1 ) {
			moveURL = actionUrl;
		} else {
			var paramSplit = actionUrl.split("?");
			moveURL = paramSplit[0];
			
			if ( paramSplit.length == 2 ) {
				getParam = paramSplit[1].split("&"); 
				
				for (var i=0; i < getParam.length; i++) {
					getElement = getParam[i].split("=");
					getElementName = (getElement[0] != null) ? getElement[0] : '';
					getElementValue = (getElement[1] != null) ? getElement[1] : '';
					content += "<input type=hidden name='" + getElementName + "' value='" + getElementValue + "'>\n";
				}
			}
		}

		content += "</form>";
		document.getElementById.vistaDiv.innerHTML = content;
		//if( winName != "_self" ) window.open("about:blank", winName, popArg); //ÆË¾÷À¸·Î º¸³¾¶§

		visActionForm.target = winName;
		visActionForm.action = moveURL;
		visActionForm.method = "post";
		visActionForm.submit();
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// ¹®ÀÚ¿­ »çÀÌ ¶ç¾î¾²±â Ã¼Å©
// if(!checkSpace(str.value)){
//		 alert("¹®ÀÚ¿­ »çÀÌ ¶ç¾î¾²±â ¾øÀÌ ÀÔ·ÂÇÏ¼¼¿ä.");
//		 return false;
//	 }
//-----------------------------------------------------------------------------------------------------------------------------------
	function checkSpace(str){
		if(str.search(/\s/) != -1){
			return false;
		} else {
			return true;
		}
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// ÇÑ±Û Ã¼Å©
// if(!isHangul(str.value)) {
//		alert("ÀÌ¸§À» ÇÑ±Û·Î ÀÔ·ÂÇÏ¼¼¿ä.");
//		return false;  
//	 }
//-----------------------------------------------------------------------------------------------------------------------------------
	function isHangul(s)	{
		var len = s.length;

		for (var i = 0; i < len; i++)  {
			if (s.charCodeAt(i) != 32 && (s.charCodeAt(i) < 44032 || s.charCodeAt(i) > 55203)){
				return false;
			}
		}
		return true;
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// ¼ýÀÚ Ã¼Å© (Á¤±Ô½Ä)
//if (!isInt(frm.memb_hp1.value)){
//		alert("ÈÞ´ëÆù ¹øÈ£¸¦ ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼¼¿ä");
//		frm.memb_hp1.focus();
//		return false;
//	}
//-----------------------------------------------------------------------------------------------------------------------------------
	function isInt(Input) {
		var regMust = /[^0-9]/; //¼ýÀÚ
		if (regMust.exec(Input) != null){
			return false;
		}
		return true;
	}







//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// È¸¿ø°ü·Ã ÇÔ¼ö
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//-----------------------------------------------------------------------------------------------------------------------------------
// ÀÌ¸§ À¯È¿¼º Ã¼Å©
// if (!validNAME(frm.memb_name)){
//		return;
//	}
//-----------------------------------------------------------------------------------------------------------------------------------

	function validNAME(str){
		 if(isEmpty(str.value)){
			 alert("ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä");
			 str.focus();
			 return false;	
		 }     
		 if(!checkSpace(str.value)){
			 alert("ÀÌ¸§Àº ¶ç¾î¾²±â ¾øÀÌ ÀÔ·ÂÇÏ¼¼¿ä.");
			 str.focus();
			 return false;
		 }
		 if(!isHangul(str.value)) {
			 alert("ÀÌ¸§À» ÇÑ±Û·Î ÀÔ·ÂÇÏ¼¼¿ä.");
			 str.focus();
			 return false;  
		 }
		 if(str.value.length > 7) {
			 alert("ÀÌ¸§Àº 7ÀÚ±îÁö¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
			 str.focus();
			 return false;
		 }
		 return true; 
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// ¾ÆÀÌµð À¯È¿¼º Ã¼Å©
// if (!validID(frm.memb_id)){
//		return;
//	}
//-----------------------------------------------------------------------------------------------------------------------------------

	function validID(str){
		var isID = /^[a-z0-9_]{4,12}$/;

		if(isEmpty(str.value)){
			alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
			str.focus();
			return false;
		}
		if(!checkSpace(str.value)) {
			alert("¾ÆÀÌµð´Â ºó °ø°£ ¾øÀÌ ¿¬¼ÓµÈ ¿µ¹® ¼Ò¹®ÀÚ¿Í ¼ýÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
			str.focus();
			return false; 
		} 
		if(str.value.charAt(0) == "_") {
			alert("¾ÆÀÌµðÀÇ Ã¹¹®ÀÚ´Â '_'·Î ½ÃÀÛÇÒ¼ö ¾ø½À´Ï´Ù.");
			str.focus();
			return false;
		}
		if(!isID.test(str.value)) {
			alert("¾ÆÀÌµð´Â 4~12ÀÚÀÇ ¿µ¹® ¼Ò¹®ÀÚ¿Í ¼ýÀÚ,Æ¯¼ö±âÈ£(_)¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
			str.focus();
			return false; 
		}
		return true;
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// ÆÐ½º¿öµå À¯È¿¼º Ã¼Å©
// if (!validPWD(frm.memb_pass)){
//		return;
//	}
//-----------------------------------------------------------------------------------------------------------------------------------

	function validPWD(str){
		 var cnt = 0;
		 var isPW = /^[a-z0-9]{6,12}$/;
		
		 if(isEmpty(str.value)){
			alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
			str.focus();
			return false;
		 }     

		/* check whether input value is included space or not  */
		if(!checkSpace(str.value)) {
			 alert("ºñ¹Ð¹øÈ£´Â ºó°ø°£ ¾øÀÌ ¿¬¼ÓµÈ ¿µ¹® ¼Ò¹®ÀÚ¿Í ¼ýÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
			 str.focus();
			 return false;
		 }
		 
		 for (var i=0; i < str.value.length; ++i) {
			 if( str.value.charAt(0) == str.value.substring( i, i+1 ) ) ++cnt;
		 }
		
		 if(cnt == str.value.length) {
			 alert("º¸¾È»óÀÇ ÀÌÀ¯·Î ÇÑ ¹®ÀÚ·Î ¿¬¼ÓµÈ ºñ¹Ð¹øÈ£´Â Çã¿ëÇÏÁö ¾Ê½À´Ï´Ù.");
			 str.focus();
			 return false; 
		 }

		 /* limitLength */
		 if(!isPW.test(str.value)) {
			 alert("ºñ¹Ð¹øÈ£´Â 6~12ÀÚÀÇ ¿µ¹® ¼Ò¹®ÀÚ¿Í ¼ýÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
			 str.focus();
			 return false; 
		 }
		 return true;
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// ÀÌ¸ÞÀÏ À¯È¿¼º Ã¼Å©
// if (!validEMAIL(frm.memb_email)){
//		return;
//	}
//-----------------------------------------------------------------------------------------------------------------------------------
	function validEMAIL(str){
		if(isEmpty(str.value)){
			alert("ÀÌ¸ÞÀÏ ÁÖ¼Ò¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
			str.focus();
			return false;
		}

		if(!checkSpace(str.value)) {
			alert("ÀÌ¸ÞÀÏ ÁÖ¼Ò¸¦ ºó°ø°£ ¾øÀÌ ³ÖÀ¸¼¼¿ä.");
			str.focus();
			return false;
		}

		/* checkFormat */
		if(!isEmail(str.value)) {
			alert("ÀÌ¸ÞÀÏ Çü½ÄÀÌ Àß¸ø µÇ¾ú½À´Ï´Ù.");
			str.focus();
			return false;
		}
		if(str.value.length > 60 ) {
			alert("ÀÌ¸ÞÀÏ ÁÖ¼Ò´Â 60ÀÚ±îÁö À¯È¿ÇÕ´Ï´Ù.");
			str.focus();
			return false;
		}
		
		/*
		if( str.lastIndexOf("daum.net") >= 0 || str.lastIndexOf("hanmail.net") >= 0 ) {
			alert("´ÙÀ½ ¸ÞÀÏ °èÁ¤Àº »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");
			document.registerFrm.email.focus();  
			return 0;
		}
		*/

		return true;
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// ÈÞ´ëÆù ±¹¹ø ÀÔ·Â ÇÔ¼ö
// <select name="memb_hp1">
//		<option>¼±ÅÃ</option>
//		<script>hpFirstNum('');</script>
// </select>
//-----------------------------------------------------------------------------------------------------------------------------------

	function hpFirstNum(pn){
		document.write("<option value='010' "+(pn=='010'? "selected":"")+">010</option>");
		document.write("<option value='011' "+(pn=='011'? "selected":"")+">011</option>");
		document.write("<option value='016' "+(pn=='016'? "selected":"")+">016</option>");
		document.write("<option value='017' "+(pn=='017'? "selected":"")+">017</option>");
		document.write("<option value='018' "+(pn=='018'? "selected":"")+">018</option>");
		document.write("<option value='019' "+(pn=='019'? "selected":"")+">019</option>");
		document.write("<option value='0130' "+(pn=='0130'? "selected":"")+">0130</option>");
		document.write("<option value='070' "+(pn=='070'? "selected":"")+">070</option>");
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// ÀüÈ­¹øÈ£ ±¹¹ø ÀÔ·Â ÇÔ¼ö
// <select name="memb_tel1">
//		<option value="">¼±ÅÃ</option>
//		<script>telFirstNum('');</script>
// </select>
//-----------------------------------------------------------------------------------------------------------------------------------

	function telFirstNum(pn){
		document.write("<option value='02' "+(pn=='02'? "selected":"")+">02</option>");
		document.write("<option value='031' "+(pn=='031'? "selected":"")+">031</option>");
		document.write("<option value='032' "+(pn=='032'? "selected":"")+">032</option>");
		document.write("<option value='033' "+(pn=='033'? "selected":"")+">033</option>");
		document.write("<option value='041' "+(pn=='041'? "selected":"")+">041</option>");
		document.write("<option value='042' "+(pn=='042'? "selected":"")+">042</option>");
		document.write("<option value='043' "+(pn=='043'? "selected":"")+">043</option>");
		document.write("<option value='051' "+(pn=='051'? "selected":"")+">051</option>");
		document.write("<option value='052' "+(pn=='052'? "selected":"")+">052</option>");
		document.write("<option value='053' "+(pn=='053'? "selected":"")+">053</option>");
		document.write("<option value='054' "+(pn=='054'? "selected":"")+">054</option>");
		document.write("<option value='055' "+(pn=='055'? "selected":"")+">055</option>");
		document.write("<option value='061' "+(pn=='061'? "selected":"")+">061</option>");
		document.write("<option value='062' "+(pn=='062'? "selected":"")+">062</option>");
		document.write("<option value='063' "+(pn=='063'? "selected":"")+">063</option>");
		document.write("<option value='064' "+(pn=='064'? "selected":"")+">064</option>");
		document.write("<option value='070' "+(pn=='070'? "selected":"")+">070</option>");

	}


//-----------------------------------------------------------------------------------------------------------------------------------
// CSS ÆÄÀÏ µ¿Àû Include 
//
// # modify_style("#a","border","1px solid #fcc"); 
// ¼¿·ºÅÍ°¡ #a ÀÎ css ¶óÀÎÀ» Ã£¾Æ¼­ ±× Áß border:1px solid #fcc ·Î ¹Ù²Û´Ù. 
// ÇØ´ç ¼¿·ºÅÍ°¡ ¾øÀ¸¸é »õ·Î¿î ¶óÀÎÀ» ¸¸µé°í, ±âÁ¸¿¡ ´Ù¸¥ °ªÀÌ ÀÖ¾úÀ¸¸é µ¤¾î¾´´Ù. 
// border ÀÌ ¾Æ´Ñ ´Ù¸¥ ½ºÅ¸ÀÏÀº À¯ÁöÇÑ´Ù. 
//
// # modify_style(".b",0,"width:500px ; height:300px"); 
// .b ÀÇ ±âÁ¸¿¡ ÁöÁ¤µÈ ½ºÅ¸ÀÏÀ» ¸ðµÎ ¾ø¾Ö°í width¿Í height¸¸À» ÁöÁ¤ÇÑ´Ù. 
//
// # modify_style("div",0,""); 
// div ¿¡ ÁöÁ¤µÈ ¸ðµç ½ºÅ¸ÀÏÀ» ¾ø¾Ø´Ù. 
//
// Âü°í) background-image -> backgroundImage
//-----------------------------------------------------------------------------------------------------------------------------------

	function modify_style(selector,property,value) { 
		var styleSheet = document.styleSheets; 
		var changed = false; 
		
		if(!styleSheet.length) { 
			var newStyle = document.createElement("style"); 
			newStyle.type = "text/css"; 
			document.getElementsByTagName("head")[0].appendChild(newStyle); 
		} 

		if(!property) 
			property = "cssText"; 

		for(var i=0, style_len=styleSheet.length ; i<style_len ; i++) { 
			var rule = styleSheet[i].cssRules?styleSheet[i].cssRules:styleSheet[i].rules;
			for(var j=0, rule_len=rule.length ; j<rule_len ; j++) {
				if(rule[j].selectorText.toLowerCase() == selector.toLowerCase()) { 
					rule[j].style[property] = value; 
					changed = true; 
				} 
			} 
		} 

		if(!changed) { 
			var style = document.styleSheets[0]; 
			if(property == "cssText") 
				var cssText = value; 
			else 
				var cssText = property + ":" + value; 

			if(style.insertRule) 
				style.insertRule(selector+"{"+cssText+"}",style.cssRules.length); 
			else if(style.addRule) 
				style.addRule(selector,cssText); 
			else return false; 
		} 
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// ÅØ½ºÆ® È®´ë/Ãà¼Ò ÇÔ¼ö
// <img src="/pijin/gongtong/zoomin.gif" alt="ÆäÀÌÁö ±Û¾¾ È®´ë" onClick="scaleFont(1)" style="cursor:pointer;">
//	<img src="/pijin/gongtong/zoomout.gif" alt="ÆäÀÌÁö ±Û¾¾ Ãà¼Ò" onClick="scaleFont(-1)" style="cursor:pointer;">
//-----------------------------------------------------------------------------------------------------------------------------------
	var fSize = 12;
	function scaleFont(n){
			fSize = fSize + n;

			var objTd = document.getElementsByTagName("td");// <td>, <TD>ÀÇ ³»¿ëÀ» ¸ðµÎ ÀÐ¾î¿È
			var objDiv = document.getElementsByTagName("div");
			var objSpan = document.getElementsByTagName("span");
			var objA = document.getElementsByTagName("a");

			for( i=0; i < objDiv.length; i++ ){
				  objDiv[i].style.fontSize = fSize + "px";
			}
			for( i=0; i < objTd.length; i++ ){
				  objTd[i].style.fontSize = fSize + "px";
			}
			for( i=0; i < objSpan.length; i++ ){
				  objSpan[i].style.fontSize = fSize + "px";
			}
			for( i=0; i < objA.length; i++ ){
				  objA[i].style.fontSize = fSize + "px";
			}
	}


//-----------------------------------------------------------------------------------------------------------------------------------
// ¹®ÀÚ¿­ ¹ÙÀÌÆ®·Î ÀÚ¸£±â ÇÔ¼ö
// <script>cutStr("±æÀÌ°¡ ±ä ¿ø·¡ÀÇ ¹®ÀÚ¿­",5)</script>
//-----------------------------------------------------------------------------------------------------------------------------------

	function cutStr(str,limit){
	  var tmpStr = str;
	  var byte_count = 0;
	  var len = str.length;
	  var dot = "";
	  
	  for(i=0; i<len; i++){
		byte_count += chr_byte(str.charAt(i)); 
		if(byte_count == limit-1){
		  if(chr_byte(str.charAt(i+1)) == 2){
			tmpStr = str.substring(0,i+1);
			//dot = "...";
		  }else {
			if(i+2 != len) //dot = "...";
			tmpStr = str.substring(0,i+2);
		  }
		  break;
		}else if(byte_count == limit){
		  if(i+1 != len) //dot = "...";
		  tmpStr = str.substring(0,i+1);
		  break;
		}
	  }
	  document.writeln(tmpStr+dot);
	  return true;
	}
	function chr_byte(chr){
	  if(escape(chr).length > 4)
		return 2;
	  else
		return 1;
	}
