function go_main(){
	location.href="/login.do";
}
// Check Number //
function isNO(inputname)
{	
	var formstr=eval(inputname);
	for(var i=0;i<formstr.value.length;i++)
	{
		var chr=formstr.value.substr(i,1);
		if(chr<'0'|| chr>'9')
		{
			return false;
		}
	}
	return true;
}

// Check Number //
function isNOID(inputname)
{	
	var formstr=eval(inputname);
	var cnt = 0;
	for(var i=0;i<formstr.value.length;i++)
	{
		var chr=formstr.value.substr(i,1);

		if(chr>='0'&& chr<='9')
		{	
			cnt = cnt + 1;
		}

	}
	if (cnt == i)
	{
		return false;
	}
	return true;
}

function checkIdUse(input){
		
	var formstr = eval(input);
	re0=/master|webmaster|event|skt|widerthan|test|tester|skt[4]/gi; 
	v0=formstr.value.match(re0); 
	if(v0!=null){
		return false;
	}else{
		return true;
	}
}

function checkNickUse(input){
		
	var formstr = eval(input);
	re0=/마스터|이벤트지기|에스케이티|와이더댄|와이더덴|테스트|테스터|에스케이텔래콤|에스케이텔레콤|master|webmaster|event|skt|widerthan|test|tester|skt[4]/gi; 
	v0=formstr.value.match(re0); 
	if(v0!=null){
		return false;
	}else{
		return true;
	}
}

function chk_ninck(input){
	var formstr = eval(input);
	re0=/^[가-힣a-zA-Z0-9\!\@\$\*\^]+$/; 
	re1=/[ㄱ-ㅎ]|[ㅏ-ㅣ][' ']/g; //한글패턴
	
	var rtn = re0.test(formstr.value);

	return rtn;
	
	
	/*
	
	v0=formstr.value.match(re0);
	v1=formstr.value.match(re1);
	alert(v0);
	alert(v1);
	if(v0!=null && v1==null){
		return true;
	}else{
		return false;
	}
	*/
}


//if (chr =='!' || chr == '@' || chr == '$' || chr == '^' || chr == '*' )
function isLimitCheck3(input,minsize, maxsize){

	  f=input; //폼객체
	  v=f.value; //입력값
	  re0=/[가-힣]|[a-z]|[A-Z]|[0-9]|[!@$^*]/gi; //영숫자 패턴
	  v0=v.match(re0); //매치확인
	  if(v0!=null){
		  v0=v0.length; //바이트 구함
	  }else{
		  alert("허용가능 문자가 아닙니다.");
		  return false;
	  }
	  tot=v0;
	  if (tot < minsize)
	  {
		  //alert("최소" + minsize + "자 이하로는 입력이 불가능합니다.");
		  input.focus();
		  return false;

	  }else if (tot > maxsize){
		
			//alert("최대 " + maxsize + "자 이상으로는 입력이 불가능합니다.");
			input.value = input.value.substr(0, input.value.length-2);
		    input.focus();
		  return false;

	  }else{
			return true;
	  }

	  return true;


}



//if (chr =='!' || chr == '@' || chr == '$' || chr == '^' || chr == '*' )
function isLimitCheck1(input,minsize, maxsize){

	  f=input; //폼객체
	  v=f.value; //입력값
	  re0=/[a-z]|[A-Z]|[0-9]|[!@$^*]/gi; //영숫자 패턴
	  v0=v.match(re0); //매치확인
	  if(v0!=null)v0=v0.length; //바이트 구함
	  tot=v0;
	  if (tot < minsize)
	  {
		  alert("비밀번호는 6 ~ 12 자로 입력하세요.");
		  input.focus();
		  return false;

	  }else if (tot > maxsize){
		
			alert("비밀번호는 6 ~ 12 자로 입력하세요.");
			input.value = input.value.substr(0, input.value.length-2);
		    input.focus();
		  return false;

	  }else{
			return true;
	  }

	  return true;


}


//if (chr =='!' || chr == '@' || chr == '$' || chr == '^' || chr == '*' )
function isLimitCheck(input,minsize, maxsize){

	  f=input; //폼객체
	  v=f.value; //입력값
	  re0=/[a-z]|[A-Z]|[0-9]/gi; //영숫자 패턴
	  re1=/[ㄱ-힣]/g; //한글패턴
	  v0=v.match(re0); //매치확인
	  v1=v.match(re1); //매치확인
	  if(v0!=null)v0=v0.length; //바이트 구함
	  if(v1!=null)v1=v1.length; //바이트 구함
	  tot=v0+(v1*2); //합을 구함

	  if (tot < minsize)
	  {
	  	  if(minsize==4){ 
		  alert("닉네임은 한글 2자~8자, 영문 4자~16자로 입력하여 주십시오.");
		  }else{
		  alert("아이디는 6자~15자로 입력하여 주십시오.");
		  }
		  input.focus();
		  return false;

	  }else if (tot > maxsize){
		
			//alert("한글은 " + maxsize + "자 이상으로는 입력이 불가능합니다.");
			input.value = input.value.substr(0, input.value.length-2);
		    input.focus();
		  return false;

	  }else{
			return true;
	  }


}
// 한글 영문에 대한 바이트 계산
 function chk(input,lim){ 
	  f=input; //폼객체
	  v=f.value; //입력값
	  re0=/[a-z]|[A-Z]|[0-9]/gi; //영숫자 패턴
	  re1=/[ㄱ-힣]/g; //한글패턴
	  v0=v.match(re0); //매치확인
	  v1=v.match(re1); //매치확인
	  if(v0!=null)v0=v0.length; //바이트 구함
	  if(v1!=null)v1=v1.length; //바이트 구함
	  tot=v0+(v1*2); //합을 구함

	  var eng_lim = lim / 2;
	  if(tot<=lim){ //한계수치이내인경우 바이트표시

	  } else { //한계를 초과하면 경고문 출력
	   
	   input.value = input.value.substr(0, 8);
	   //alert('한글은 '+ eng_lim +'자 영문은 '+ lim +'자까지 가능합니다.');
	   input.focus();
	  }
 }


// Check 주민번호 4자이상 같은지 유무 판단
function isSsnP(inputname1,inputname2,inputname3)
{	
	var formstr1=eval(inputname1);
	var formstr2=eval(inputname2);
	var formstr3=eval(inputname3);

	var ssn = formstr1.value + formstr2.value;
	var cnt = 0;
	for(var i=0;i<ssn.length;i++)
	{
		var chr1=ssn.substr(i,1);
			for (var j=0; j<formstr3.value.length ; j++ )
			{
				var chr2=formstr3.value.substr(j,1);		
				if (chr1==chr2)
				{
					
				}

			}

		
	}

	var chr=formstr.value.substr(0,1);

		if(chr>='0'&& chr<='9')
		{
		return false;
		}

	return true;
}


// Check Number first id//
function isNOIDFirst(inputname)
{	
	var formstr=eval(inputname);
	var chr=formstr.value.substr(0,1);

		if(chr>='0'&& chr<='9')
		{
		return false;
		}

	return true;
}


// Check ID & PW //
function isCode2(inputname)
{
	var formstr=eval(inputname);
	var len = 0;
	for(var i=0;i<formstr.value.length;i++)
	{
		var chr=formstr.value.substr(i,1);

		if (chr =='!' || chr == '@' || chr == '$' || chr == '^' || chr == '*' )
		{

		}else{
			if (chr == ')' || chr == '(')
			{
				return false;

			}else if((chr<'0'||chr>'9') && (chr<'a'||chr>'z') && chr!='-' && chr!='_' && chr!='.' )
			{
				return false;
			}
		}

	}
	return true;
}


// Check ID //
function isCode1(inputname)
{
	var formstr=eval(inputname);
	var len = 0;
	for(var i=0;i<formstr.value.length;i++)
	{
		var chr=formstr.value.substr(i,1);

		if (chr =='!' || chr == '@' || chr == '$' || chr == '^' || chr == '*' )
		{
				return false;
		}else{
			if (chr == ')' || chr == '(')
			{
				return false;

			}else if((chr<'0'||chr>'9') && (chr<'a'||chr>'z') && chr!='-' && chr!='_' && chr!='.' )
			{
				return false;
			}
		}

	}
	return true;
}

// Check ID or Password //
function isCode(inputname)
{
	var formstr=eval(inputname);
	var len = 0;
	for(var i=0;i<formstr.value.length;i++)
	{
		var chr=formstr.value.substr(i,1);

		if (chr =='!' || chr == '@' || chr == '$' || chr == '^' || chr == '*' )
		{
			return false;
		}else{
			if (chr == ')' || chr == '(')
			{
				return false;

			}else if((chr<'0'||chr>'9') && (chr<'a'||chr>'z') && (chr<'A'||chr>'Z') && chr!='-' && chr!='_' && chr!='.' )
			{
				return false;
			}
		}

	}
	return true;
}

//-----------------------------------------------------------------------------
// get bytes length
//-----------------------------------------------------------------------------
function getByteLengthMemo(data) {
	//var text_Length = 0;
	//var tot_count = 0;
	//var onechar;

	//text_Length = source_text.length;	// 텍스트의 문자열 길이를 받습니다.

	//for (i=0;i < text_Length;i++) {	// 문자열 길이만큼 루프를 돌겠습니다.
	//	onechar = source_text.charAt(i);	// 문자열 하나를 받습니다.

	//	if (escape(onechar).length > 4) // escape 함수를 이용해 길이를 구해봅니다. (자바스크립트 함수표 참조)
	//	{
	//		tot_count += 2;		// 만약 한글이라면 2를 더하고
	//	}
	//	else if (onechar!='\r') // 엔터가 아니라면
	//	{
	//		tot_count++;		// 1을 더한다.
	//	}
	//}
	
    var len=0;
    var str = data.substring(0);
    if (str==null) return 0;
    for(var i=0;i<str.length;i++) {
        var ch = escape(str.charAt(i));
        if(ch.length ==1) len++;
        else if (ch.indexOf("%u")!=-1) len +=2;//Db가 한글을 3Byte로 인식해서 2->3
        else if (ch.indexOf("%")!=-1) len +=ch.length/3;
    }
    return len;
}

function getByteLengthChar(data, byteLength) {
		
    var len=0;
    var str = data.substring(0);
    if (str==null) return "";
    for(var i=0;i<str.length;i++) {
        var ch = escape(str.charAt(i));
        if(ch.length ==1) {
        	len++;
        } else if (ch.indexOf("%u")!=-1) {
           	len +=2;//Db가 한글을 3Byte로 인식해서 2->3
        } else if (ch.indexOf("%")!=-1){
         	len +=ch.length/3;
        }
        
        if(len > byteLength) {
        	str = data.substring(0,i);
        	//alert(len + " " + str);
        	break;
        }
    }
    return str;
}

//check reply input
function getIsProperChar(inputValue) {
//charCodeAt - value
// A - 65, Z - 90
// a - 97, z - 122
// 0 - 48, 9 - 57
// ! - 33, @ - 64, $ - 36, ^ - 94, * - 42

//  var isProperChar = true;   
// var str =inputValue;
//  for(i=0; i<str.length; i++) {
//  		var isProper = false;
  		
//	   	var chkAt = str.charCodeAt(i);
//	   	if(chkAt > 64 && chkAt < 91 && !isProper) {
//	   		isProper = true;
//	   	}
//	   	if(chkAt > 96 && chkAt < 123 && !isProper) {
//	   		isProper = true;
//	   	}
//	   	if(chkAt > 47 && chkAt < 58 && !isProper) {
//	   		isProper = true;
//	   	}
//	   	if( (chkAt == 33 || chkAt == 64 || chkAt == 36 || chkAt == 94 || chkAt == 42)  && !isProper) {
//	   		isProper = true;
//	   	}
	var re0=/[ㄱ-힣]|[a-z]|[0-9]|[!@$^*]/g; 
	
	var v0 = inputValue.match(re0);
	
	if(v0!=null){
		return true;
	}else{
		return false;
	}   	
	   	
	   	
//	   	if(!isProper) {
//	   		isProperChar = false;
//	   	}
//   }
   
//   return isProperChar;
}

// Check Korean //
function isKorean(inputname)
{
	var retCode=0;
	for(var i=0;i<inputname.value.length;i++)
	{
		var retCode=inputname.value.charCodeAt(i);
		var retChar=inputname.value.substr(i,1).toUpperCase();
		retCode=parseInt(retCode);
		if((retChar<'0'||retChar>'9')&&(retChar<'A'||retChar>'Z')&&(retCode>255||retCode<0))
		{
			return false;
		}
	}
	return true;
}

// Check Email //
function isEmail(inputname)
{
	for(var l=0;l<=(inputname.value.length-1);l++)
	{
		if(inputname.value.indexOf(' ')>=0)
		{
			inputname.select();
			return false;
		}
	}
	if((inputname.value.indexOf('/'))!=-1 || (inputname.value.indexOf(';'))!=-1)
	{
		inputname.select();
		return false;
	}
	if((inputname.value.length!=0)&&(inputname.value.search(/(\S+)@(\S+)\.(\S+)/)==-1))
	{
		inputname.select();
		return false;
	}
	if(!isKorean(inputname))
	{
		inputname.select();
		return false;
	}
	return true;
}

// Check Email //
function isEmail2(val)
{
	if( val == 'undefined' ) return false;
	for(var l=0;l<=(val.length-1);l++)
	{
		if(val.indexOf(' ')>=0)
		{
			return false;
		}
	}
	if((val.indexOf('/'))!=-1 || (val.indexOf(';'))!=-1)
	{
		return false;
	}
	if((val.length!=0)&&(val.search(/(\S+)@(\S+)\.(\S+)/)==-1))
	{
		return false;
	}
	return true;
}

// Check Jumin //
function isIDNO(inputname1,inputname2)
{
	var chk=0
	var yy=inputname1.value.substring(0,2)
	var mm=inputname1.value.substring(2,4)
	var dd=inputname1.value.substring(4,6)
	var sex=inputname2.value.substring(0,1)
	if((inputname1.value.length!=6)||(yy<25||mm<1||mm>12||dd<1))
	{
		inputname1.select();
		return false;
	}
	if((sex!=1&&sex!=2)||(inputname2.value.length!=7))
	{
		inputname2.select();
		return false;
	}
	for(var i=0;i<=5;i++)
	{
		chk=chk+((i%8+2)*parseInt(inputname1.value.substring(i,i+1)))
	}
	for(var i=6;i<=11;i++)
	{
		chk=chk+((i%8+2)*parseInt(inputname2.value.substring(i-6,i-5)))
	}
	chk=11-(chk %11)
	chk=chk%10
	if(chk!=inputname2.value.substring(6,7))
	{
		inputname2.select();
		return false;
	}
	return true;
}

// Check Text Size //
function isLength(inputname)
{
	var t;
	var msglen;
	msglen=0;
	l=inputname.value.length;
	for(i=0;i<l;i++)
	{
		t=inputname.value.charAt(i);
		if(escape(t).length>4) msglen+=2;
		else msglen++;
	}
	return msglen;
}

// Popup Windows A //
function popWinA(url,name,wid,hei)
{
	option='top=0,left=0,width='+wid+',height='+hei+',scrollbars=1,resizable=1';
	var newwindow = window.open(url,name,option);
	if (newwindow == null) {
		alert("차단된 팝업창을 허용해 주십시오.");
	} 
	newwindow.focus();
}

// Popup Windows B //
function popWinB(url,name,wid,hei)
{
	option='top=0,left=0,width='+wid+',height='+hei+',scrollbars=1,resizable=1,toolbars=1';
	newwindow = window.open(url,name,option);
	newwindow.focus();
}

// Popup Windows C //
function popWinC(url,name,WinWidth,WinHeight,option)
{
	var x = screen.width / 2 - WinWidth / 2;
	var y = screen.height / 2 - WinHeight / 2;
	option = option + ',width=' + WinWidth + ',height=' + WinHeight + ',left=' + x + ',top=' + y;
	newwindow = window.open(url,name,option);
	newwindow.focus();
}

// View Tables //
function viewTable(divname,opt)
{
	if(document.getElementById(divname))
	{
		if(opt)
		{
			if(opt=='on')
			{
				document.getElementById(divname).style.display='block';
			}
			else
			{
				document.getElementById(divname).style.display='none';
			}
		}else{
			if(document.getElementById(divname).style.display=='none')
			{
				document.getElementById(divname).style.display='block';
			}
			else
			{
				document.getElementById(divname).style.display='none';
			}
		}
	}
}

// Check All Checkbox or Uncheck //
function checkInv(formname,chkname)
{
	for(i=0;i<formname.elements.length;i++)
	{
		var formstr=formname.elements[i];
		if(formstr.name==chkname)
		{
			formstr.checked=!formstr.checked;
		}
	}
}

// Check All Checkbox //
function checkAll(formname,chkname)
{
	for(i=0;i<formname.elements.length;i++)
	{
		var formstr=formname.elements[i];
		if(formstr.name==chkname)
		{
			formstr.checked=true;
		}
	}
}

// Input Date //
function inputDate(formname,opt1,opt2)
{
	today=new Date();
	now_year=today.getYear();
	now_month=today.getMonth()+1;
	now_day=today.getDate();

	month_temp=now_month-1;
	switch(month_temp)
	{
		case(1): day_temp=31; break;
		case(2): day_temp=28; break;
		case(3): day_temp=31; break;
		case(4): day_temp=30; break;
		case(5): day_temp=31; break;
		case(6): day_temp=30; break;
		case(7): day_temp=31; break;
		case(8): day_temp=31; break;
		case(9): day_temp=30; break;
		case(10): day_temp=31; break;
		case(11): day_temp=30; break;
		case(12): day_temp=31; break;
		default: day_temp=31; break;
	}

		the_day=now_day;
		the_month=now_month;
		the_year=now_year;

	if(opt1=='d')
	{
		opt_day=now_day-opt2;
		if(opt_day>0)
		{
			the_day=opt_day;
		}
		else
		{
			opt_month=now_month-1;
			the_day=day_temp+opt_day;
			if(opt_month>0)
			{
				the_month=opt_month;
			}
			else
			{
				the_year=now_year-1;
				the_month=12;
			}
		}
	}
	else if(opt1=='m')
	{
		opt_month=now_month-opt2;
		if(opt_month>0)
		{
			the_month=opt_month;
		}
		else
		{
			the_year=now_year-1;
			the_month=12+opt_month;
		}
	}
	else if(opt1=='y')
	{
		the_year=now_year-opt2;
	}

	if(the_month<10)
	{
		the_month='0'+the_month;
	}
	if(the_day<10)
	{
		the_day='0'+the_day;
	}
	the_date=the_year+''+the_month+''+the_day;
	formname.sdate.value=the_date;

	if(now_month<10)
	{
		now_month='0'+now_month;
	}
	if(now_day<10)
	{
		now_day='0'+now_day;
	}
	now_date=now_year+''+now_month+''+now_day;
	formname.edate.value=now_date;
	
	if(opt1=='w')
	{
		formname.sdate.value='';
		formname.edate.value='';
	}
}

// Set Cookie //
function setCookie(name,value,expires)
{
	document.cookie=name+'='+escape(value)+"; path=/;";
	if(expires)
	{
		document.cookie+=' expires='+expires.toGMTString()+';';
	}
	//if(secure) document.cookie+=' secure;';
}

// Check Cookie //
function getCookie(name)
{
	var cname=name+'=';
	if(document.cookie.length>0)
	{
		begin=document.cookie.indexOf(cname);
		if(begin!=-1)
		{
			begin+=cname.length;
			var end=document.cookie.indexOf(';',begin);
			if(end==-1)
			{
				end=document.cookie.length;
			}
			return unescape(document.cookie.substring(begin,end));
		}
	}
	return;
}

function saveCookie(form)
{
	var expdate = new Date();
	// 기본적으로 30일동안 기억하게 함. 일수를 조절하려면 * 30에서 숫자를 조절하면 됨
	if (form.checksave.checked)
	{
		expdate.setTime(expdate.getTime() + 1000 * 3600 * 24 * 30); // 30일
		setCookie('save_manage_navi', 'none', expdate);
	}
	else
	{
		expdate.setTime(expdate.getTime() - 1); // 쿠키 삭제조건
		setCookie('save_manage_navi', '', expdate);
	}
}

// Move Focus //
function nextFocus(inputname1,inputname2,len)
{

	if (!isNO(inputname1)){
		inputname1.value = "";
		inputname1.focus();
		return;
	}
	
		if(inputname1.value.length>=len)
		{
			inputname2.focus();
		}
	
}

// Pass Selected //
function passbySlt(inputname)
{
	if(inputname.options[inputname.selectedIndex].value)
	{
		location=inputname.options[inputname.selectedIndex].value;
	}
}

// check checkbox_checked
function listCheckbox(form, checkbox_name, msg)
{
	for(i = 0; i < form.elements.length; i++)
	{
		var form_str = form.elements[i];
		if(form_str.name == checkbox_name) {
			if(form_str.checked) var check_temp = true;
		}
	}


	if(check_temp != true)
	{
		alert(msg);
		return false;
	}
}

// load value from radiobox element
function returnValRdo(fm)
{
	var tmp;
	for(var i = 0; i < fm.length; i++)
	{
		if(fm[i].checked == true)
		{
			tmp = i;
			break;
		}
	}

	if( tmp == 'undefined' || tmp == undefined) return;
	return fm[tmp].value;
}

// View or Hidden Only One Item ///
function displayOne(id)
{
	if(document.getElementById(id).style.display != 'none')
	{
		document.getElementById(id).style.display = 'none';
	}
	else
	{
		document.getElementById(id).style.display = '';
	}
}


// View or Hidden Only One Item ///
function displayTwo(id, opt)
{
	document.getElementById(id).style.display = opt;
}

// show and hidden for div tag
function showDiv(opt)
{
	if(document.getElementById(opt).style.display != 'none')
	{
		document.getElementById(opt).style.display = 'none';
		return 'none';
	}
	else
	{
		document.getElementById(opt).style.display = '';
		return '';
	}
}

// View or Hidden Two Items ///
function two_display(id_1, id_2, display_place)
{
	if(display_place == 'prev')
	{
		document.getElementById(id_1).style.display = '';
		document.getElementById(id_2).style.display = 'none';
	}
	else if(display_place == 'next')
	{
		document.getElementById(id_1).style.display = 'none';
		document.getElementById(id_2).style.display = '';
	}
}


// Lets use ltrim, rtrim, trim about all variable use 
String.prototype.ltrim=new Function("return this.replace(/^\\s+/,'')")
String.prototype.rtrim=new Function("return this.replace(/\\s+$/,'')")
String.prototype.trim= new Function("return this.replace(/^\\s+|┕|\\s+$/g,'')")	


// use tab key at textarea box element
function useTab(el)
{
	if( event.keyCode == 9 )
	{
		( el.selection = document.selection.createRange() ).text = "\t";
		event.returnValue = false;
	}
}


// enter num
function enterNum(str)
{
	var cnt = 1;
	var pos = -1;
	while( pos = str.indexOf("\n",pos+1) >= 0 )
	{
		cnt++; // line
	}

	return cnt;
}

// input only number
function onlyNum()
{
	if( event.keyCode == 13 ) return true;
	if( event.keyCode < 48 || event.keyCode > 57 )
	{
		event.returnValue = false;
	}
}

// input only number
function onlyFloat()
{
	if( event.keyCode < 48 || event.keyCode > 57 )
	{
		if( event.keyCode != 46 )
		event.returnValue = false;
	}
}

// cant input hangul
function checkHangul(obj)
{
	for(var i = 0; i < obj.value.length; i++)
	{ 
		var a = obj.value.charCodeAt(i);
		if(a > 128)
		{
			alert('메세지');
			obj.value = '';
			obj.focus();
			return; 
		} 
	} 
}

// move after confirm
function confirmNext(url,msg)
{
	if(confirm(msg))
	{
		location.href=url;
		return true;
	}
	else
	{
		return false;
	}
}



// 한글,영문 MAX Length 체크
function checkByte(obj,slen,title) {
	var iLEN=0;
	if(slen=="") {
		iLEN=0;
	} else {
		iLEN=parseInt(slen);
	}
	var obj_len=getByteLength(obj.value); 
	if(obj_len > iLEN) {
		alert(title+" 항목의 최대길이("+slen+" Byte)를 초과 하였습니다."); 
		obj.value=obj.value.substring(0,obj.value.length-1); 
		if(obj.value.length > iLEN) { 
			for(i=0 ; i <= obj.value.length;i+=2) { 
				var obj_len_tmp=getByteLength(obj.value.substring(0,i)); 
				if(obj_len_tmp > iLEN) { 
					obj.value=obj.value.substring(0,i-4); 
					var obj_len_tmp_1=getByteLength(obj.value); 
					if(obj_len_tmp_1 > iLEN) { 
						obj.value=obj.value.substring(0,i-1); 
					} 
					break; 
				}  
			} 
		}  
		obj.select(); 
		return; 
	}
}


function cutByte(str, len, tail){
	  var l = 0;
	  for(var i = 0; i < str.length; i++){
		   l += (str.charCodeAt(i) > 128) ? 2 : 1;
		   if(l > len) return str.substring(0,i) + tail;
	  }
	  return str;
}
 
function checkByteLen(obj,slen,title) {

	var iLEN=0;
	if(slen=="") {
		iLEN=0;
	} else {
		iLEN=parseInt(slen);
	}
	var obj_len=getByteLength(obj.value); 
	if(obj_len > iLEN) {
		alert(title+" 항목의 최대길이("+slen+" Byte)를 초과 하였습니다."); 
		obj.value=cutByte(obj.value, iLEN, ""); 
		if(obj.value.length > iLEN) { 
			for(i=0 ; i <= obj.value.length;i+=2) { 
				var obj_len_tmp=getByteLength(obj.value.substring(0,i)); 
				if(obj_len_tmp > iLEN) { 
					obj.value=obj.value.substring(0,i-4); 
					var obj_len_tmp_1=getByteLength(obj.value); 
					if(obj_len_tmp_1 > iLEN) { 
						obj.value=obj.value.substring(0,i-1); 
					} 
					break; 
				}  
			} 
		}  
		obj.select(); 
		return; 
	}
}

function getByteLength(s){

   var len = 0;
   if ( s == null ) return 0;
   for(var i=0;i<s.length;i++){
      var c = escape(s.charAt(i));
      if ( c.length == 1 ) len ++;
      else if ( c.indexOf("%u") != -1 ) len += 2;
      else if ( c.indexOf("%") != -1 ) len += c.length/3;
   }
   return len;
}

// 숫자체크
function n_check(x){
	if(isNaN(x.value))
	{
		alert("숫자를 입력해 주세요.");
		x.value="";
		x.focus();
		return false;
	}else{
		return true;
	}
}