﻿/* *****************************************************************************
 *  @date : 2008.09.26
 *  @author : 박흥순
 *  @descript: 메인 페이지 자바스크립트(공통 스크립트)
 **************************************************************************** */
 
/* 전역 변수 */
var user_id_min_len = 4;	// 사용자 ID 최소 길이
var user_id_max_len = 12;	// 사용자 ID 최대 길이
var user_id_permit_pattern = /[^0-9a-zA-Z]/;	//사용자 ID 허용 문자 패턴

     /**
     * 우편번호 팝업 오픈
     *
     * Ex> jsZipcode(폼이름.우편번호변수이름,폼이름.주소1이름 )
    **/
    function jsZipcode1(zipcode, address1) {
       jsOpenWin("/common/zipcode/search.jsp?zipcode="+zipcode+"&address="+address1,"zipcode","417","260","yes");
    }
    
    /*
     * add Jeon Jae Young 우편번호 팝업 추가
     */
    function jsZipCode2(zipcode1, zipcode2, address1)
    {
        jsOpenWin("/common/zipcode/search.jsp?zipcode1=" + zipcode1 + "&zipcode2=" + zipcode2 + "&address=" + address1,"zipcode", "417", "260", "yes");
    }  
    
	/**
	 * 일반 팝업 오픈
	 *
	 * Ex> jsOpenWin("issue_cate_view.jsp?issuCateSeq=" + issuCateSeq,'상세보기','610','300','yes');
	**/
	function jsOpenWin(filename,p_name,s_width,s_height,s_scrol){
	    var x = screen.width;
	    var y = screen.height;
	    var wid = (x / 2) - (s_width / 2);
	    var hei = (y / 2) - (s_height / 2);
	
	  var newwin =   window.open(filename, p_name, "toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=" + s_scrol + ",width=" + s_width + ",height=" + s_height + ",top=" + hei + ",left=" + wid); 
	  newwin.focus();
	}
	
	
	/**
	 * 엔터 검색
	 *
	 *Ex> <input type="text" name="searchVal" value="<%=searchVal%>" onKeydown="javasript:jsEnterSearch('jsSearch()')">
	**/
	function jsEnterSearch(jsNm){
	    if ( event.keyCode == 13 ){
	        eval(jsNm);
	    }
	}
	
	/**
	 * 쿠키를 가져온다.
	 *
	 *Ex>
	**/
	function jsGetCookie(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 "";
	}
	
	/**
	 * 쿠키를 날짜제한과 함께 설정한다.
	 *
	 *Ex>
	**/
	function jsSetCookie(name,value,expiredays) {
	    var todayDate = new Date();
	    todayDate.setDate(todayDate.getDate() + expiredays);
	    document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
	}
	
	/**
	 * 날짜 제한없는 쿠키를 설정한다.
	 *
	 *Ex>
	**/
	function jsSetCookie(name,value) {
	    document.cookie = name + "=" + escape( value ) + "; path=/";
	}
	
	/**
	 * 입력글자숫자로 제한한다.
	 *
	 *Ex>
	**/
	function jsCheckNumber(val) {
	    var objThisElement  = val;
    
         if((event.keyCode != 0) &&
            (event.keyCode != 8) && 
            (event.keyCode != 9) && 
            (event.keyCode != 219) && 
            (event.keyCode != 46) && 
            (event.keyCode != 229))
        {
            if (((event.keyCode < 48)||(event.keyCode > 57)) && ((event.keyCode < 96)||(event.keyCode > 105)))
            {
                alert("숫자만 입력가능합니다.");
                objThisElement.value = "";
                return false;
            }
        }
	}
	
	/**
	 * 대소문자 구별하지 않고 단어 위치 찾기
	 *
	 *Ex>frm.searchVal.value.ipos('a')
	**/
	String.prototype.ipos = function (needle, offset) {
	    var offset = (typeof offset == "number")?offset:0;
	    return str.toLowerCase().indexOf(needle.toLowerCase(), offset);
	}
	
	/**
	 * 대소문자 구별하지 않고 뒤에서부터 단어위치 찾기
	 *
	 *Ex>frm.searchVal.value.ipos('a')
	**/
	String.prototype.ripos = function (needle, offset) {
	    var offset = (typeof offset == "number")?offset:0;
	    return str.toLowerCase().lastIndexOf(needle.toLowerCase(), offset);
	}
	
	/**
	 * 좌우 공백없애는 함수
	 *
	 *Ex>frm.searchVal.value.trim()
	**/
	//String.prototype.trim = function () { return this.replace(/(^s*)|(s*$)/g, ""); }
	String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/gi, ""); };
	
	/**
	 * 왼쪽 공백없애는 함수
	 *
	 *Ex>frm.searchVal.value.ltrim()
	**/
	String.prototype.ltrim = function () { return this.replace(/^s*/g, ""); }
	
	/**
	 * 오른쪽 공백없애는 함수
	 *
	 *Ex>frm.searchVal.value.rtrim()
	**/
	String.prototype.rtrim = function () { return this.replace(/s*$/g, ""); }
	
	/**
	 * iframe사이즈에 맞게 사이즈 조정
	 *
	 *Ex>
	**/      
	function resizeIframe(fr) {
	
	        fr.setExpression('height',fr.document.body.scrollHeight);
	        fr.setExpression('width',fr.document.body.scrollWidth);
	        return;
	}
	
	/**
	 * 코멘트 화면 삽입
	 *
	 *Ex>
	**/ 
	window.onload = function() {
	    if (document.getElementById("cmmntDiv")) {
	        var div = document.getElementById("cmmntDiv");
	 
	        var id = div.getAttribute("ifrId");
	        var refGb = div.getAttribute("refGb");
	        var cmmntsRefSeq = div.getAttribute("cmmntsRefSeq");
	        var cmmntsDtlRefSeq = div.getAttribute("cmmntsDtlRefSeq");
	
	        var f = document.createElement("<iframe id='" + id + "' name='" + id + "' src='/uview/commons/comments/comments_ifr.jsp?refGb=" + refGb + "&cmmntsRefSeq=" + cmmntsRefSeq + "&cmmntsDtlRefSeq=" + cmmntsDtlRefSeq + "' scrolling ='no' frameborder='0' width='100%'/>");
	        div.appendChild(f);
	    }   
	}
	
	/**
	 * 체크 박스 일괄 선택 삭제 스크립트 
	 *
	 *Ex>onClick="javascript:jsChkAll(this,document.sFrm.needsSeqChk);"
	 **/
	function jsChkAll(selfObj,checkObj){
	    if(!checkObj) return;
	       
	    if(selfObj.checked){
	        if(!checkObj.length){ 
	            checkObj.checked = true; 
	        } else { 
	            for(var i=0; i<checkObj.length; i++){ 
	                if(!checkObj[i].disabled){ 
	                    checkObj[i].checked = true;
	                }
	            }
	        }
	    }else{
	        if(!checkObj.length){ 
	            checkObj.checked = false; 
	        } else { 
	            for(var i=0; i<checkObj.length; i++){ 
	                if(!checkObj[i].disabled) checkObj[i].checked = false;
	            }
	        }
	    }
	}
	
	
	// 날짜 문자열로 만들기
	function jsMakeDate(date){
	    var nowYear = date.getFullYear();
	    var month = date.getMonth()+1;
	    var nowMonth = "";
	    if(month < 10)
	        nowMonth = "0" + month;
	    else 
	        nowMonth = month;
	    var day = date.getDate();
	    var nowDay = "";
	    if(day < 10)
	        nowDay = "0" + day;
	    else 
	        nowDay = day;
	
	    var tempDate = new String(nowYear) + new String(nowMonth) + new String(nowDay);
	    return tempDate;
	};
	
	// 기본 selectbox 
	function jsSelDate(period, form){
	    var toDate = new Date();
	    var toDateStr = jsMakeDate(toDate);
	    var weekValue = toDate.getDay();
	    if(weekValue == 0)
	        weekValue = 7;
	    var tmTime = toDate.getTime();
	    var startDt = "";
	    var endDt = "";
	    
	    if(period == 1){ // 오늘
	        tmTime = tmTime - (24*60*60*1000);
	        toDate.setTime(tmTime);
	        startDt = jsMakeDate(toDate);
	        endDt = toDateStr;
	    }
	    else if(period == 2){ // 금주
	        var temp = tmTime + ((1-weekValue) * 24 * 60 * 60 * 1000);
	        toDate.setTime(temp);
	        startDt = jsMakeDate(toDate);
	        endDt = toDateStr;
	    }
	    else if(period == 3){ // 전주
	        tmTime = tmTime - (7*24*60*60*1000);
	        var temp = tmTime + ((1-weekValue) * 24 * 60 * 60 * 1000);
	        toDate.setTime(temp);
	        startDt = jsMakeDate(toDate);
	        temp = tmTime + ((7-weekValue) * 24 * 60 * 60 * 1000);
	        toDate.setTime(temp);
	        endDt = jsMakeDate(toDate);
	    }
	    else if(period == 4){ //금월
	        var thismonth = new Date(toDate.getFullYear(), toDate.getMonth(), 1);
	        var nextmonth = new Date(toDate.getFullYear(), toDate.getMonth()+1, "");
	        startDt = jsMakeDate(thismonth);
	        //endDt = jsMakeDate(nextmonth);
	        endDt = toDateStr;
	    }
	    else if(period == 5){ //전월
	        var thismonth = new Date(toDate.getFullYear(), toDate.getMonth()-1, 1);
	        var nextmonth = new Date(toDate.getFullYear(), toDate.getMonth(), "");
	        startDt = jsMakeDate(thismonth);
	        endDt = jsMakeDate(nextmonth);
	    }
	    else if(period == 6){ //3개월
	        var thismonth = new Date(toDate.getFullYear(), toDate.getMonth()-3, toDate.getDate());
	        var nextmonth = new Date(toDate.getFullYear(), toDate.getMonth(), toDate.getDate());
	        startDt = jsMakeDate(thismonth);
	        endDt = jsMakeDate(nextmonth);
	    }
	    else if(period == 7){ //6개월
	        var thismonth = new Date(toDate.getFullYear(), toDate.getMonth()-6, toDate.getDate());
	        var nextmonth = new Date(toDate.getFullYear(), toDate.getMonth(), toDate.getDate());
	        startDt = jsMakeDate(thismonth);
	        endDt = jsMakeDate(nextmonth);
	    }
	    else if(period == 8){ //12개월
	        var thismonth = new Date(toDate.getFullYear(), toDate.getMonth()-12, toDate.getDate());
	        var nextmonth = new Date(toDate.getFullYear(), toDate.getMonth(), toDate.getDate());
	        startDt = jsMakeDate(thismonth);
	        endDt = jsMakeDate(nextmonth);
	    }
	    else { //기간검색 선택시 초기화
	        startDt = "";
	        endDt = "";
	    }
	    form.startDt.value = startDt;
	    form.endDt.value = endDt;
	};
	
	//체크박스
function checked_parent(parent, val){
    len = parent.length;
    for(var i = 0; i < len; i++){
        if(parent[i].value == val){
            parent[i].checked = true;
            break;
        }
    }
}

function checked_num(parent){
    len = parent.length;
    var num=0;
    for(var i = 0; i < len; i++){
        if(parent[i].checked){
            num = num +1 ;
        }
    }
    return num ;
}

function isNull(str){
    if(str == "") return true;
    var len = str.length;
    for(var i = 0; i < len; i++)
    {
        if(str.substring(i,i+1) != " ") return false;
    }
    return true;
}

function isBlank(str){
    var len = str.length;
    for(var i = 0; i < len; i++)
    {
        if(str.substring(i,i+1) == " ") return true;
    }
    return false;
}

//길이제한
function lengthCheck(e1, leng, name){
    if(e1.value.length > 0){

        var speci ="~`!@#$%^&*()_+|-=\\{}[],./<>?\"'";
        var str   = /[^a-z0-9A-Z]/;
        var num = 0;

        for (var i = 0; i < e1.value.length; i++){
            if(-1 != speci.indexOf(e1.value.charAt(i)) || !str.test(e1.value.charAt(i)) || e1.value.charAt(i) == "")
                num += 1;
            else num += 2;

            if (num > leng){
                alert(name+' 제한길이를 초과했습니다. \t\n\n'+name+'을(를) 다시 작성하세요!... \t\n');
                e1.focus();
                return;
            }
        }
    }
}

//숫자체크
function numberCheck(element){
    var num = element.value;
    var str = /[^0-9]/;
    if (str.test(num)){
        return false;
    }
    return true;
}

//숫자체크 , 크기 제한을 둘려면 max를 설정하세요 아니면 null로 설정
function ValidateNumber(e1, min, max, change){
    var errorChk = false;
    if(e1.value.length > 0){
        var num = '0123456789';
        for (var i=0; i<e1.value.length;i++){
            if(-1 == num.indexOf(e1.value.charAt(i)))
            errorChk = true;
        }

        if(change && max != null && e1.value > max)
        {
            errorChk = true;
        }else if(change && min != null && e1.value < min)
        {
            errorChk = true;
        }

        if(errorChk && max != null && min != null)
        {
            alert("\n "+min+" ~ "+max+" 의 숫자를 입력하세요!... \t\n");
            e1.value = e1.defaultValue;
            e1.focus();
            return;
        }else if(errorChk && max != null && min == null)
        {
            alert("\n "+max+" 이하의 숫자를 입력하세요!... \t\n");
            e1.value = e1.defaultValue;
            e1.focus();
            return;
        }else if(errorChk && max == null && min != null)
        {
            alert("\n "+min+" 이상의 숫자를 입력하세요!... \t\n");
            e1.value = e1.defaultValue;
            e1.focus();
            return;
        }else if(errorChk)
        {
            alert("\n 숫자만 입력하세요!... \t\n");
            e1.value = e1.defaultValue;
            e1.focus();
            return;
        }
    }
}

//데이타체크
function dataCheck(e1,data,msg) {
    if(e1.value.length > 0){
        var num =data;
        event.returnValue = true;
        for (var i=0; i<e1.value.length;i++){
            if(-1 == num.indexOf(e1.value.charAt(i)))
            event.returnValue = false;
        }
        if (!event.returnValue){
            alert(msg + ' 이외의 키워드는 거부합니다.\t\n');
            e1.value='';
            e1.focus();
            return false;
        }
        return true;
    }
}

//포커스이동
function MvFocus(e1,len,e2){
    if(e1.value.length==len) e2.focus();
}


//숫자 포맷
function numFormat(num, len) {
    if(num == "") num = "0";
    var temp="";
    for (var i = 0; i < len - num.length; i++) { temp += "0"; }
    num = temp + num;
    return num;
}


//이메일 체크
function EmailCheck(cf){
    if(cf.value.length > 0){
        emailEx1 = /[^@]+@[A-Za-z0-9_\-]+\.[A-Za-z]+/;
        emailEx2 = /[^@]+@[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z]+/;
        emailEx3 = /[^@]+@[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z]+/;
        emailEx4 = /[^@]+@[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z]+/;
        var tmp = true;
        if(cf.value.charAt(cf.value.length*1-1) == "."){
            tmp = false;
        }
        if(emailEx1.test(cf.value) && tmp) return true;
        if(emailEx2.test(cf.value) && tmp) return true;
        if(emailEx3.test(cf.value) && tmp) return true;
        if(emailEx4.test(cf.value) && tmp) return true;
        alert('메일주소가 형식에 맞지 않습니다.\t\n'); 
        cf.value = "";
        cf.focus();
        return false;
    }
} 

/*
//id체크
function Id_Check(element, bKeyUpmode) {
    var id = element.value;
    if(id == "")
    {
        alert('아이디를 입력하세요! \t\n');
        element.focus();
        return false;
    }

	if(user_id_permit_pattern.test(id))
    {
        alert("아이디는 숫자나 영문 대소문자만 사용해야 합니다.! \t\n");
        element.select();
        return false;
    }

	if (bKeyUpmode == true)
		return true;

    if (id.length < user_id_min_len || id.length > user_id_max_len ){
        alert("아이디는 최소 "+user_id_min_len+", 최대 "+user_id_max_len+"자의 영문 대소문자, 숫자만 가능합니다.\t\n");
        element.select();
        return false;
    }

    return true;
}
*/

//비밀번호 체크
function PasswdCheck(element, s, e){
    var pw = element.value;
    var str = /[^a-z0-9A-Z]/;
    if (pw.length < s || pw.length > e || str.test(pw)){
        alert('비밀번호는 최소 '+s+', 최대 '+e+'자의 영문자나 숫자가 조합된 문자열이어야 합니다!! \t\n');
        element.value='';
        element.focus();
        return false;
    }
    return true;
}

//주민등록번호 체크
function JuminCheck(jumin1, jumin2){
    var chk=0;
    var jumin = jumin1.value + '-' + jumin2.value;
    if(jumin.length < 13)
    {
    }
    for (var i = 0; i <=5 ; i++) { 
        chk = chk + ((i%8+2) * jumin.substring(i,i+1)) ;
    }
    for (var i = 6; i <=11 ; i++) { 
        chk = chk + ((i%8+2) * jumin.substring(i+1,i+2));    
    }
    chk = 11 - (chk %11);
    chk = chk % 10;

    if ( chk != jumin.substring(13,14) ) {
        alert ('주민등록번호가 올바르지 않습니다.');
        jumin1.value='';
        jumin2.value='';
        jumin1.focus();
        return false;
    }   
    return true;
}

//사업자 번호번호 체크
function checkBizNum(biznum){
	 if(biznum.length != 10  || !isBusiNo(biznum)){
	    alert("사업자등록번가 올바르지 않습니다");
	    return false ;
	 } 
	 else {
	   return true ;
	 }
}

//
// Sub ID  : isBusino
// Description : 사업자등록번호검사
// Param  : Num - number(10자리)
// Return  : true or false
//
function isBusiNo(NUM) {
	 var sum = 0;
	 var checknum = 0;
	 var anum = new Array(10);
	 var chknum = new Array("1","3","7","1","3","7","1","3","5");
	 for(var i=0;i<10;i++){ anum[i]=NUM.substring(i,i+1); }
	 for(var i=0;i< 9;i++){ sum += anum[i]*chknum[i]; }
	 sum += parseInt((anum[8]*5)/10);
	 checknum = (10 - sum % 10) %10;
	 if(checknum != anum[9]){
	  return false;
	 } else {
	  return true;
	 }
}

  
   
	//id체크
	function Id_Check(element, s, e) {
	    var id = element.value.trim();
	    if(id == "")
	    {
	        alert('아이디를 입력하세요 \t\n');
	        element.focus();
	        return false;
	    }
	
	    var str = /[^a-zA-Z]/;
	    if(str.test(id.substring(0,1)))
	    {
	        alert("아이디는 영문 대소문자로 시작 해야 합니다. \t\n");
	        element.select();
	        return false;
	    }
	
	    if (id.length < s || id.length > e || user_id_permit_pattern.test(id)){
	        alert("아이디는 최소 "+s+", 최대 "+e+"자의 영문 대소문자, 숫자만 가능합니다.\t\n");
	        element.select();
	        return false;
	    }
	
	
	
	    return true;
	}
   
//////////// 해당년월의 마지막일 ////////////
function dateCheck(year, month){
    len = 4;
    if(year == "") year = "0";
    temp = "";
    for (var i = 0; i < len - year.length; i++) { temp += "0"; }
    year = temp + year;

    len = 2;
    if(month == "") month = "0";
    temp = "";
    for (var i = 0; i < len - month.length; i++) { temp += "0"; }
    month = temp + month;

    var total_days = 31;
    if(month == 02) {
          if(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
                  total_days = 29;
          else
                  total_days = 28;
    }else if(month % 2 && month < 8){
                  total_days = 31;
    }else if(!(month % 2) && month < 8){
                  total_days = 30;
    }else if(!(month % 2) && month >= 8){
                  total_days = 31;
    }else{
                   total_days = 30;
    }
    return total_days;
}

function checkDate(fname, yname, mname, dname){
    objY = eval('document.'+fname+'.'+yname);
    objM = eval('document.'+fname+'.'+mname);
    objD = eval('document.'+fname+'.'+dname);

    var year = objY.value;
    var month = objM.value;
    var se_len = objD.options.length;

    for(var i = se_len+1; i <= 31; i++){
        objD[i-1] = new Option();
        objD[i-1].text = i;
        objD[i-1].value = i;
    }

    var total_days = 31;
    if(month == 02) {
          if(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
                  total_days = 29;
          else
                  total_days = 28;
    }else if(month % 2 && month < 8){
                  total_days = 31;
    }else if(!(month % 2) && month < 8){
                  total_days = 30;
    }else if(!(month % 2) && month >= 8){
                  total_days = 31;
    }else{
                   total_days = 30;
    }
    var i;

    for(i = 31; i > total_days; i--){
        objD.options[i-1]= null;
    }
}

function reSizeImg(element, x, y){

    var w = element.width;
    var h = element.height;
    var width, heigh, w1, h1;

    w1 = x;
    h1 = h*(x/w);

    if(h1 > y){
        height = y;
        width = w1*(y/h1);
    }else{
        width = w1;
        height = h1;
    }

    element.width = width;
    element.height = height;

}
/*************************************************
* 사업자등록번호 유효성을 체크한다. 
* 파라메터 : objVal - 사업자등록번호
*************************************************/
function cfSupNoCheck(objVal)
{   
    
    var entry_no = objVal;
    entry_no = entry_no.replace("-","");
    entry_no = entry_no.replace("-","");
    var len =  entry_no.length;
    if(len != 10)
    {
        alert("사업자 등록 번호는 '-'을 제외한 10자리여야 합니다.")
        return false;
    }
    
    var no_1 =  entry_no.substr(0,1); 
    var no_2 = entry_no.substr(1,1); 
    var no_3 = entry_no.substr(2,1); 
    var no_4 = entry_no.substr(3,1); 
    var no_5 = entry_no.substr(4,1); 
    var no_6 = entry_no.substr(5,1); 
    var no_7 = entry_no.substr(6,1); 
    var no_8 = entry_no.substr(7,1); 
    var no_9 = entry_no.substr(8,1); 
    var no_10 = entry_no.substr( 9,1); 
    
    var no_ck;
    no_ck = no_1 * 1; 
    no_ck += no_2 * 3; 
    no_ck += no_3 * 7; 
    no_ck += no_4 * 1; 
    no_ck += no_5 * 3; 
    no_ck += no_6 * 7; 
    no_ck += no_7 * 1; 
    no_ck += no_8 * 3; 
    
    var no_ck_temp = no_9 * 5; 
        
                
    no_ck += parseInt((no_ck_temp / 10), 10);
    no_ck += no_ck_temp % 10;
        
        
    no_ck = no_ck % 10;
        
    no_ck = 10 - no_ck;
        
    if(no_ck == 10)
    {
        no_ck = 0;
    }
        
    if(no_ck == no_10) 
    {
         return true; 
    } 
    else 
    {
        return false; 
    } 
}

function onlyNumber() {
    if ( (event.keyCode<48) || (event.keyCode>57) )
        event.returnValue=false;
}

function chkPatten(field){
 var regNum =/^[0-9]+$/; 
 patten = eval(regNum); 
 if(!patten.test(field.value)){ 
  alert("숫자만 입력해주세요\n\n"); 
  field.focus(); 
  return false; 
 } 
 return true;
}

function chkPattenIP(field){
 var regNum =/^[0-9.]+$/; 
 patten = eval(regNum); 
 if(!patten.test(field.value)){ 
  alert("숫자와 .만 입력해주세요\n\n"); 
  field.focus(); 
  return false; 
 } 
 return true;
}

function chkPattenPhone(field){
 var regNum =/^[0-9-]+$/; 
 patten = eval(regNum); 
 if(!patten.test(field.value)){ 
  alert("숫자와 -만 입력해주세요\n\n"); 
  field.focus(); 
  return false; 
 } 
 return true;
}
 

