//----------------- ÆË¾÷ -------------------------
function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function getRealOffsetTop(o) {
	return o ? o.offsetTop + getRealOffsetTop(o.offsetParent) : 0;
}

function getRealOffsetLeft(o) {
	return o ? o.offsetLeft + getRealOffsetLeft(o.offsetParent) : 0;
}

// ºó°ª °Ë»ç (¸Þ¼¼Áö Ãâ·Â / °ø¹éÀ» Á¦¿ÜÇÏ°í ºó°ªÀÌ¸é true ¾Æ´Ï¸é false)
function chkBlank_msg(box, msg) {
	var valid = box.value.replace(/\s/gi,"");
	if (valid=="") {
		if (!msg) msg = "ºó °ªÀÔ´Ï´Ù. °ªÀ» ÀÔ·ÂÇÏ¼¼¿ä.";
		alert(msg); box.focus();
		return true;
	}
	return false;
}

// ºó°ª °Ë»ç (¸Þ¼¼Áö Ãâ·Â / °ø¹éÀ» Á¦¿ÜÇÏÁö ¾Ê°í ºó°ªÀÌ¸é true ¾Æ´Ï¸é false)
function chkNull_msg(box, msg) {
	if (box.value=="") {
		if (!msg) msg = "ºó °ªÀÔ´Ï´Ù. °ªÀ» ÀÔ·ÂÇÏ¼¼¿ä.";
		alert(msg);
		box.focus();
		return true;
	}
	return false;
}

// ¶óµð¿À¹öÆ° Ã¼Å© (¼±ÅÃµÈ °ÍÀÌ ÀÖÀ¸¸é false ¼±ÅÃµÈ °ÍÀÌ ¾øÀ¸¸é true°ª ¸®ÅÏÇÏ°í ¸Þ¼¼Áö Ãâ·Â)
function chkRadio_msg(box, msg) {
	var cnt = 0;
	for (var i=0; i<box.length; i++) {
		if (box[i].checked) return false;
	}
	if (!msg) msg = "¼±ÅÃÇ×¸ñÀ» ÇÏ³ª ÀÌ»ó ¼±ÅÃÇÏ½Ê½Ã¿À.";
	alert(msg);
	box[0].focus();
	return true;
}


// °ø¹é(½ºÆäÀÌ½º)°Ë»ç (°ø¹éÀÌ ÀÖÀ¸¸é true ¾øÀ¸¸é false)
function chkSpace(strText) {
	return (strText.search(/\s/) != -1);
}

//¸Þ´ºÁ¡ÇÁ
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// Ã¹±ÛÀÚ ¿µ¹® °Ë»ç (Ã¹±ÛÀÚ°¡ ¿µ¹®¼Ò¹®ÀÚÀÌ¸é true ¾Æ´Ï¸é false)
function chkOnechar(strText) {
	if(strText.charAt(0).match(/[^(a-z)]/)) return false;
	return true;
}

// ¿µ¹® Çü½Ä °Ë»ç (¿µ¹®ÀÌ¸é(°ø¹éÀÎÁ¤) true ¾Æ´Ï¸é false)
function chkEng(strText) {
	for (var i=0; i<strText.length; i++) {
		if(strText.charAt(i).match(/[^(a-zA-Z\s)]/)) return false;
	}
	return true;
}

// ÇÑ±Û°Ë»ç (ÀüºÎÇÑ±ÛÀÌ¸é true ¾Æ´Ï¸é false)
function chkHangul(strText) {
	for (var i=0; i<strText.length; i++) {
		if (strText.charCodeAt(i)<0xAC00 || strText.charCodeAt(i)>0xD7A3) {
			if ((strText.charCodeAt(i)<12593 || strText.charCodeAt(i)>12643 ) && (strText.charCodeAt(i) != 32)) return false;
		}
	}
	return true;
}

// ·Î±×ÀÎ °Ë»ç
function login_check(f) {
	if (chkBlank_msg(f.id,"¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä")) return false;
	if (chkNull_msg(f.pwd,"ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä")) return false;
	return true;
}

// ·¹º§º° ·Î±×ÀÎ °Ë»ç
function login_check_level(f, level) {
	if (chkBlank_msg(f.id,"¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä")) return;
	if (chkNull_msg(f.pwd,"ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä")) return;
	f.level.value = level;
	f.submit();
}

// ÆË¾÷Ã¢ ¶ç¿ì±â
function popen(url,name,w,h,scroll,pos,res) { // (°æ·Î,ÀÌ¸§,°¡·Î,¼¼·Î,½ºÅ©·ÑÀ¯¹«,À§Ä¡,¸®»çÀÌÁî)
	if (!scroll) scroll = 1;
	if (!pos) pos = "center";
	if (!res) res = "no";

	switch (pos) {
		case 'topleft' :
			LeftPosition = 0;
			TopPosition = 0;
			break;
		case 'center' :
			LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100;
			TopPosition = (screen.height) ? (screen.height - h - 100) / 2 : 100;
			break;
		case 'bcenter' :
			if (!!(window.attachEvent && navigator.userAgent.indexOf('Opera') === -1)) { //hacked together for IE browsers
				TopPosition = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120) / 2) - (h / 2)));
				LeftPosition = window.screenLeft + ((((document.body.offsetWidth + 20) / 2) - (w / 2)));
			} else {
				TopPosition = window.screenY + (((window.outerHeight / 2) - (h / 2)));
				LeftPosition = window.screenX + (((window.outerWidth / 2) - (w / 2)));
			}
			break;
		case "random" :
			LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100;
			TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height - h) - 75)) : 100;
			break;
		default :
			LeftPosition=0;
			TopPosition=0;
			break;
	}
	var scTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop || 0;
	//url += "&scTop="+scTop;
	var settings = 'width=' + w + ',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=' + res;
	win = window.open(url,name,settings);
	if (win.focus) win.focus();
}

function pimage(strImgSrc) {
	popen(strImgSrc, 'image_view', '1', '1', '0', '1');
}

// ¿ìÆí¹øÈ£ °Ë»ö
function OpenZipcode(z) {
	var win_left = (screen.width-640)/2;
	var win_top = (screen.height-480)/2;
	zName = "/judge/zipcode.html?zip_gubun="+z
	window.open(zName,"ZipWin",'width=396,height=200,scrollbars=yes, top='+win_top+',left='+win_left+'');
}


/* ÀÌ¸ÞÀÏÁÖ¼ÒÇü½Ä Ã¼Å© */
function isEmail(str) {
	var rgEx = /([A-Za-z0-9_\-\.]+)@([A-Za-z0-9_\-\.]+)/gi;
	if(rgEx.exec(str)) {
		return true;
	}
	return false;
}


// ÄÁÆß¸Þ¼¼Áö Ãâ·Â ÈÄ ÀÌµ¿
function conf_url(msg, murl) {
	if(confirm(msg)) window.location = murl;
}


// ÆäÀÌÁö ÀÌµ¿
function go_url(url) {
	location.href = url;
}


// ´Ü¾î ¼ö Ã¼Å©
function wordCounter(field, countfield, maxlimit, msg) {
	wordcounter=0;
	var reg = /\s/;
	for (x=0;x<field.value.length;x++) {
		if(reg.test(field.value.charAt(x)) == true && reg.test(field.value.charAt(x-1)) == false) {
			wordcounter++;
		}
		if (wordcounter >= maxlimit) {
			if(msg == "") {
				alert(maxlimit + "´Ü¾î ÀÌ»ó ÀÔ·ÂÇÏ½Ç ¼ö ¾ø½À´Ï´Ù");
			}else{
				alert("¿µ¹®ÃÊ·ÏÀº" +maxlimit + "´Ü¾î ÀÌ»ó ÀÔ·ÂÇÏ½Ç ¼ö ¾ø½À´Ï´Ù");
			}
			field.value = field.value.substring(0, x);
		}else {
//			countfield.value = maxlimit - wordcounter;
			countfield.value = wordcounter;
		}
	}
}


// ÁÖ¹Î¹øÈ£ Ã¼Å©
function JuminNoCheck(f) {
	var a = new Array(),i=0, j=0, k=0;
	var jRR1 = f.jumin1; var jRR2 = f.jumin2;
	if (chkBlank_msg(jRR1,"ÁÖ¹Î¹øÈ£ ¾ÕÀÚ¸®¸¦ ÀÔ·ÂÇÏ¼¼¿ä.")) return false; if (chkBlank_msg(jRR2,"ÁÖ¹Î¹øÈ£ µÞÀÚ¸®¸¦ ÀÔ·ÂÇÏ¼¼¿ä.")) return false;
	if (jRR1.value.length != 6 || jRR2.value.length != 7)
		return alert ("ÁÖ¹Îµî·Ï¹øÈ£ ±æÀÌ°¡ ¸ÂÁö ¾ÊÀ¸¹Ç·Î, È®ÀÎÈÄ ´Ù½Ã ÀÔ·Â ¹Ù¶ø´Ï´Ù.\n\n"), jRR1.value="",jRR2.value="",jRR1.focus(), false;
	if (jRR1.value =="111111" || jRR2.value =="1111118") {
		alert("ÁÖ¹Îµî·Ï ¹øÈ£¸¦ ´Ù½Ã È®ÀÎ ÇÏ¼¼¿ä.");
		jRR1.value=""; jRR2.value=""; jRR1.focus(); return false;
	} else {
		ser = jRR1.value + "0" + jRR2.value;
		for (i=0; i < 14; i++) { a[i] = parseFloat(ser.substring(i,i+1)); }
		// ÀÚ¸´¼ö ÇÕ»ê
		j = a[0]*2+a[1]*3+a[2]*4+a[3]*5+a[4]*6+a[5]*7+a[7]*8+a[8]*9+a[9]*2+a[10]*3+a[11]*4+a[12]*5;
		j = j%11; k = 11 - j; if(k>9) k = k%10; j = a[13];
		if (j==k) {
			if (a[7]==1) sex = "³²ÀÚ"; else if (a[7]==2) sex = "¿©ÀÚ"; else if (a[7]==3) sex = "³²ÀÚ"; else if (a[7]==4) sex = "¿©ÀÚ";
			else return alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ Á¤±Ô»ó(¼ºº°)¿¡ ¸ÂÁö ¾ÊÀ¸¹Ç·Î, È®ÀÎÈÄ ´Ù½Ã ÀÔ·Â ¹Ù¶ø´Ï´Ù.\n\n"), jRR1.value="",jRR2.value="",jRR1.focus(), false;
			// »ý³â¿ùÀÏ È®ÀÎ ¹× Ã¼Å©
		} else {
			return alert ("¿Ã¹Ù¸£Áö ¾Ê´Â ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù.\n\nÈ®ÀÎÈÄ ´Ù½Ã ÀÔ·Â ¹Ù¶ø´Ï´Ù."), jRR1.value="",jRR2.value="",jRR1.focus(), false;
		}
		return true;
	}
}


// ¾ÆÀÌµð Ã¼Å©
function chkId(box) {
	var str = box.value;
	if (chkBlank_msg(box,"¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä")) return false;
	if (chkSpace(box.value)) {
		alert("¾ÆÀÌµð´Â ºó °ø°£ ¾øÀÌ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		box.focus(); box.select(); return false;
	}

//	if (!chkOnechar(box.value)) {
//		alert("¾ÆÀÌµð Ã¹±ÛÀÚ´Â ¿µ¹® ¼Ò¹®ÀÚ¸¸ °¡´ÉÇÕ´Ï´Ù.");
//		box.focus(); box.select(); return false;
//	}

	if( str.match(/[^(a-zA-Z0-9_)]/) || str.length < 4 || str.length > 12 ) {
		alert("¾ÆÀÌµð´Â 4~12ÀÚÀÇ ¿µ¹®°ú ¼ýÀÚ, '_'¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
		box.focus(); box.select(); return false;
	}
	return true;
}

// ºñ¹Ð¹øÈ£ Ã¼Å©
function chkPwd(box) {
	if (box.value.length<6 || box.value.length>12) {
		alert("ºñ¹Ð¹øÈ£´Â 6~12ÀÚÀÇ ¿µ¹®(´ë¼Ò¹®ÀÚ ±¸º°)ÀÌ³ª ¼ýÀÚ·Î ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À");
		box.select();
		return false;
	}
	return true;
}


// ÀÌ¸ÞÀÏ Çü½Ä °Ë»ç (¸ÂÀ¸¸é true Æ²¸®¸é false)
function chkEmail(box) {
	if (chkBlank_msg(box,"ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇÏ¼¼¿ä")) return false;
	if (chkSpace(box.value)) {
		alert("ÀÌ¸ÞÀÏÀº °ø¹é¾øÀÌ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		box.value = box.value.replace(/\s/gi,"");
		box.focus(); box.select(); return false;
	}
	var email_exp = /^[-!#$%&\'*+\\./0-9=?A-Z^_a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_a-z{|}~]+$/;
	if (!email_exp.test(box.value)) {
		alert("ÀÌ¸ÞÀÏ Çü½ÄÀÌ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.");
		box.focus(); box.select(); return false;
	}
	return true;
}

function chkEmail2(box1,box2) {
	if (chkBlank_msg(box1,"ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇÏ¼¼¿ä")) return false;
	if (chkBlank_msg(box2,"ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇÏ¼¼¿ä")) return false;
	if (chkSpace(box1.value)) {
		alert("ÀÌ¸ÞÀÏÀº °ø¹é¾øÀÌ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		box1.value = box1.value.replace(/\s/gi,"");
		box1.focus(); box1.select(); return false;
	}
	if (chkSpace(box2.value)) {
		alert("ÀÌ¸ÞÀÏÀº °ø¹é¾øÀÌ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		box2.value = box2.value.replace(/\s/gi,"");
		box2.focus(); box2.select(); return false;
	}
	var email_exp = /^[-!#$%&\'*+\\./0-9=?A-Z^_a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_a-z{|}~]+$/;
	if (!email_exp.test(box1.value + "@" + box2.value)) {
		alert("ÀÌ¸ÞÀÏ Çü½ÄÀÌ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.");
		box1.focus(); box1.select(); return false;
	}
	return true;
}


//----------Àü¼Û Ã¼Å© ------------------------
function submit_check() {
	if(document.check_attack.check.value == 1) {
		alert("Áö±Ý Ã³¸®ÁßÀÔ´Ï´Ù. Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿À.");
		return true;
	}
	return false;
}


//----------Àü¼Û ¿ÀÄÉÀÌ ------------------------
function submit_ok() {
	document.check_attack.check.value = 1;
}


// ÆÄÀÏ È®ÀåÀÚ ±¸ÇÏ±â
function getExt(theForm)
{
	var fname = theForm.value;
	sp_arry = fname.split(".");
	sp_einx = sp_arry.length - 1;
	sp_arry[sp_einx] = sp_arry[sp_einx].toLowerCase();

	return sp_arry[sp_einx];
}


// °Ë»ö
function chkSearch(f) {
	//if (chkBlank_msg(f.key,"°Ë»öÁ¶°ÇÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä")) return false;
	if (chkBlank_msg(f.keyword,"°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä")) return false;
	return true;
}


// ·Î±×ÀÎ °Ë»ç
function chkLogin(f) {
	if (chkBlank_msg(f.id,"¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä")) return false;
	if (chkNull_msg(f.pwd,"ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä")) return false;
	return true;
}


// SET
function setCookie( name, value , expiredays )
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() +  ";"
}

// GET
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 "";
}


var marked_row = new Array;

function tableRowsInit()
{
	var rows = document.getElementsByTagName('tr');

	for ( var i = 0; i < rows.length; i++ )
	{
		if (
			'odd' != rows[i].className.substr(0,3)
			&& 'even' != rows[i].className.substr(0,4)
			&& 'engy' != rows[i].className.substr(0,4)
			&& 'udel' != rows[i].className.substr(0,4)
		) {
			continue;
		}
		if ( navigator.appName == 'Microsoft Internet Explorer'
			&& navigator.userAgent.indexOf('MSIE 6') != -1
		) {
			// but only for IE, other browsers are handled by :hover in css
			rows[i].onmouseover = function() {
				this.className += ' hover';
			}
			rows[i].onmouseout = function() {
				this.className = this.className.replace( ' hover', '' );
			}
		}

		// ... and to mark the row on click ...
		rows[i].onmousedown = function() {
			var unique_id;
			var checkbox;

			checkbox = this.getElementsByTagName( 'input' )[0];
			if ( checkbox && checkbox.type == 'checkbox' ) {
				 unique_id = checkbox.name + checkbox.value;
			} else if ( this.id.length > 0 ) {
				 unique_id = this.id;
			} else {
				 return;
			}

			if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] ) {
				 marked_row[unique_id] = true;
			} else {
				 marked_row[unique_id] = false;
			}

			// 081219 ¿¹¿ÜÇ×¸ñ
			if('udel' != this.className.substr(0,4)) {
				if ( marked_row[unique_id] ) {
//					 this.className += ' marked';
				} else {
//					 this.className = this.className.replace(' marked', '');
				}
			}

			if ( checkbox && checkbox.disabled == false ) {
				 checkbox.checked = marked_row[unique_id];
			}
		}

		// .. and checkbox clicks
		var checkbox = rows[i].getElementsByTagName('input')[0];
		if ( checkbox && checkbox.type == "checkbox" ) {
			checkbox.onclick = function() {
				 // opera does not recognize return false;
				 this.checked = ! this.checked;
			}
		}
	}
}


// tagNameÀ¸·Î Parent Object ¾ò±â - 2007-08-25 By Hss
function findParentObjByTagName(o, tag)
{
	tag = tag.toUpperCase();
	if (typeof(o) != "object") return null;
	if (o.parentNode == null) return null;
	if (o.parentNode.tagName == "undefined") return null;
	return (o.parentNode.tagName == tag) ? o.parentNode : findParentObjByTagName(o.parentNode, tag);
}

// °Ô½Ã¹° ÀüÃ¼¼±ÅÃ
function CheckAll(o, tag)
{
	var flag = o.checked;
	var obj = findParentObjByTagName(o, tag);
	if (typeof(obj)=="object")
	{
		if (flag) {
			markAllRows(obj,o);
		} else {
			unMarkAllRows(obj);
		}
	}
}

/** from phpMyAdmin
 * marks all rows and selects its first checkbox inside the given element
 * the given element is usaly a table or a div containing the table or tables
 *
 * @param    container    DOM element
 */
function markAllRows( obj, o ) {
	var rows = obj.getElementsByTagName('tr');
	var unique_id;
	var checkbox;
	for ( var i = 1; i < rows.length; i++ )
	{
		checkbox = rows[i].getElementsByTagName( 'input' )[0];
		if(checkbox == o) continue;
		if ( checkbox && checkbox.type == 'checkbox' )
		{
			unique_id = checkbox.name + checkbox.value;
			if ( checkbox.disabled == false )
			{
				checkbox.checked = true;
				if('udel' != rows[i].className.substr(0,4)) {
					if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] )
					{
//						rows[i].className += ' marked';
						marked_row[unique_id] = true;
					}
				}
			}
		}
	}
}

/** from phpMyAdmin
 * marks all rows and selects its first checkbox inside the given element
 * the given element is usaly a table or a div containing the table or tables
 *
 * @param    container    DOM element
 */
function unMarkAllRows( obj ) {
	var rows = obj.getElementsByTagName('tr');
	var unique_id;
	var checkbox;
	for ( var i = 1; i < rows.length; i++ )
	{
		checkbox = rows[i].getElementsByTagName( 'input' )[0];
		if ( checkbox && checkbox.type == 'checkbox' )
		{
			unique_id = checkbox.name + checkbox.value;
			checkbox.checked = false;
//			rows[i].className = rows[i].className.replace(' marked', '');
			marked_row[unique_id] = false;
		}
	}
}

// 081219 Á÷ÀåÁÖ¼Ò µî·Ï ½Ã ¿ìÆí¹° ¼ö·ÉÁö°¡ ±Ù¹«Ã³¶ó¸é ÁÖ¼Ò º¯°æ
function addrChangeData() {
	var of_zip1 = $("of_zip1");
	var of_zip2 = $("of_zip2");
	var of_addr = $("of_addr");
	var of_addr2 = $("of_addr2");

	var receive1 = $("receive1");
	var receive2 = $("receive2");

	var re_zip1 = $("re_zip1");
	var re_zip2 = $("re_zip2");
	var re_addr = $("re_addr");
	var re_addr2 = $("re_addr2");

	if(receive1.checked == true) {
		re_zip1.value = of_zip1.value;
		re_zip2.value = of_zip2.value;
		re_addr.value = of_addr.value;
		re_addr2.value = of_addr2.value;
	}

	if(receive2.checked == true) {
		re_zip1.value = '';
		re_zip2.value = '';
		re_addr.value = '';
		re_addr2.value = '';
	}
}

function documentCreate(oForm) {
	window.open("", "documentWin", "width=1024, height=768, scrollbars=yes, menubar=yes, top=0, left=0, resizable=yes");

	var preMethod = oForm.method;
	var preAction = oForm.action;
	var preTarget = oForm.target;

	oForm.method = "post";
	oForm.action = "/utils/documentCreate/stage1.php";
	oForm.target = "documentWin";
	oForm.submit();

	oForm.method = preMethod;
	oForm.action = preAction;
	oForm.target = preTarget;
}

function chkCbox_msg(box, msg) {
	var obj = document.getElementsByName(box);
	for(var i=0; i<obj.length; i++) {
		if(obj[i].checked == true) break;
	}

	if(i == obj.length) {
		if (!msg) msg = "¼±ÅÃµÈ Ç×¸ñÀÌ ¾ø½À´Ï´Ù";
		alert(msg);
		return true;
	}
	return false;
}

//¼±ÅÃÇÑ °ªÀ» ¸®ÅÏ isQuot = '(ÇÑµû¿ÈÇ¥) ¸¦ ºÙÈú Áö ¿©ºÎ
function getSelectedValue(box, isQuot) {
	var rtnValue = "";
	var obj = document.getElementsByName(box);
	for(var i=0; i<obj.length; i++) {
		if(obj[i].checked == true) {
			if (isQuot == true) {
				rtnValue += (rtnValue == "") ? "'" + obj[i].value + "'": ", '" + obj[i].value + "'";
			}
			else{
				rtnValue += (rtnValue == "") ? obj[i].value: ", " + obj[i].value;
			}
		}
	}
	return rtnValue;
}

// ÆûÀÇ text¿Í select ¸¦ ¾ø¾Ø´Ù.
function resetForm(oForm, oChecked)
{
	for(var i=0; i<oForm.elements.length; i++)
	{
		if(typeof(oForm.elements[i].type) != "undefined")
		{
			switch (oForm.elements[i].type.toLowerCase())
			{
				case "text": oForm.elements[i].value = "";
				break;
				case "select-one": oForm.elements[i].options[0].selected = true;
				break;
				case "checkbox": oForm.elements[i].checked = oChecked;
				break;
			}
		}
	}
}

function member_address_print(oForm) {
	window.open('', 'member_address_print_win', 'width=800,height=650,scrollbars=yes,resizable=yes,menubar=yes');
	var preMethod = oForm.method;
	var preAction = oForm.action;
	var preTarget = oForm.target;
	oForm.method = "post";
	oForm.action = "/utils/address_print/member_address_print_form.php";
	oForm.target = "member_address_print_win";
	oForm.submit();
	oForm.method = preMethod;
	oForm.action = preAction;
	oForm.target = preTarget;
}

function pdf_create(oForm) {
	window.open('', 'pdf_create_win', 'width=800,height=600,scrollbars=yes,resizable=yes,menubar=no');
	var preMethod = oForm.method;
	var preAction = oForm.action;
	var preTarget = oForm.target;
	oForm.method = "post";
	oForm.action = "/utils/FPDF/pdf_create.php";
	oForm.target = "pdf_create_win";
	oForm.submit();
	oForm.method = preMethod;
	oForm.action = preAction;
	oForm.target = preTarget;
}

function viewInfo(targetDir) {
	if(event.ctrlKey) {
		window.open('/common/newFrame.php?src=' + escape(targetDir), '', 'width=800, height=600, fullscreen=yes');
		return false;
	}
	else if(event.altKey) {
		window.open(targetDir, '', 'width=960, height=600, toolbar=yes, titlebar=yes, status=yes, menubar=yes, location=yes');
	}
	else{
		window.open('/common/newFrame.php?src=' + escape(targetDir), '', 'width=800, height=600, resizable=no');
	}
}

function getNumberFormat(strValue) {
	var objRegExp = new RegExp('(-?[0-9]+)([0-9]{3})');
	while(objRegExp.test(strValue))
	{
		strValue = strValue.replace(objRegExp, '$1,$2');
	}
	return strValue;
}

function number_format(input) {
	var input = String(input);
	var reg = /(\-?\d+)(\d{3})($|\.\d+)/;
	if(reg.test(input)){
		return input.replace(reg, function(str, p1,p2,p3){
				return number_format(p1) + "," + p2 + "" + p3;
			}
		);
	}else{
		return input;
	}
}

function showHideObj(obj) {
	if( obj.style.display == '' ) {
		obj.style.display = 'none';
	}
	else{
		obj.style.display = '';
	}
}

// ----------- 2008-12-30 ¹ÚÀçÈ¯ Ãß°¡ (textareaÀÇ ¿øÇÏ´Â À§Ä¡¿¡ ¿øÇÏ´Â ¹®ÀÚ Ãß°¡ÇÏ±â) --------- //
function storeCaret (textel){
	if (textel.createTextRange){
		textel.caretPos = document.selection.createRange().duplicate();
	}
}

//------------------------ ÀüÃ¼Ã¼Å© ----------------------------
function AllCheck(obj, name)
{
	var multi = eval("document.getElementsByName('"+name+"[]')");

	for( var i=0; i<multi.length; i++)
	{
		var check = multi[i];
		if (obj.checked)
		{
			check.checked = check.getAttribute('memo') == null ? true : false;
		}else{
			check.checked = false;
		}
	}
	return;
}
