function GetID(id) {
    if(document.getElementById && document.getElementById(id)) {
        // W3C Netscape 6일경우 
         rtn_id = document.getElementById(id);
    } else if (document.all && document.all(id)) {
        // MSIE 4 일경우
         rtn_id = document.all(id);
    } else if (document.layers && document.layers[id]) {
        // NN 4 일경우
         rtn_id = document.layers[id];
    }else{
		return false;
    }
	return rtn_id;
}
function OpenerGetID(id) {
    if(opener.document.getElementById && opener.document.getElementById(id)) {
        // W3C Netscape 6일경우 
         rtn_id = opener.document.getElementById(id);
    } else if (opener.document.all && opener.document.all(id)) {
        // MSIE 4 일경우
         rtn_id = opener.document.all(id);
    } else if (opener.document.layers && opener.document.layers[id]) {
        // NN 4 일경우
         rtn_id = opener.document.layers[id];
    }else{
		return false;
    }
	return rtn_id;
}

function ParentGetID(id) {
    if(parent.document.getElementById && parent.document.getElementById(id)) {
        // W3C Netscape 6일경우 
         rtn_id = parent.document.getElementById(id);
    } else if (parent.document.all && parent.document.all(id)) {
        // MSIE 4 일경우
         rtn_id = document.all(id);
    } else if (parent.document.layers && parent.document.layers[id]) {
        // NN 4 일경우
         rtn_id = parent.document.layers[id];
    }else{
		return false;
    }
	return rtn_id;
}

/**********************************************************
테이블 둥글게
phpschool 행복한 고니님 스크립트
http://phpschool.com/bbs2/inc_view.html?id=9751&code=tnt2&start=0&mode=search&field=title&search_name=&operator=and&period=last1year&category_id=11&s_que=%C5%D7%C0%CC%BA%ED
<table id="ta" width="300" height="150" border="0" radius="3" rborder="#999999" rbgcolor="#F8F8F8">

<script>roundTable("ta");</script>

**********************************************************/
function roundTable(objID) {
	var obj = document.getElementById(objID);
    var Parent, objTmp, Table, TBody, TR, TD;
	var bdcolor, bgcolor, Space;
	var trIDX, tdIDX, MAX;
	var styleWidth, styleHeight;

	radius = parseInt(obj.getAttribute('radius'));
	parentObj = obj.parentElement;
	if(obj.width == "100%") 
	{
		obj.style.width = obj.offsetWidth - (radius*2.3);
	}
	
	// get parent node
	Parent = obj.parentNode;
	objTmp = document.createElement('SPAN');
	Parent.insertBefore(objTmp, obj);
	Parent.removeChild(obj);

	// get attribute
	bdcolor = obj.getAttribute('rborder');
	bgcolor = obj.getAttribute('rbgcolor');
	radius = parseInt(obj.getAttribute('radius'));


	
	
	if (radius == null || radius < 1) radius = 1;
	else if (radius > 6) radius = 6;

	MAX = radius * 2 + 1;
	
	/*
		create table {{
	*/
	Table = document.createElement('TABLE');
	TBody = document.createElement('TBODY');

	Table.cellSpacing = 0;
	Table.cellPadding = 0;

	for (trIDX=0; trIDX < MAX; trIDX++) {
		TR = document.createElement('TR');
		Space = Math.abs(trIDX - parseInt(radius));
		for (tdIDX=0; tdIDX < MAX; tdIDX++) {
			TD = document.createElement('TD');
			
			styleWidth = '1px'; styleHeight = '1px';
			if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
			else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
			else if (radius > 2) {
				if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
				if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
			}

			if (styleWidth != null) TD.style.width = styleWidth;
			if (styleHeight != null) TD.style.height = styleHeight;

			if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
			else if (tdIDX > Space && Space < MAX - tdIDX - 1)  TD.style.backgroundColor = bgcolor;
			
			if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
			TR.appendChild(TD);
		}
		TBody.appendChild(TR);
	}

	/*
		}}
	*/

	Table.appendChild(TBody);
	
	// insert table and remove original table
	Parent.insertBefore(Table, objTmp);
}

var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);

function getRef(id) {
    if (isDOM) return document.getElementById(id);
    if (isIE4) return document.all[id];
    if (isNS4) return document.layers[id];
}

var isNS = navigator.appName == "Netscape";

var arr_mousexy = new Array();
document.onmousemove=GetMouseXY;

function GetMouseXY(e){
	var x;
	var y;
	x=(isNS4)?e.pageX:event.x+document.body.scrollLeft;
	y=(isNS4)?e.pageY:event.y+document.body.scrollTop;
	arr_mousexy["x"] = x;
	arr_mousexy["y"] = y;
}

function MoveSubNavi() {
    var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;
    if (isNS4) {
        yMenuFrom   = subnavi.top;
        yMenuTo     = windows.pageYOffset+10;
    } else if (isDOM) {
        yMenuFrom   = parseInt (subnavi.style.top, 10);
        yMenuTo     = (isNS ? window.pageYOffset : document.body.scrollTop)+10;
    }
    if(yMenuTo<230) yMenuTo = 230;

    timeoutNextCheck = 500;

    if (yMenuFrom != yMenuTo) {
        yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 10);
        if (yMenuTo < yMenuFrom) {yOffset = -yOffset};
        if (isNS4) {subnavi.top += yOffset;}
        else if (isDOM){ subnavi.style.top = parseInt(subnavi.style.top, 10) + yOffset;}
        timeoutNextCheck = 10;
    }
    setTimeout ("MoveSubNavi()", timeoutNextCheck);
}

function GoScrollTop() {
    document.body.scrollTop = 0;
}


//쿠키저장
function setCookie(name, value,expire,path) 
{ 
	path = (!path)?"/":path;	
	var todayDate = new Date();
	unixtime = todayDate.getTime();
	if (value==null) {
		expire = 0;
	}
	if (expire != null) {
		extime = unixtime+(expire*1000);
		todayDate.setTime(extime);
		expiretime =  " expires=" + todayDate.toUTCString() +";";	
	}else{
		expiretime = "";	
	}
	document.cookie = name + "=" + escape(value) + "; path="+path+";"+expiretime;	
}
//쿠키불러오기
function getCookie(name) { 
	var Found = false 
	var start, end 
	var i = 0 ;
	// cookie 문자열 전체를 검색 
	while(i <= document.cookie.length) { 
		 start = i 
		 end = start + name.length 
		 // name과 동일한 문자가 있다면 
		 if(document.cookie.substring(start, end) == name) { 
			 Found = true 
			 break;
		 } 
		 i++ 
	} 
	
	// name 문자열을 cookie에서 찾았다면 
	if(Found == true) { 
		start = end + 1 
		end = document.cookie.indexOf(";", start) 
		// 마지막 부분이라는 것을 의미(마지막에는 ";"가 없다) 
		if(end < start) 
			end = document.cookie.length 
		// name에 해당하는 value값을 추출하여 리턴한다. 
		
		 return document.cookie.substring(start, end) 
	} 
	// 찾지 못했다면 
	return "" 
} 


function ChkAllList(chk,itm){
	frmname = chk.form.name;
	_listbid = eval("document."+frmname+"[\""+itm+"[]\"]");
	if(!_listbid) 
	{
		return false;
	}
    if(_listbid.length) 
    {
    	for(i=0; i<_listbid.length; i++) 
    	{
    		if (chk.checked == true)
    		{
				_listbid[i].checked = true;
    		}else{
				_listbid[i].checked = false;
			}
    	}
    }else{
		if (chk.checked == true)
		{
			_listbid.checked = true;
		}else{
			_listbid.checked = false;
		}
	}
}

if (document.layers){
var wb = 'ns4';
}
else if (document.all){
var wb = 'ie';
}
else if (document.getElementById){
var wb = 'ns6';
}

//숫자,알파벳만//////////////////////////////////////////////
function ChkAlNum(val) {
	var valid = "abcdefghijklmnopqrstuvwxyz0123456789"
	var ok = "yes";
	var temp;
	for (var i=0; i<val.length; i++) {
		temp = "" + val.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") {
		return false;
	}else{
		return true;
	}
}


//특수문자 검사//////////////////////////////////////////////
function ChkSpecialChars(val) {
	var mikExp = /[$\@\#%^&*()[]+_{}`~=|]/;
	var strPass = val;
	var strLength = strPass.length;
	for (i = 0;i<strLength ;i++ ) {
		var lchar = val.charAt(i);
		if(lchar.search(mikExp) != -1) {
			return false
		}	
	}
	return true
}


//공백체크////////////////////////////////////////////////////
function ChkSpace(strValue) {
	if (strValue.indexOf(" ")>=0) {
		return true;
	}else {
		return false;
	}
}
//한글체크////////////////////////////////////////////////////
function ChkHan(strValue) {
	ishan = 0;
	for(i=0;i<strValue.length;i++) {
	var a=strValue.charCodeAt(i);
		if (a <= 128) {
			ishan = 1
		}
	}
	if (ishan == 0) {
		return true
	}else{
		return false	
	}
}
//숫자체크////////////////////////////////////////////////////
function ChkNum(x){ 
    var x;
    var anum=/(^\d+$)|(^\d+\.\d+$)/ 
    if (anum.test(x)) 
        return true;
    else{ 
        return false;
    }
}

//주민등록번호체크//////////////////////////////////////////
function ChkJumin(str_jumin1,str_jumin2) { 
    errfound = false; 
    var str_jumin1;
    var str_jumin2;
    var checkImg=''; 

    var i3=0 
    for (var i=0;i<str_jumin1.length;i++) { 
        var ch1 = str_jumin1.substring(i,i+1); 
        if (ch1<'0' || ch1>'9') { i3=i3+1 } 
    } 
    if ((str_jumin1 == '') || ( i3 != 0 )) { 
        return false;
    } 

    var i4=0 
    for (var i=0;i<str_jumin2.length;i++) { 
        var ch1 = str_jumin2.substring(i,i+1); 
        if (ch1<'0' || ch1>'9') { i4=i4+1 } 
    } 
    if ((str_jumin2 == '') || ( i4 != 0 )) {
      return false;
    } 

    if(str_jumin1.substring(0,1) < 4) { 
        return false;
    } 

    if(str_jumin2.substring(0,1) > 2) { 
        return false;
    } 

    if((str_jumin1.length > 7) || (str_jumin2.length > 8)) { 
        return false;
    } 

    if ((str_jumin1 == '72') || ( str_jumin2 == '18')) { 
      return false;
    } 
     
    var f1=str_jumin1.substring(0,1) 
    var f2=str_jumin1.substring(1,2) 
    var f3=str_jumin1.substring(2,3) 
    var f4=str_jumin1.substring(3,4) 
    var f5=str_jumin1.substring(4,5) 
    var f6=str_jumin1.substring(5,6) 
    var hap=f1*2+f2*3+f3*4+f4*5+f5*6+f6*7 
    var l1=str_jumin2.substring(0,1) 
    var l2=str_jumin2.substring(1,2) 
    var l3=str_jumin2.substring(2,3) 
    var l4=str_jumin2.substring(3,4) 
    var l5=str_jumin2.substring(4,5) 
    var l6=str_jumin2.substring(5,6) 
    var l7=str_jumin2.substring(6,7) 
    hap=hap+l1*8+l2*9+l3*2+l4*3+l5*4+l6*5 
    hap=hap%11 
    hap=11-hap 
    hap=hap%10 
    if (hap != l7) { 
      return false;
    }     
       
    var i9=0 

    if (!errfound) 
        return true;
} 
//이메일체크/////////////////////////////////////////
function ChkMail(strValue) {
	if(ChkSpace(strValue)){
		//alert ("E메일 주소에서 공란을 빼주십시오");
		return false;
	}else	if (strValue.indexOf("/")!=-1 || strValue.indexOf(";") !=-1 || ChkHan(strValue)) {
		//alert("E-Mail형식이 잘못되었습니다.\n  다시한번 확인바랍니다.");
		return false;
	}else	if ((strValue.length != 0) && (strValue.search(/(\S+)@(\S+)\.(\S+)/) == -1)) {
		//alert("E-Mail형식이 잘못되었습니다..\n  다시한번 확인바랍니다.");
		return false;
	}else if(strValue == '') {
		return false;
	}else{ 
		return true;
	}
}

function trim (strSource) {
re = /^\s+|\s+$/g;
return strSource.replace(re, '');
}

// 검색어
function ChkSrch(frm){
	srch = frm.srch;
	if (trim(srch.value) == '')
	{
		alert("검색어를 입력하세요.");
		srch.value = '';
		return false;
	}
	return true;
}

//폼내의 숫자 3자리마다 컴마찍기//////////////////////////

function NumFormat(number) {
    number = '' + number;
    if (number.length > 3) {
        var mod = number.length % 3;
        var output = (mod > 0 ? (number.substring(0,mod)) : '');
        for (i=0 ; i < Math.floor(number.length / 3); i++) {
            if ((mod == 0) && (i == 0)){
                output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
            }else{
                output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);
            }
        }
        return (output);
    }else {
        return number;
    }
}

// 숫자(가격등) 콤마 제거
function FilterNum(str) { 
    re = /^\$|,/g; 
    // "$" and "," 입력 제거 
    return str.replace(re, "");
} 


//trim//////////////////////////////////////////////////
/*
function trim(ment){	

	var start;
	var end;
	for(i=0;i<ment.length;i++){
		mentcnt = ment.substring(i,i+1);
		if (mentcnt  !=  ' '){
			start=i;
			break;
		}
	}
	
	for(i=ment.length - 1;i  >  -1; i--){
		mentcnt = ment.substring(i,i+1);
		if (mentcnt != ' ') {
			end=i;
			break
		}
	}
	
	str = ment.substring(start,end+1);

	if (str == ' ')
	{
		str = '';
	}
	return str;
}
*/
// 콤마 넣기
function SetComma(frm,rtntype) {
	
	var rtn = "";
	var val = "";
	var pval = "";
	var j = 0;
	var x;
	
	
	if(rtntype == 'frm') 
	{
		x = frm.value.length;
		pval = frm.value;
	}else 
	{
		frm = ""+frm;
		x = frm.length;
		pval = frm;
	}
	
	
	for(i=x; i>0; i--) {
		if(pval.substring(i,i-1) != ",") {
			val = pval.substring(i,i-1)+val;
		}
	}
	
	x = val.length;
	for(i=x; i>0; i--) {
		if(j%3 == 0 && j!=0) {
			rtn = val.substring(i,i-1)+","+rtn;	
		}else {
			rtn = val.substring(i,i-1)+rtn;
		}
		j++;
	}
	if(rtntype == 'frm') 
	{
		frm.value = rtn;
	}else 
	{
		return rtn;
	}
}

// 콤마 삭제
function StripComma(frm){
	var val='';
	x = frm.length;
	for(i=x; i>0; i--) {
		if(frm.substring(i,i-1) != ",") {
			val = frm.substring(i,i-1)+val;
		}
	}
	return val;
}

/** 
* 키보드로 셀렉트박스 탐색하기 
* 
* by 행복한고니 ( http://mygony.com) 
* 20051117 
* 
* 소스를 불러온 뒤 SboxKeySearch(원하는오브젝트) 를 사용한다. 
* 원하는 오브젝트를 생략하면 모든 셀렉트박스에 적용된다. 
* http://mygony.com/tt/index.php?pl=229
*/ 
var SboxKeySearch = function(obj) 
{ 
    // for all select box 
    if (typeof(obj) == "undefined" || obj == null) { 
        var objs = document.getElementsByTagName("select"); 

        for (var i=0; i<objs.length; i++) { 
            new SboxKeySearch(objs[i]); 
        } 
        return; 
    } 

    try { 
        obj.attachEvent("onkeydown", SboxKeySearch.keyHook); 
    } catch(e) { 
        try { 
            obj.addEventListener("keydown", SboxKeySearch.keyHook, false); 
        } catch(ee) { 
            return; 
        } 
    } finally { 
        obj.keySearchObject = this; 
    } 
} 
SboxKeySearch.keyHook = function(oEvent) 
{ 
    var target = oEvent.srcElement || oEvent.target; 
    var sindex = target.selectedIndex+1; 
    var code  = 0; 

    if (oEvent.keyCode < 32 || oEvent.keyCode > 128) return; 

    for (var i=sindex; i < target.options.length; i++) { 
        code = SboxKeySearch.getCode(target.options[i].text); 
        if (oEvent.keyCode == code || oEvent.keyCode == code-1000) { 
            target.selectedIndex = i; 
            return; 
        } 
    } 

    for (i=0; i < sindex; i++) { 
        code = SboxKeySearch.getCode(target.options[i].text); 
        if (oEvent.keyCode == code || oEvent.keyCode == code-1000) { 
            target.selectedIndex = i; 
            return; 
        } 
    } 
} 
SboxKeySearch.layout = { 
0:82,2:83,3:69,5:70,6:65,7:81,9:84,11:68,12:87,14:67,15:90,16:88,17:86,18:71, 
8:81,13:87,4:69,1:82,10:84 
} 
SboxKeySearch.getCode = function(txt) { 
    var layout = SboxKeySearch.layout; 
    var ch = txt.charCodeAt(0); 

    // english or number? 
    if (ch < 128) return ch; 

    // only jaum (12593 <= ch <= 12622) 
    if (ch > 12592 && ch < 12623) return SboxKeySearch.jaumCode(ch); 

    ch -= 44032; 
    if (ch < 0 || ch > 11171) return 0; 
    ch = Math.floor(Math.floor(ch/28)/21); 

    return layout[ch]; 
} 
SboxKeySearch.jaumCode = function(jaum) { 
    var conv = {0:0,3:2,6:3,8:5,16:6,17:7,20:9,22:11,23:12, 
    25:14,26:15,27:16,28:17,29:18,18:8,24:13,7:4,1:1,21:10}; 

    return conv[jaum-12593]; 
}
/************************************************
http://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=15770&sca=&sfl=wr_name%7C%7Csubject&stx=%B0%C5%C4%A3%B8%B6%B7%E7&sop=and&page=2
loadData.php code:

$trigger = $_GET['trigger'];
$target = $_GET['target'];
$form = $_GET['form'];
// 이쯤에서 db 처리해주고....

header("Content-Type: application/x-javascript");	// 요거 자바스크립트로 만들어주는거 (없어도 된단 말도 있고..)

echo "document.forms['$form'].elements['$target'].length = 10; \n";	// db에서 가져온 값이 10개라면 이렇단 소리야..
for ($i=0; $i < 10; $i++) {
	echo "document.forms['$form'].elements['$target'].options[$i].text = '$trigger 의 $i 번째 옵션입니다'; \n";
	echo "document.forms['$form'].elements['$target'].options[$i].value = 'v$i'; \n";
}
************************************************/
function loadData(sel,target) {
	var trigger = sel.options[sel.selectedIndex].text;	// 첫번째 selectbox의 선택된 텍스트
	var form = sel.form.name;
	dynamic.src = "loadData.php?form=" + form + "&trigger=" + trigger + "&target=" + target;
}



var contentfont_default = parseInt(12,10);
var contentlineheight;
function SetFontSize(n) {
		
	content = GetID("brd_content");
	try{
		contentfont_id = document.all["contentfont"];
	}catch(e){
	}

	contentfont_default = parseInt(contentfont_default,10);
	contentlineheight = parseInt(contentlineheight,10);
	title = document.all.brd_title;
	if(n == 1) {
		if(contentfont_default < 24) 
		{
			contentfont_default = contentfont_default+2;
			contentlineheight = contentfont_default*1.5;
		}
	}else if(n == -1) {
		if(contentfont_default >= 12) {
			contentfont_default = contentfont_default-2;	
			contentlineheight = contentfont_default*1.5;
		}else 
		{
			contentfont_default = contentfont_default;
			contentlineheight = contentlineheight;
		}
	}else {
		contentfont_default = 12;
		contentlineheight = 18;
	}
	if(contentfont_default == 0) 
	{
		contentfont_default = 12;
		contentlineheight = 18;
	}

	_contentfont_default = contentfont_default;
	_contentlineheight = contentlineheight;
	
	content.style.fontSize = _contentfont_default + "px";
	content.style.lineHeight = _contentlineheight + "px";
//		title.style.fontSize = contentfont + "px";
//		title.style.lineHeight = contentlineheight + "px";
	d = 0;
	try{
		x = contentfont_id.length;
		for(i=0;i<x;i++){
			try{
				if(typeof contentfont_id[i].style.size == "undefined")
				{
					contentfont_id[i].style.size = 12;
				}
				tfsize = contentfont_default;
				lh = tfsize+5;
				if(contentfont_id[i].style.size >= 12 && contentfont_id[i].style.size <24 && tfsize >= 12) 
				{
					/*
					if(d == 0) 
					{
						alert(tfsize);
						d = 1;
					}
					*/
					contentfont_id[i].style.fontSize =  tfsize + "px";
					contentfont_id[i].style.lineHeight =  lh+"px";
				}
				content.style.lineHeight = lh+"px";
			}catch(e){
				
			}
		}
		
		content.style.lineHeight = lh+"px";
	}catch(e){
		
	}

	try{
		x = replcontentfont_id.length;
		for(i=0;i<x;i++){
			try{
				tfsize = eval(replcontentfont_id[i].size) + replcontentfont;
				replcontentfont_id[i].style.fontSize =  tfsize + "px";
			}catch(e){
				alert("3");
			}
		}
	}catch(e){
//					alert("4");
	}

}


function DocRitActiveX(contents)
{
	document.write(contents);
}

//폼내 객체 스타일클래스 정의
function SetFormStyle(frmname) 
{
	if(frmname == '') 
	{
		return false;
	}
	frm = eval("document."+frmname);
	if(!frm) 
	{
		return false;
	}
	el = frm.elements;
	
	for(i=0; i<frm.elements.length; i++) 
	{
		if(el[i].getAttribute("TYPE") == 'text') 
		{
			if(el[i].className == '') 
			{
				el[i].className = "input_text";
			}
		}else if(el[i].getAttribute("TYPE") == 'password') 
		{
			if(el[i].className == '') 
			{
				el[i].className = "input_password";
			}
		}else if(el[i].getAttribute("TYPE") == 'button' || el[i].getAttribute("TYPE") == 'submit') 
		{
			if(el[i].className == '')
			{
				el[i].className = "input_button";
			}
		}else if(el[i].getAttribute("TYPE") == 'checkbox')
		{
			if(isIE4 == false)
			{
				el_html = trim(el[i].outerHTML).substring(0,trim(el[i].outerHTML).length-1)+" onfocus=\"blur()\">";
				el[i].outerHTML = el_html;
			}else 
			{
				el[i].setAttribute("onfocus","blur()");
			}
			
			if(el[i].className == '') 
			{
				el[i].className = "input_checkbox";
			}
		}else if(el[i].getAttribute("TYPE") == 'radio')
		{
			if(isIE4 == false) 
			{
				el_html = trim(el[i].outerHTML).substring(0,trim(el[i].outerHTML).length-1)+" onfocus=\"blur()\">";
				el[i].outerHTML = el_html;
			}else 
			{
				el[i].setAttribute("onfocus","blur()");
			}
			if(el[i].className == '') 
			{
				el[i].className = "input_checkbox";
			}
		}else if(el[i].tagName == "SELECT") 
		{
			if(el[i].className == '')
			{
				el[i].className = "input_select";
			}
		}else if(el[i].tagName == "TEXTAREA") 
		{
			if(el[i].className == '')
			{
				el[i].className = "input_textarea";
			}
		}else if(el[i].getAttribute("TYPE") == 'file')
		{
			if(el[i].className == '')
			{
				el[i].className = "input_file";
			}
		}
	}
}

function SetTestValue(frmname) 
{
	if(frmname == '') 
	{
		return false;
	}
	frm = eval("document."+frmname);
	if(!frm) 
	{
		return false;
	}
	el = frm.elements;
	
	for(i=0; i<frm.elements.length; i++) 
	{
		if(el[i].getAttribute("TYPE") == 'text') 
		{
			if(el[i].value == '' && el[i].getAttribute("HNAME") != null) 
			{
				el[i].value = el[i].getAttribute("HNAME");
			}
		}
	}
}

function ChkLenChngFocus(obj) 
{
	frm = obj.form;
	if(obj.value.length == obj.getAttribute("MAXINPUT")) 
	{
		nf = obj.getAttribute("NEXTFOCUS")
		eval("document."+frm.name+"."+nf+".focus()");
	}
}
function ChkJuminKeyup(obj,jumin1) 
{
	frm = obj.form;
    
	if(jumin1) 
	{
		if(obj.value.length == 7) 
		{
			jumin1 = eval("document."+frm.name+"."+jumin1);
			if(ChkJumin(jumin1.value,obj.value) == false) 
			{
				alert("올바른 주민번호가 아닙니다.");
				obj.value = "";
				jumin1.value = "";
				return false;
			}
		}
	}else 
	{
		if(obj.value.length == 13 || obj.value.length == 14) 
		{
			var pattern = /^[0-9]$/;
			if(obj.value.length == 13 && pattern.test(obj.value.substring(6,7))) 
			{
				st1 = 0;
				ed1 = 6;
				st2 = 6;
				ed2 = 7
			}else 
			{
				st1 = 0;
				ed1 = 6;
				st2 = 7;
				ed2 = 7;
			}
			jumin1 = obj.value.substring(0,6);
			jumin2 = obj.value.substring(st2);
			if(ChkJumin(jumin1,jumin2) == false) 
			{
				alert("올바른 주민번호가 아닙니다."+jumin1+" - "+jumin2);
//				obj.value = "";
				return false;
			}
		}
	}
}


function PopZipcode(frm,inputname,addr1,jspath)
{
	win = new Object();
    win.popname = "zipcode";
    win.ismodal = 0;
    win.width = 462;
    win.height = 400;
    win.center = 1;
    win.status = 1;
    win.resize = 1;
    win.scroll = 0;
	jspath = jspath?jspath:"/modules/"
    ispop = openWindow(jspath+"zipcode.html?frm="+frm+"&inputname="+inputname+"&addr1="+addr1,win);
}

function PopZipcodeOrder(idx)
{
	win = new Object();
    win.popname = "zipcode";
    win.ismodal = 0;
    win.width = 462;
    win.height = 400;
    win.center = 1;
    win.status = 1;
    win.resize = 1;
    win.scroll = 0;
	jspath = "/modules/";
    ispop = openWindow(jspath+"zipcode_order.html?idx="+idx,win);
}

/************************************************
퍼센트
************************************************/
function GetPercent(val,total) 
{
	return Math.ceil((val/total)*100);
}
/************************************************
전체 값에서 퍼센트에 해당하는 값을 뺀 값
************************************************/
function GetDepercentRemain(per,total) 
{
	return Math.ceil(total-((per/100)*total));
}

/************************************************
퍼센트에 해당하는 값
************************************************/
function GetDepercent(per,total) 
{
	return Math.ceil((per/100)*total);
}

/************************************************
전체 값
************************************************/
function GetTotalPercent(per,val) 
{
	return Math.ceil((val/per)*100);
}


function SetTelFormat(obj)
{
	val = obj.value;
	if(val.length < 8) 
	{
		obj.value = "";
		obj.focus();
		alert("올바른 전화번호를 입력하세요.");
		return false;
	}
	str = "";
	for(i=0; i<val.length; i++) 
	{
		
		_val = val.substring(i,i+1);
		if(_val.search(/[0-9]/) == false) 
		{
			str = str+_val;
		}
	}

	if(str.length == 8) 
	{
		var pattern15xx = /^(1544|1566|1577|1588|1644|1688)-?([0-9]{4})$/;
		if(!pattern15xx.exec(str)) 
		{
			obj.value = "";
			obj.focus();
			alert("올바른 전화번호를 입력하세요.");
			return false;
		}
		obj.value = str.substring(0,4)+"-"+str.substring(4);
		return true;
	}
	mobilepattern = /^(01[016-9])/
	if(mobilepattern.exec(str)) 
	{
		var pattern = /^(01[016-9])-?([1-9]{1}[0-9]{2,3})-?([0-9]{4})$/;
		if(!pattern.exec(str)) 
		{
			obj.value = "";
			obj.focus();
			alert("올바른 휴대전화번호를 입력하세요.");
			return false;
		}
		if(str.length == 11) 
		{
			obj.value = str.substring(0,3)+"-"+str.substring(3,7)+"-"+str.substring(7);
		}else 
		{
			obj.value = str.substring(0,3)+"-"+str.substring(3,6)+"-"+str.substring(6);
		}

	}else 
	{
		var pattern = /^(0[2-8][0-5]?|01[01346-9])-?([1-9]{1}[0-9]{2,3})-?([0-9]{4})$/;
		if(!pattern.exec(str)) 
		{
			alert("올바른 전화번호를 입력하세요.");
			obj.value = "";
			obj.focus();
			return false;
		}
		if(str.substring(0,2) == "02") 
		{
			if(str.length == 10) 
			{
				obj.value = str.substring(0,2)+"-"+str.substring(2,6)+"-"+str.substring(6);
			}else 
			{
				obj.value = str.substring(0,2)+"-"+str.substring(2,5)+"-"+str.substring(5);
			}
		}else if(str.substring(0,2) == "0505") 
		{
			if(str.length == 12) 
			{
				obj.value = str.substring(0,4)+"-"+str.substring(4,4)+"-"+str.substring(8);
			}else 
			{
				obj.value = str.substring(0,4)+"-"+str.substring(4,3)+"-"+str.substring(7);
			}
		}else 
		{
			if(str.length == 11) 
			{
				obj.value = str.substring(0,3)+"-"+str.substring(3,7)+"-"+str.substring(7);
			}else 
			{
				obj.value = str.substring(0,3)+"-"+str.substring(3,6)+"-"+str.substring(6);
			}
		}
	}
	return true;
}

function SetMobileFormat(obj)
{
    val = obj.value;
	if(val.length < 8) 
	{
		obj.value = "";
		obj.focus();
		alert("올바른 전화번호를 입력하세요.");
		return false;
	}
	str = "";
	for(i=0; i<val.length; i++) 
	{
		_val = val.substring(i,i+1);
		if(_val.search(/[0-9]/) == false)
		{
			str = str+_val;
		}
	}
    mobilepattern = /^(01[016-9])/
	if(mobilepattern.exec(str)) 
	{
		var pattern = /^(01[016-9])-?([1-9]{1}[0-9]{2,3})-?([0-9]{4})$/;
		if(!pattern.exec(str)) 
		{
			obj.value = "";
			obj.focus();
			alert("올바른 휴대전화번호를 입력하세요.");
			return false;
		}
		if(str.length == 11) 
		{
			obj.value = str.substring(0,3)+"-"+str.substring(3,7)+"-"+str.substring(7);
		}else 
		{
			obj.value = str.substring(0,3)+"-"+str.substring(3,6)+"-"+str.substring(6);
		}
	}
}


/*** 캐릭터를 안시코드값으로 변경 ***/
function SetCharcode(str){
    c=new Array(str.length);
    for(var i=0;i<str.length;i++){
        c[i]=str.charCodeAt(i);
    }
    return c;
}
/*** 안시코드값을 html 형식으로 변경 ***/
function SetCharcodecToHtmlchar(str) 
{
    if(str == "") 
	{
		return str;
	}
    str = new String(str)
	arr_str = str.split(",")
//    str = str.replace(",","&#");
	str = "";
	for(i=0; i<arr_str.length; i++)
	{
		str = str + "&#"+arr_str[i];
	}
    return str;
}
/*** HTML문자캐릭터를 문자로 ***/
function SetHtmlcharToString(code) 
{
    strcode = new String(code);
    strcode = strcode.substring(2);
//    strcode = strcode.replace("&#",",");
    arr_strcode = strcode.split("&#");
    str = ""
    for(i=0; i<arr_strcode.length; i++) 
    {
        str += String.fromCharCode(arr_strcode[i]);
    }
    return str;
}
/*** 경고 ***/
function AlertCharcode(code) 
{
    alertmsg = SetHtmlcharToString(code);
    alert(alertmsg);
}
/*** confirm ***/
function ConfirmCharcode(code) 
{
    alertmsg = SetHtmlcharToString(code);
    if(confirm(alertmsg) == false) 
    {
        return false;
    }else 
    {
        return true;
    }
}
function CopyClipboard(str) 
{
	
//	_jscode = document.all.jscode.value;
	_jscode = str;

	if (window.clipboardData) {
		window.clipboardData.setData("Text", _jscode); 
	} else if (window.netscape) {
		netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); 

		var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); 
		if (!clip) return; 

		var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); 
		if (!trans) return; 

		trans.addDataFlavor('text/unicode'); 

		var str = new Object(); 
		var len = new Object(); 

		var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); 

		var copytext = _jscode;  
		str.data = copytext; 

		trans.setTransferData("text/unicode",str,copytext.length*2); 
		var clipid = Components.interfaces.nsIClipboard; 
		if (!clipid) return false; 

		clip.setData(trans,null,clipid.kGlobalClipboard); 
	}
}

/************************************************
달력보이기
<input type=text  name=offermarridate id=offermarridate required='required' hname='결혼/기념일날짜' readonly size=10 class="board_input">
<img src="img/btn_calendar.gif" value="달력" onClick="PopCalendar('offermarridate','Y-m-d','calendar_selector_field')" name="button">

<div id="calendar_selector_field" style="position:absolute;display:none;border-style:solid;border-width:1;border-color:#339999;width:215;height:150;">
<iframe src="/modules/calendar_selector.html?formobj=offermarridate&dateformat=Y-m-d&loadtype=1" frameborder=0 id=calendar_selector_iframe width=215 height=150>
</iframe>
</div>
************************************************/
function PopCalendar(objname,dateformat,calendarfield,ifrmid) 
{
	field = document.getElementById(calendarfield);
	formobj = document.getElementById(objname);
	if(field.style.display == "none") 
	{
		if(formobj.value == "") 
		{
			field.innerHTML = "<iframe src=\"/modules/calendar_selector.html?formobj="+objname+"&dateformat="+dateformat+"&calendarfield="+calendarfield+"\" frameborder=0 id="+ifrmid+" width=215 height=150></iframe>";
		}
		field.style.display = "inline"
	}else 
	{
		field.style.display = "none"
	}
}
function reSizeCalendar(w,h,ifrm)
{
//	field = document.getElementById("calendar_selector_iframe");
	field = document.getElementById(ifrm);
	
	field.style.height = h;
	field.style.width = w;
}

function SetStrLen(obj,ml){
	if(obj.value.length > ml){
		alert(ml+"자 이내로 작성하세요.");
		obj.value = obj.value.substring(0,ml);
	}
}
