function login_need() {
    alert('서비스 이용을 위해서 로그인 하시기 바랍니다'); 
    return;
}
function svc_need() {
    alert('본 처방 정보는 저작자로부터 서비스 허락을 받지 않았습니다. 저작자의 허락을 받아 조속히 서비스할 수 있도록 하겠습니다.');
    return;
}
 


// 상세조회 약재(화합물), 처방(IPC코드, 키워드) 데이터가
// 상당히 긴 관계로 기본표시 시 한줄로 처리
//
// 한줄로 표시된 내용을 전체 다 보여주도록 하는 Dhtml처리
function toggleView1RowContent(vContentId, vSubImg) {

    var vObjContent;    // 데이터의 div id
    var vObjSubImg;        // toggle image id

    vObjContent = document.getElementById(vContentId);
    vObjSubImg = document.getElementById(vSubImg);

    if('' == vObjContent.style.height) {
        vObjSubImg.src = "/images/common/btn_plus_o2.gif";
        vObjContent.style.height = '18px';
    } else {
        vObjSubImg.src = "/images/common/btn_plus_n2.gif";
        vObjContent.style.height = '';
    }
}


//관련특허 보기
function openRefPatent(vKeyword, vName) {

//(A61B+A61K+A61H+A61M+A61N+A61P)

    // 검색키워드 10건까지만 처리
    var vLoop;
    var vTmpKeyword = '';
    var vKeywordCutCount = 10;

    var vRefPatentKeyword = '';

    // 관련특허 키워드의 마지막 +는 제거
    vTmpKeyword = vKeyword;

    // 관련특허 키워드 특수문자 연산자로 변환
    vTmpKeyword = vTmpKeyword.replaceAll(' ', '+').replaceAll(';', '+').replaceAll('(', '+');
    vTmpKeyword = vTmpKeyword.replaceAll(')', ' ').replaceAll(',', '+').replaceAll('^^', '+');
    vTmpKeyword = vTmpKeyword.replaceAll('.', '').replaceAll('<', '+').replaceAll('>', '+');
    vTmpKeyword = vTmpKeyword.replaceAll("'", "").replaceAll('++', '+');

    // 구분 연산자 +로 split 처리
    vTmpKeyword = vTmpKeyword.split('+');

    // 키워드 제한 수량이하로 처리되도록 처리
    if(vTmpKeyword.length > vKeywordCutCount) {
        vLoop = vKeywordCutCount;
    } else {
        vLoop = vTmpKeyword.length;
    }

    if(vLoop == 0) {
        vRefPatentKeyword = vTmpKeyword[inx];
    } else {
        // 키워드 조합
        for(var inx = 0; inx < vLoop; inx++) {
            vRefPatentKeyword += vTmpKeyword[inx] + '+';
        }

        vRefPatentKeyword = vRefPatentKeyword.substr(0, vRefPatentKeyword.length-1);
    }

    if(vRefPatentKeyword.substr(vRefPatentKeyword.length-1, vRefPatentKeyword.length) == '+') {
        vRefPatentKeyword = vRefPatentKeyword.substr(0, vRefPatentKeyword.length-1);
    }

    // 표제어(명칭) 추가(약재, 병증, 처방에만 해당)
    if ( typeof vName != "undefined" ) {
        vTmpKeyword = vName.split('(');

        vRefPatentKeyword = vTmpKeyword[0] + '+(' + vRefPatentKeyword + ')';
    }

    vRefPatentKeyword = '(A61B+A61K+A61H+A61M+A61N+A61P)*('+vRefPatentKeyword+')';

    if(vRefPatentKeyword == '' || vKeyword == '&nbsp;') {
        alert('검색 키워드가 존재하지 않습니다.');
    } else {

        document.f.kiprisQuery.value = vRefPatentKeyword;
        popUp('/m_ref/ref_ptn_show.html', 'refPatentView', 1140, 700, 'yes', 'yes');
    }
}

//관련논문보기_팝업창 추가 
function viewRefThesisPop(){

    popUp('', 'refThesis', 550, 500, 'no', 'no');

   document.f.cmd.value = 8;
    document.f.action = "/servlet/TotalSearchServlet";
    document.f.target = "refThesis";
    document.f.submit();
}
    
/*---------------------------------------------------------------------
* 명칭 조회 팝업창
*---------------------------------------------------------------------*/
function nm_pop(obj,gubun) {

	   var temUrl = "/popup/nm/nmMain.jsp?langType=K&gubun="+gubun;
	   
	   var width = 500;
	   var height = 500;
	   var top = screen.height/2-height/2;
	   var left= screen.width/2-width/2;
	   var chars = "@?;#$%^|_\\.,'<>[](){}\"";
	   var pop =window.showModalDialog(temUrl,"","status:no;dialogWidth:500px;dialogHeight:505px;center:yes;scroll:no");

	   if(pop != null && pop.length > 0) {
		   obj.value = charToSpace(pop[1],chars); //특수문자제거       
	   }
}

/*---------------------------------------------------------------------
* 명칭 조회 팝업창
*---------------------------------------------------------------------*/
function book_pop(obj,gubun) {

	   var temUrl = "/popup/book/bookMain.jsp?langType=K&gubun="+gubun;

	   var width = 500;
	   var height = 500;
	   var top = screen.height/2-height/2;
	   var left= screen.width/2-width/2;
	   var chars = "@?;#$%^|_\\.,'<>[](){}\"";
	   var pop =window.showModalDialog(temUrl,"","status:no;dialogWidth:500px;dialogHeight:505px;center:yes;scroll:no");

	   if(pop != null && pop.length > 0) {
		   obj.value = charToSpace(pop[1],chars); //특수문자제거       
	   }
}

//스토리보드 보기
function viewStroy() {
    document.getElementById('esMenuLayer').style.visibility = "hidden";
    popUp('', 'story', 780, 700, "yes");

    document.f.cmd.value = 5;
    document.f.query.value = storyQueryChk(selectedphrase);
    document.f.action = "/servlet/TotalResultServlet";
    document.f.target = 'story';
    document.f.submit();
}

/* -----------------------------------------------------------
 * 스토리보드 보기 시 질의어 가공하기
 * -----------------------------------------------------------*/
function storyQueryChk(input) {

    var query = input.replaceAll("\n",'');   //개행문자 삭제
    var chars = "@?;#$%^|_\\.,'<>[](){}\"";
    query = charToSpace(query,chars);         //특수문자제거
    query = removeOneChar(query);            //한문자 삭제

    return query;
}

/* -----------------------------------------------------------
 * 입력된문자를 공백으로 변환하는 함수
 * -----------------------------------------------------------*/
function charToSpace(input,chars) {
    var rtnValue = "";
    for (var inx = 0; inx < input.length; inx++) {
       if (chars.indexOf(input.charAt(inx)) == -1)
            rtnValue += input.charAt(inx);
       else
            rtnValue += ' ';
    }
    return rtnValue;
}

// 화합물 정보 페이지 연결
function fChemView(vDetailCode) {
    //userPopUp('/chem/KZ0400.jsp?cinfo=' + vDetailCode, 'chemView', 650, 750, 0, 0, 'yes', 'yes');
    popUp('/m_che/che_view_popup.jsp?cinfo=' + vDetailCode, 'chemView', 650, 650, 'yes');
}

// 용어사전 연결
function openDicSearch2() {
    document.getElementById('esMenuLayer').style.visibility = "hidden";

    openDicSearch(selectedphrase);
}

var oldEasySearchWordValue = '';
var selectedphrase = '';
var esAutoHidOnOff;

// 텍스트 드래그 앤 드롭 처리
function selectMouseBlock() {
    var wrd ;            // 선택한 객체

    document.getElementById('esMenuLayer').style.visibility = "hidden";
    if (event.button == 1){

        // 선택한 부분의 객체 획득
        wrd = document.selection.createRange();

        // 선택한 객체안의 문자열 획득
        selectedphrase = wrd.text.trim();

        // 무결성체크-선택의 정확성 무효처리
        if( oldEasySearchWordValue == selectedphrase && selectedphrase != "" ){
            oldEasySearchWordValue = '';
            document.selection.empty();
            return;
        }

        // 무결성체크-문자열 길이체크 무효처리
        if(selectedphrase == "") {
            return;
        }

        positionmenu(event);
    }
}

function positionmenu(e){
    var tipobj = document.all['esMenuLayer'];

    var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
    var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
    //Find out how close the mouse is to the corner of the window
    var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint
    var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint

    var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

    //if the horizontal distance isn't enough to accomodate the width of the context menu
    if (rightedge<tipobj.offsetWidth)
    //move the horizontal position of the menu to the left by it's width
    tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
    else if (curX<leftedge)
    tipobj.style.left="5px"
    else
    //position the horizontal position of the menu where the mouse is positioned
    //window.status = curX;

    if(curX > 400) {
        tipobj.style.left=curX+offsetxpoint+"px"
    } else {
        tipobj.style.left=curX+"px"
    }

    //same concept with the vertical position
    if (bottomedge<tipobj.offsetHeight)
        tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
    else
        tipobj.style.top=curY+offsetypoint+"px"

    tipobj.style.visibility="visible"
}

// 메뉴 링크 처리
//화합물 검색 시스템
function chemSearch(){
    userPopUp('/chem/KZ0100.jsp','chemPop', 1168, 750, 0, 0, 'yes', 'yes');
}

//용어사전
function openDicSearch(vKeyword){

    var vParameter = '';

    if ( typeof vKeyword != "undefined" ) {
        vParameter = '?keyword=' + encodeURIComponent(vKeyword);
    }

    //popUp('/m_dic/JZ1800.jsp' + vParameter, 'dictionary', 670, 610);
    popUp('/m_dic/JZ1800.jsp' + vParameter, 'dictionary', 670, 605);
}

//한양방 병증매핑
function openWestDisSearch(){
    //popUp('/m_wes/JZ1900.jsp', 'westDisease', 705, 537);
    popUp('/m_wes/JZ1900.jsp', 'westDisease', 670, 510);
}

// 상세정보화면 가기
// 기존 함수 기능 유지 차원에서 만들어둔 것임.
function go_detail(gubun,code) {
    fDetailView2(gubun.substr(0, 1), code, document.f);
}

function go_detail3(gubun,code,frm) {
    fDetailView2(gubun.substr(0, 1), code, document.f);
}

//2007.09.20 추가된 함수 : go_detail(gubun,code) 함수에 frm 폼객체인자 추가
//2008.10.09 수정 : go_detail(gubun,code,frm) 함수에 _self를 _blank로 수정, 팝업추가
//2008.10.30 추가 : 네비게이션 위핸 ctrllist,sorder,pagesize 추가
//  popUp('', 'refPatentQuery', 550, 500, 'no', 'no');
function go_detail(gubun,code,frm,ctrllist,sorder,pagesize) {

var vProcessUrl= '';
	if(gubun.substr(0,1)=='T'){
		
			//한 영처리
			vProcessUrl = '/servlet/ThesisDetailServlet?cmd=1' + '&ctrl_no=' + code + '&searchGbn=thesis' + '&view_type=';
			if ( typeof document.f.view_type == "undefined" || document.f.view_type.value == "null") {
	            vProcessUrl += 'kor';
	            popUp(vProcessUrl + '&window=popup&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder, 'detailView', 800, 700, 'yes');
	        } else {
	            if(document.f.view_type.value == '') {
	                vProcessUrl += 'kor';
	            } else {
	                vProcessUrl += document.f.view_type.value;
	            }
	        }
        
		//fDetailView(gubun.substr(0, 1), code, frm, '_blank');
	}else if(gubun.substr(0,1)=='M'){
	
			//한 영처리
			vProcessUrl = '/servlet/MedicDetailServlet?cmd=1' + '&med_cd=' + code + '&searchGbn=medic' + '&view_type=';
			if ( typeof document.f.view_type == "undefined" || document.f.view_type.value == "null") {
	            vProcessUrl += 'kor';
	            popUp(vProcessUrl + '&window=popup&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder, 'detailView', 800, 700, 'yes');
	        } else {
	            if(document.f.view_type.value == '') {
	                vProcessUrl += 'kor';
	            } else {
	                vProcessUrl += document.f.view_type.value;
	            }
	        }
		//fDetailView(gubun.substr(0, 1), code, frm, '_blank');
	}else if(gubun.substr(0,1)=='P'){
		//한 영처리
			vProcessUrl = '/servlet/PrescriptDetailServlet?cmd=1' + '&pre_cd=' + code + '&searchGbn=prescript' + '&view_type=';
			if ( typeof document.f.view_type == "undefined" || document.f.view_type.value == "null") {
	            vProcessUrl += 'kor';
	            popUp(vProcessUrl + '&window=popup&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder, 'detailView', 800, 700, 'yes');
	        } else {
	            if(document.f.view_type.value == '') {
	                vProcessUrl += 'kor';
	            } else {
	                vProcessUrl += document.f.view_type.value;
	            }
	        }
		//fDetailView(gubun.substr(0, 1), code, frm, '_self',ctrllist,sorder,pagesize);
	}else if(gubun.substr(0,1)=='D'){
		//한 영처리
			vProcessUrl = '/servlet/DiseaseDetailServlet?cmd=1' + '&dis_cd=' + code + '&searchGbn=disease' + '&view_type=';
			if ( typeof document.f.view_type == "undefined" || document.f.view_type.value == "null") {
	            vProcessUrl += 'kor';
	            popUp(vProcessUrl + '&window=popup&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder, 'detailView', 800, 700, 'yes');
	        } else {
	            if(document.f.view_type.value == '') {
	                vProcessUrl += 'kor';
	            } else {
	                vProcessUrl += document.f.view_type.value;
	            }
	        }
	//전통음식 (2009.10.23 khm 추가)
	}else if(gubun.substr(0,1)=='F'){ 
		
		//한 영처리
		vProcessUrl = '/servlet/FoodDetailServlet?cmd=1' + '&food_cd=' + code + '&searchGbn=food' + '&view_type=';
		if ( typeof document.f.view_type == "undefined" || document.f.view_type.value == "null") {
            vProcessUrl += 'kor';
            popUp(vProcessUrl + '&window=popup&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder, 'detailView', 800, 700, 'yes');
        } else {
            if(document.f.view_type.value == '') {
                vProcessUrl += 'kor';
            } else {
                vProcessUrl += document.f.view_type.value;
            }
        }
		//fDetailView(gubun.substr(0, 1), code, frm, '_blank');
	//생활기술 (2009.11.05 khm 추가)
	}else if(gubun.substr(0,1)=='L'){ 
		
		//한 영처리
		vProcessUrl = '/servlet/LifeDetailServlet?cmd=1' + '&art_no=' + code + '&searchGbn=life' + '&view_type=';
		if ( typeof document.f.view_type == "undefined" || document.f.view_type.value == "null") {
	        vProcessUrl += 'kor';
	        popUp(vProcessUrl + '&window=popup&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder, 'detailView', 800, 700, 'yes');
	    } else {
	        if(document.f.view_type.value == '') {
	            vProcessUrl += 'kor';
	        } else {
	            vProcessUrl += document.f.view_type.value;
	        }
	    }
		//fDetailView(gubun.substr(0, 1), code, frm, '_blank');
	//농업기술 (2009.11.12 khm 추가)
	}else if(gubun.substr(0,1)=='A'){ 
		
		//한 영처리
		vProcessUrl = '/servlet/LifeDetailServlet?cmd=1' + '&art_no=' + code + '&searchGbn=agri' + '&view_type=';
		if ( typeof document.f.view_type == "undefined" || document.f.view_type.value == "null") {
	        vProcessUrl += 'kor';
	        popUp(vProcessUrl + '&window=popup&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder, 'detailView', 800, 700, 'yes');
	    } else {
	        if(document.f.view_type.value == '') {
	            vProcessUrl += 'kor';
	        } else {
	            vProcessUrl += document.f.view_type.value;
	        }
	    }
		//fDetailView(gubun.substr(0, 1), code, frm, '_blank');
	}
}

function go_detail_tot(gubun,code,frm,ctrllist,sorder,pagesize) {
var vProcessUrl= '';
//2008.10.14 수정 : 약재검색일 때만 _blank 
//2008.11.3 추가 : 네비게이션 위핸 ctrllist,sorder,pagesize 추가
	if(gubun.substr(0,1)=='T'){
		vProcessUrl = '/servlet/ThesisDetailServlet?cmd=1' + '&ctrl_no=' + code + '&searchGbn=thesis' + '&view_type=';
		vProcessUrl += 'kor';
		popUp(vProcessUrl + '&window=popup&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder, 'detailView', 800, 700, 'yes');
	}
	else if(gubun.substr(0,1)=='M'){
		vProcessUrl = '/servlet/MedicDetailServlet?cmd=1' + '&med_cd=' + code + '&searchGbn=medic' + '&view_type=';
		vProcessUrl += 'kor';
		popUp(vProcessUrl+ '&window=popup&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder , 'detailView', 800, 700, 'yes');
		//fDetailView_tot(gubun.substr(0, 1), code, frm, '_blank');
	}else if(gubun.substr(0,1)=='P'){
		vProcessUrl = '/servlet/PrescriptDetailServlet?cmd=1' + '&pre_cd=' + code + '&searchGbn=prescript' + '&view_type=';
		vProcessUrl += 'kor';
		popUp(vProcessUrl + '&window=popup&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder, 'detailView', 800, 700, 'yes');

	}else if(gubun.substr(0,1)=='D'){
		vProcessUrl = '/servlet/DiseaseDetailServlet?cmd=1' + '&dis_cd=' + code + '&searchGbn=disease' + '&view_type=';
		vProcessUrl += 'kor';
		popUp(vProcessUrl + '&window=popup&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder, 'detailView', 800, 700, 'yes');
		
	}else if(gubun.substr(0,1)=='F'){ //KHM 전통음식 추가 20091116
		vProcessUrl = '/servlet/FoodDetailServlet?cmd=1' + '&food_cd=' + code + '&searchGbn=food' + '&view_type=';
		vProcessUrl += 'kor';
		popUp(vProcessUrl + '&window=popup&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder, 'detailView', 800, 700, 'yes');
		
	}else if(gubun.substr(0,1)=='A'){ //KHM 생업기술 추가 20091116
		vProcessUrl = '/servlet/LifeDetailServlet?cmd=1' + '&art_no=' + code + '&searchGbn=agri' + '&view_type=';
		vProcessUrl += 'kor';
		popUp(vProcessUrl + '&window=popup&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder, 'detailView', 800, 700, 'yes');
		
	}else if(gubun.substr(0,1)=='L'){ //KHM 생활기술 추가 20091116
		vProcessUrl = '/servlet/LifeDetailServlet?cmd=1' + '&art_no=' + code + '&searchGbn=life' + '&view_type=';
		vProcessUrl += 'kor';
		popUp(vProcessUrl + '&window=popup&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder, 'detailView', 800, 700, 'yes');
		
	}
}  

function go_detail_sim(gubun,code,frm,ctrllist,sorder,pagesize) {
    fDetailView_sim(gubun.substr(0, 1), code, frm, '_self',ctrllist,sorder,pagesize);
}


/* 강대권추가
 * 상세보기 공통 함수
 */
function fDetailView(vDetailType, vDetailCode, vForm, vTarget,ctrllist,sorder,pagesize) {
    var vParameter = '?cmd=1';
    var vServletName = '';
    var vProcessUrl = '';
    // 상세타입에 따른 페이지 주소 설정
    switch(vDetailType) {
        // 논문
        case 'T' :
            vParameter += '&ctrl_no=' + vDetailCode + '&searchGbn=thesis';
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'ThesisDetailServlet';
            
            break;

        // 약재
        case 'M' :
            vParameter += '&med_cd=' + vDetailCode + '&searchGbn=medic';
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'MedicDetailServlet';
            break;

        // 병증
        case 'D' :
            vParameter += '&dis_cd=' + vDetailCode + '&searchGbn=disease';
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'DiseaseDetailServlet';
            break;

        // 처방
        case 'P' :
            vParameter += '&pre_cd=' + vDetailCode + '&searchGbn=prescript';
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'PrescriptDetailServlet';
            break;
            
        // 전통음식( khm 추가 091027)
        case 'F' :
            vParameter += '&food_cd=' + vDetailCode + '&searchGbn=food';
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'FoodDetailServlet';
            break;
            
        // 생업기술( khm 추가 091027)
        case 'A' :
        	vParameter += '&art_no=' + vDetailCode + '&searchGbn=agri';
        	vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
        	vServletName = 'LifeDetailServlet';
        	break;      
        	
        // 생활기술( khm 추가 091027)
        case 'L' :
        	vParameter += '&art_no=' + vDetailCode + '&searchGbn=life';
        	vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
        	vServletName = 'LifeDetailServlet';
        	break;            

        // 로그인 안된 경우
        case 'O' :
            alert('서비스 이용을 위해서 로그인 하시기 바랍니다');
            break;

        default :
            alert('처리할 수 없는 상세조회 입니다.');
            return false;
    }

    if(vDetailType != 'O') {
        vProcessUrl = '/servlet/' + vServletName + vParameter + '&view_type=';

        // 한/영 구분값 처리
        //try{ vQuery = document.f.view_type.value; } catch(e) { return false };

        if ( typeof document.f.view_type == "undefined" || document.f.view_type.value == "null") {
            vProcessUrl += 'kor';
            
        } else {
            if(document.f.view_type.value == '') {
                vProcessUrl += 'kor';
            } else {
                vProcessUrl += document.f.view_type.value;
            }
        }

        if ( typeof vForm == "undefined" ) {
            popUp(vProcessUrl + '&window=popup', 'detailView', 800, 700, 'yes');
        } else {
            vForm.action = vProcessUrl;
            vForm.target = vTarget;
            vForm.submit();
        }
    }
}

function fDetailView1(vDetailType, vDetailCode, vForm, vTarget,ctrllist,sorder,pagesize) {
    var vParameter = '?cmd=1';
    var vServletName = '';
    var vProcessUrl = '';
    // 상세타입에 따른 페이지 주소 설정
    switch(vDetailType) {
        // 논문
        case 'T' :
            vParameter += '&ctrl_no=' + vDetailCode + '&searchGbn=thesis';
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'ThesisDetailServlet';
            break;

        // 약재
        case 'M' :
            vParameter += '&med_cd=' + vDetailCode + '&searchGbn=medic';
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'MedicDetailServlet';
            break;

        // 병증
        case 'D' :
            vParameter += '&dis_cd=' + vDetailCode + '&searchGbn=disease';
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'DiseaseDetailServlet';
            break;

        // 처방
        case 'P' :
            vParameter += '&pre_cd=' + vDetailCode + '&searchGbn=prescript';
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'PrescriptDetailServlet';
            break;

        // 로그인 안된 경우
        case 'O' :
            alert('서비스 이용을 위해서 로그인 하시기 바랍니다');
            break;

        default :
            alert('처리할 수 없는 상세조회 입니다.');
            return false;
    }

    if(vDetailType != 'O') {
        vProcessUrl = '/servlet/' + vServletName + vParameter + '&view_type=';

        // 한/영 구분값 처리
        //try{ vQuery = document.f.view_type.value; } catch(e) { return false };

        if ( typeof document.f.view_type == "undefined" || document.f.view_type.value == "null") {
            vProcessUrl += 'kor';
        } else {
            if(document.f.view_type.value == '') {
                vProcessUrl += 'kor';
            } else {
                vProcessUrl += document.f.view_type.value;
            }
        }

        if ( typeof vForm == "undefined" ) {
            popUp(vProcessUrl + '&window=popup', 'detailView', 800, 700, 'yes');
        } else {
            vForm.action = vProcessUrl;
            vForm.target = vTarget;
            vForm.submit();
        }
    }
}


function fDetailView2(vDetailType, vDetailCode) {
    var vParameter = '?cmd=3';
    var vServletName = '';
    var vProcessUrl = '';
    // 상세타입에 따른 페이지 주소 설정
    switch(vDetailType) {
        // 논문
        case 'T' :
            vParameter += '&ctrl_no=' + vDetailCode + '&searchGbn=thesis';
            vServletName = 'ThesisDetailServlet';
            break;

        // 약재
        case 'M' :
            vParameter += '&med_cd=' + vDetailCode + '&searchGbn=medic';
            vServletName = 'MedicDetailServlet';
            break;

        // 병증
        case 'D' :
            vParameter += '&dis_cd=' + vDetailCode + '&searchGbn=disease';
            vServletName = 'DiseaseDetailServlet';
            break;

        // 처방
        case 'P' :
            vParameter += '&pre_cd=' + vDetailCode + '&searchGbn=prescript';
            vServletName = 'PrescriptDetailServlet';
            break;     

        // 로그인 안된 경우
        case 'O' :
            alert('서비스 이용을 위해서 로그인 하시기 바랍니다');
            break;

        default :
            alert('처리할 수 없는 상세조회 입니다.');
            return false;
    }

    if(vDetailType != 'O') {
        vProcessUrl = '/servlet/' + vServletName + vParameter + '&view_type=';

        // 한/영 구분값 처리
        //try{ vQuery = document.f.view_type.value; } catch(e) { return false };

        if ( typeof document.f.view_type == "undefined" || document.f.view_type.value == "null") {
            vProcessUrl += 'kor';
        } else {
            if(document.f.view_type.value == '') {
                vProcessUrl += 'kor';
            } else {
                vProcessUrl += document.f.view_type.value;
            }
        }

        if ( typeof vForm == "undefined" ) {
            popUp(vProcessUrl + '&window=popup', 'detailView', 800, 700, 'yes');
        } else {
            vForm.action = vProcessUrl;
            vForm.target = vTarget;
            vForm.submit();
        }
    }
}


function fDetailView_tot(vDetailType, vDetailCode, vForm, vTarget,ctrllist,sorder,pagesize) {
    var vParameter = '?cmd=1';
    var vServletName = '';
    var vProcessUrl = '';
    // 상세타입에 따른 페이지 주소 설정
    switch(vDetailType) {
        // 논문
        case 'T' :
            vParameter += '&ctrl_no=' + vDetailCode;
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'ThesisDetailServlet';
            break;

        // 약재
        case 'M' :
            vParameter += '&med_cd=' + vDetailCode;
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'MedicDetailServlet';
            break;

        // 병증
        case 'D' :
            vParameter += '&dis_cd=' + vDetailCode;
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'DiseaseDetailServlet';
            break;

        // 처방
        case 'P' :
            vParameter += '&pre_cd=' + vDetailCode;
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'PrescriptDetailServlet';
            break;

        // 로그인 안된 경우
        case 'O' :
            alert('서비스 이용을 위해서 로그인 하시기 바랍니다');
            break;

        default :
            alert('처리할 수 없는 상세조회 입니다.');
            return false;
    }

    if(vDetailType != 'O') {
        vProcessUrl = '/servlet/' + vServletName + vParameter + '&view_type=';

        // 한/영 구분값 처리
        //try{ vQuery = document.f.view_type.value; } catch(e) { return false };

        if ( typeof document.f.view_type == "undefined" || document.f.view_type.value == "null") {
            vProcessUrl += 'kor';
        } else {
            if(document.f.view_type.value == '') {
                vProcessUrl += 'kor';
            } else {
                vProcessUrl += document.f.view_type.value;
            }
        }

        // 통합검색으로 부터 넘어온 결과 페이지 인지 구분 인자 추가
        vProcessUrl += '&fromTOT=Y';

        if ( typeof vForm == "undefined" ) {
            popUp(vProcessUrl + '&window=popup', 'detailView', 800, 700, 'yes');
        } else {
            vForm.action = vProcessUrl;
            vForm.target = vTarget;
            vForm.submit();
        }
    }
}


function fDetailView_sim(vDetailType, vDetailCode, vForm, vTarget,ctrllist,sorder,pagesize) {
    var vParameter = '?cmd=1';
    var vServletName = '';
    var vProcessUrl = '';
    // 상세타입에 따른 페이지 주소 설정
    switch(vDetailType) {
        // 논문
        case 'T' :
            vParameter += '&ctrl_no=' + vDetailCode;
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'ThesisDetailServlet';
            break;

        // 약재
        case 'M' :
            vParameter += '&med_cd=' + vDetailCode;
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'MedicDetailServlet';
            break;

        // 병증
        case 'D' :
            vParameter += '&dis_cd=' + vDetailCode;
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'DiseaseDetailServlet';
            break;

        // 처방
        case 'P' :
            vParameter += '&pre_cd=' + vDetailCode;
            vParameter += '&ctrllist='+ctrllist+'&pagesize='+pagesize+'&sorder='+sorder;
            vServletName = 'PrescriptDetailServlet';
            break;

        // 로그인 안된 경우
        case 'O' :
            alert('서비스 이용을 위해서 로그인 하시기 바랍니다');
            break;

        default :
            alert('처리할 수 없는 상세조회 입니다.');
            return false;
    }

    if(vDetailType != 'O') {
        vProcessUrl = '/servlet/' + vServletName + vParameter + '&view_type=';

        // 한/영 구분값 처리
        //try{ vQuery = document.f.view_type.value; } catch(e) { return false };

        if ( typeof document.f.view_type == "undefined" || document.f.view_type.value == "null") {
            vProcessUrl += 'kor';
        } else {
            if(document.f.view_type.value == '') {
                vProcessUrl += 'kor';
            } else {
                vProcessUrl += document.f.view_type.value;
            }
        }

        // 유사처방검색으로 부터 넘어온 결과 페이지 인지 구분 인자 추가
        vProcessUrl += '&fromSIM=Y';

        if ( typeof vForm == "undefined" ) {
            popUp(vProcessUrl + '&window=popup', 'detailView', 800, 700, 'yes');
        } else {
            vForm.action = vProcessUrl;
            vForm.target = vTarget;
            vForm.submit();
        }
    }
}

/* -----------------------------------------------------------
 * 검색결과 일괄조회 공통 함수
 * -----------------------------------------------------------*/
function fShowInResult(frm){

    var resultCnt = 0;
    var sectionCnt = 0;

    if(frm.chkDocId != null){
        for(var i = 0; i < frm.chkDocId.length-1; i++){
            if(frm.chkDocId[i].checked)
                resultCnt++;
        }
    }
    if(frm.chkList != null){
        for(var i = 0; i < frm.chkList.length; i++){
            if(frm.chkList[i].checked)
                sectionCnt++;
        }
    }
    if(frm.chkList_E != null){
        for(var i = 0; i < frm.chkList_E.length; i++){
            if(frm.chkList_E[i].checked)
                sectionCnt++;
        }
    }

    if(resultCnt == 0){
        alert("한개 이상의 결과를  선택하세요");
    }else if(sectionCnt == 0){
        alert("한개 이상의 필드를 선택하세요");
    }else {

        popUp('', 'resultReShow', 760, 650, 'yes');

        frm.action = '/servlet/ACommonProcessServlet?cmd=4';
        frm.target = 'resultReShow';
        frm.submit();
    }
}


//--------------------------디자인 관련 함수 추가 시작 ------------------------//
function popLayer(inx) {
    for (var i=0;i<=1;i++) {
    document.all.showMenu[i].style.display ="none";
    document.all.showList[i].style.display  =  "none";
    }

    document.all.showMenu[inx].style.display ="";
    document.all.showList[inx].style.display  =  "";
}



function allblur() {
    if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin = allblur;



function mover(obj, cname) {
    obj.className = cname;
}

function mover_dic(obj, td_bg, font_color) {
//    obj.style.backgroundColor = td_bg;
//    obj.style.font.color = font_color;
}


//아이프레임 내부에서리사이징
function resizeFrame(){
    self.resizeTo(document.body.scrollWidth + (document.body.offsetWidth-document.body.clientWidth), parseInt(document.body.scrollHeight));
}


function Flash(id,url,w,h,bg,t){
document.write("\
<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width="+w+" height="+h+" id="+id+">\
<param name='movie' value="+url+" />\
<param name='wmode' value="+t+" />\
<param name='bgcolor' value="+bg+" />\
<param name='allowScriptAccess' value='always' />\
<param name='quality' value='high' />\
<param name='menu' value='false' />\
<embed src="+url+" width="+w+" height="+h+" name="+id+" bgcolor="+bg+" allowScriptAccess='always' quality='high' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\
</object>\
");
}


function popup(link_id) {

  var path="/web/";

   if(link_id == 'useguide') {          //홈페이지 이용안내
    window.open("/contents/user_manual.pdf","manual","top=10, left=10, width=900, height=700, resizable=yes, menubar=no, toolbar=no, statusbar=no, scrollbars=no, location=no");
   }

   if(link_id == 'viewer') {          //뷰어다운로드
    window.open("/contents/viewer.html","winpop","top=10, left=10, width=570, height=610, resizable=no, menubar=no, toolbar=no, statusbar=no, scrollbars=no, location=no");
   }

   if(link_id == 'privacy') {          //개인정보보호정책
    window.open("/contents/privacy.html","winpop","top=10, left=10, width=570, height=600, resizable=no, menubar=no, toolbar=no, statusbar=no, scrollbars=no, location=no");
   }

   if(link_id == 'copyright') {          //저작권정책
    window.open("/contents/copyright.html","winpop","top=10, left=10, width=570, height=535, resizable=no, menubar=no, toolbar=no, statusbar=no, scrollbars=no, location=no");
   }

   if(link_id == 'email') {          //이메일무단수집거부
    window.open("/contents/email.html","winpop","top=10, left=10, width=470, height=215, resizable=no, menubar=no, toolbar=no, statusbar=no, scrollbars=no, location=no");
   }

   if(link_id == 'sitelink') {          //관련사이트
    window.open("/contents/sitelink.html","winpop","top=10, left=10, width=520, height=320, resizable=no, menubar=no, toolbar=no, statusbar=no, scrollbars=no, location=no");
   }

   if(link_id == 'calendar') {          //캘린더
    window.open("/manager/calendar.html","winpop","top=10, left=10, width=184, height=180, resizable=no, menubar=no, toolbar=no, statusbar=no, scrollbars=no, location=no");
   }

   if(link_id == 'chem_help01') {          //구조검색
    window.open("/chem/chem_help01.html","winpop","top=10, left=10, width=710, height=500, resizable=no, menubar=no, toolbar=no, statusbar=no, scrollbars=yes, location=no");
   }

   if(link_id == 'chem_help02') {          //Drawing Tool 사용법
    window.open("/chem/chem_help02.html","winpop","top=10, left=10, width=710, height=500, resizable=no, menubar=no, toolbar=no, statusbar=no, scrollbars=yes, location=no");
   }

   if(link_id == 'chem_help03') {          //Drawing Tool 설치방법
    window.open("/chem/chem_help03.html","winpop","top=10, left=10, width=710, height=500, resizable=no, menubar=no, toolbar=no, statusbar=no, scrollbars=yes, location=no");
   }

   if(link_id == 'input_system01') {          //가나다보기
    window.open("/input_system/pop_word_list.html","winpop","top=10, left=10, width=580, height=500, resizable=no, menubar=no, toolbar=no, statusbar=no, scrollbars=yes, location=no");
   }

   if(link_id == 'input_system02') {          //한번에보기
    window.open("/input_system/pop_total_list.html","winpop","top=10, left=10, width=580, height=500, resizable=no, menubar=no, toolbar=no, statusbar=no, scrollbars=yes, location=no");
   }

   if(link_id == 'input_system03') {          //용어사전
    window.open("/input_system/pop_wordict_write.html","winpop","top=10, left=10, width=580, height=500, resizable=no, menubar=no, toolbar=no, statusbar=no, scrollbars=yes, location=no");
   }

   if(link_id == 'link') {          //뷰어다운로드
    window.open("/en/contents/link.html","winpop","top=10, left=10, width=500, height=610, resizable=no, menubar=no, toolbar=no, statusbar=no, scrollbars=yes, location=no");
   }
}


function onchange_location(form) {
    switch(form.value) {
        case 'top'        :    top.location=form.options[form.selectedIndex].name;
                                break;
        case 'parent'    :    parent.location=form.options[form.selectedIndex].name;
                                break;
        case 'blank'    :    window.open(form.options[form.selectedIndex].name);
                                break;
        default            :    self.location="intro.jsp";

        }
        form.selectedIndex=0;
        form.blur();
        return;
    }


function set_date(job, val) {
    if(job == "y") document.f_date.yy.value=val;

    yv=parseInt(document.f_date.yy.value);
    if(job == "m"){
        if(val < 13 || val > 0) document.f_date.mm.value=val;

        if(val == 13){
            document.f_date.yy.value=yv + 1;
            document.f_date.mm.value=1;
        }

        if(val == 0){
            document.f_date.yy.value=yv - 1;
            document.f_date.mm.value=12;
        }
    }
    document.f_date.submit();
}




function winOpen(num) {
   //***** 글로벌 메뉴링크*****
  var path="/web/";
   if(num == 1) {                                //논문검색
      document.location.href = "/";
   }
   if(num == 2) {                                //약재검색
      document.location.href ="/";
   }
   if(num == 3) {                                //병증검색
      document.location.href ="/";
   }
   if(num == 4) {                                //처방검색
      document.location.href ="/";
   }
   if(num == 5) {                                //유사처방검색
      document.location.href ="/";
   }
   if(num == 6) {                                //용어사전
      document.location.href ="/";
   }
   if(num == 7) {                                //한양방매핑사전
      document.location.href ="/";
   }
   if(num == 8) {                                //화합물검색시스템
      document.location.href ="/";
   }
   if(num == 9) {                                //통계정보
      document.location.href ="/";
   }
        if(num == 91) {                        // 약재별 통계
        document.location.href ="/";
        }
        if(num == 92) {                        // 처방별 통계
        document.location.href ="/";
        }
        if(num == 93) {                        // 병증별 통계
        document.location.href ="/";
        }
        if(num == 94) {                        // 효능별 통계
        document.location.href ="/";
        }
        if(num == 95) {                        // 학회별 통계
        document.location.href ="/";
        }
        if(num == 96) {                        // 년도별 통계
        document.location.href ="/";
        }
}

//--------------------------디자인 관련 함수 추가 끝 ------------------------//
//--------------------------검색관련 공통 함수시작    -----------------------//


    // 자동질의확장 검색조건 부분 Hidden 프레임에 적용
    function fAutoExpandHidden() {
        for(var inx = 0; inx < document.f.autoExpand.length; inx++) {
            top.frames['hidden'].document.f.autoExpand[inx].checked = document.f.autoExpand[inx].checked;
        }
    }

    /*---------------------------------------------------------------------
    *필드검색 사용자 질의어삭제
    *---------------------------------------------------------------------*/
    function fDeleteQuery2() {

        var vTb = document.getElementById('tb');
        var rowIndex = vTb.rows.length-1;

        for (var idx = rowIndex; idx > 0; idx--) {
            vTb.deleteRow(idx);
        }
    }

    /*---------------------------------------------------------------------
    *필드검색 사용자 질의어 쓰기
    *---------------------------------------------------------------------*/
    function fWriteQuery2 (frm) {

        //입력된 사용자 질의어 삭제
        fDeleteQuery2();

        var el = frm.elements;
        var fullQuery = ''; //상세조회에서 하이라이팅 할 쿼리
        var vValue, words;

        for(var inx = 0; inx < el.length; inx++)
        {
            if(el[inx].type == "text" || el[inx].type == "textarea") {

                vValue = trim(el[inx].value);

                if(vValue != '') {

                    //1.숫자필드 체크
                    if(el[inx].className  == 'inputwrite_num'){

                        if(NumberFldChk(vValue) == false){
                            alert("숫자로 구성된 항목에는 숫자와 범위연산자(~)만 입력하여 검색할 수 있습니다");
                            frm.elements[inx].focus();
                            return false;
                        }

                    }else if(el[inx].className  == 'inputwrite_date'){

                        if(vValue.indexOf('~') != -1 && vValue.indexOf('*') != -1) {
                            alert("*를 이용한 검색은 시작날짜만 입력되어 있어야 합니다");
                            frm.elements[inx-1].focus();
                            return false;
                        }

                    }else{

                        if(vValue.indexOf('~') != -1){
                            alert("'" + vValue +"'이(가) 입력된 필드에 범위연산(~)이 적용되지 않습니다");
                            frm.elements[inx].focus();
                            return false;
                        }
                    }

                    //2. 전방절단 체크
                    words = vValue.split(' ');
                    for( ixa = 0 ; ixa < words.length ; ixa++ ) {
                        switch( words[ixa].substring( 0, 1 ) )
                        {
                            case '*':
                            case '?':

                            alert(" 전방절단은 지원되지 않습니다.\n입력하신 검색어 \"" + words[ixa] + "\"는 적용되지 않습니다.");
                            frm.elements[inx].focus();
                            return false;
                        }
                    }

                    //4. ㄱ-ㅎ단어라면 alert 띄우기
                    if (vValue.search(/[ㄱ-ㅎ]/) != -1) {
                        alert("입력한 '" + vValue +"'에 유효하지 않은 문자가 있습니다");
                        frm.elements[inx].focus();
                        return false;
                    }

                    //5. 섹션지정자인 특수 기호는 alert 띄우기
                    if (vValue.search(/[:=<>]/) != -1) {
                        alert("\":<>=\"기호는 섹션지정자이므로 검색어로 사용할 수 없으며 \n범위연산은 \"~\"기호를 넣어 검색할 수 있습니다");
                        frm.elements[inx].focus();
                        return false;
                    }

                    //6. 검색어로 쓰이면 오류를 발생하는 특수기호는 alert 띄우기
                    if (vValue.search(/[]\[{},]/) != -1) {
                        alert("\"[]{},\"기호는 검색어로 쓰일수 없습니다");
                        frm.elements[inx].focus();
                        return false;
                    }

                    //7. 질의어의 특수 문자 자동 삭제
                    //vValue = removeSpecialChar(vValue);

                    //3. 맨앞과 맨뒤의 특수문자 자동 제거
                    vValue = parsingErr(vValue);

                    var newLineCnt = 1;
                    var row, cols;
                    //사용자가 입력한 값이 있는 경우 tb테이블 필드명과 값 쓰기
                    var vTb = document.getElementById('tb');
                    var rowIndex = vTb.rows.length-1;
                    row = vTb.insertRow(rowIndex);

                    // 필드명
                    cols = row.insertCell(0);
                    cols.innerHTML = "<input type='hidden' name='Item' value='"+frm.elements[inx].name+"'>";

                    // 값
                    cols = row.insertCell(1);
                    cols.innerHTML = "<input type='hidden' name='Query' value='"+vValue+"'>";

                    fullQuery += vValue + ' ';

                }
            }
        }

        if(trim(fullQuery) == '') {
            alert("질의어를 다시 입력해 주세요");
            return false;
        }

        if(frm.fullQuery != null)
            frm.fullQuery.value = trim(fullQuery);
    }

    /*---------------------------------------------------------------------
     *필드검색 사용자 질의어 쓰기(09.11.11 KHM 추가)
     *기존의 검색들은 fWriteQuery2() 함수를 사용한다.(제대로 검색되지 않음)
     *검색필드와 블리언선택 항목을 맞춰주기 위해서 vValue==''인 항목도 모두 넘겨준다. (주석처리함)
     *---------------------------------------------------------------------*/
     function fWriteItemQuery(frm) {

         //입력된 사용자 질의어 삭제
         fDeleteQuery2();

         var el = frm.elements;
         var fullQuery = ''; //상세조회에서 하이라이팅 할 쿼리
         var vValue, words;
         var count = el.length;

         for(var inx = 0; inx < count; inx++)
         {
             if(el[inx].type == "text" || el[inx].type == "textarea") {

                 vValue = trim(el[inx].value);
                 //alert("inx==>"+inx+"==el[inx]==>>"+el[inx]+"==vValue==>"+ vValue);
                 //if(vValue != '') {

                     //1.숫자필드 체크
                     if(el[inx].className  == 'inputwrite_num'){

                         if(NumberFldChk(vValue) == false){
                             alert("숫자로 구성된 항목에는 숫자와 범위연산자(~)만 입력하여 검색할 수 있습니다");
                             frm.elements[inx].focus();
                             return false;
                         }

                     }else if(el[inx].className  == 'inputwrite_date'){

                         if(vValue.indexOf('~') != -1 && vValue.indexOf('*') != -1) {
                             alert("*를 이용한 검색은 시작날짜만 입력되어 있어야 합니다");
                             frm.elements[inx-1].focus();
                             return false;
                         }

                     }else{

                         if(vValue.indexOf('~') != -1){
                             alert("'" + vValue +"'이(가) 입력된 필드에 범위연산(~)이 적용되지 않습니다");
                             frm.elements[inx].focus();
                             return false;
                         }
                     }

                     //2. 전방절단 체크
                     words = vValue.split(' ');
                     for( ixa = 0 ; ixa < words.length ; ixa++ ) {
                         switch( words[ixa].substring( 0, 1 ) )
                         {
                             case '*':
                             case '?':

                             alert(" 전방절단은 지원되지 않습니다.\n입력하신 검색어 \"" + words[ixa] + "\"는 적용되지 않습니다.");
                             frm.elements[inx].focus();
                             return false;
                         }
                     }

                     //4. ㄱ-ㅎ단어라면 alert 띄우기
                     if (vValue.search(/[ㄱ-ㅎ]/) != -1) {
                         alert("입력한 '" + vValue +"'에 유효하지 않은 문자가 있습니다");
                         frm.elements[inx].focus();
                         return false;
                     }

                     //5. 섹션지정자인 특수 기호는 alert 띄우기
                     if (vValue.search(/[:=<>]/) != -1) {
                         alert("\":<>=\"기호는 섹션지정자이므로 검색어로 사용할 수 없으며 \n범위연산은 \"~\"기호를 넣어 검색할 수 있습니다");
                         frm.elements[inx].focus();
                         return false;
                     }

                     //6. 검색어로 쓰이면 오류를 발생하는 특수기호는 alert 띄우기
                     if (vValue.search(/[]\[{},]/) != -1) {
                         alert("\"[]{},\"기호는 검색어로 쓰일수 없습니다");
                         frm.elements[inx].focus();
                         return false;
                     }

                     //7. 질의어의 특수 문자 자동 삭제
                     //vValue = removeSpecialChar(vValue);

                     //3. 맨앞과 맨뒤의 특수문자 자동 제거
                     vValue = parsingErr(vValue);

                     var newLineCnt = 1;
                     var row, cols;
                     //사용자가 입력한 값이 있는 경우 tb테이블 필드명과 값 쓰기
                     var vTb = document.getElementById('tb');
                     var rowIndex = vTb.rows.length-1;
                     row = vTb.insertRow(rowIndex);

                     // 필드명
                     cols = row.insertCell(0);
                     cols.innerHTML = "<input type='hidden' name='Item' value='"+frm.elements[inx].name+"'>";

                     // 값
                     cols = row.insertCell(1);
                     cols.innerHTML = "<input type='hidden' name='Query' value='"+vValue+"'>";

                     fullQuery += vValue + ' ';

                 //}
             }
         }

         if(trim(fullQuery) == '') {
             alert("질의어를 다시 입력해 주세요");
             return false;
         }

         if(frm.fullQuery != null)
             frm.fullQuery.value = trim(fullQuery);
     }
     
    /*---------------------------------------------------------------------
    *필드검색 사용자 질의어삭제
    *---------------------------------------------------------------------*/
    function fDeleteQuery() {

        var vTb = top.frames['hidden'].document.getElementById('tb');
        var rowIndex = vTb.rows.length-1;

        for (var idx = rowIndex; idx > 0; idx--) {
            vTb.deleteRow(idx);
        }
    }

    /*---------------------------------------------------------------------
    *필드검색 사용자 질의어 쓰기
    *---------------------------------------------------------------------*/
    function fWriteQuery() {

        //입력된 사용자 질의어 삭제
        fDeleteQuery();

        var el = document.f.elements;
        var fullQuery = ''; //상세조회에서 하이라이팅 할 쿼리
        var vValue, words;

        for(var inx = 0; inx < el.length; inx++)
        {
            if(el[inx].type == "text" || el[inx].type == "textarea") {

                vValue = trim(el[inx].value);

                if(vValue != '') {

                    //1.숫자필드 체크
                    if(el[inx].className  == 'inputwrite_num'){

                        if(NumberFldChk(vValue) == false){
                            alert("숫자로 구성된 항목에는 숫자와 범위연산자(~)만 입력하여 검색할 수 있습니다");
                            document.f.elements[inx].focus();
                            return false;
                        }

                    }else if(el[inx].className  == 'inputwrite_date'){

                        if(vValue.indexOf('~') != -1 && vValue.indexOf('*') != -1) {
                            alert("*를 이용한 검색은 시작날짜만 입력되어 있어야 합니다");
                            document.f.elements[inx-1].focus();
                            return false;
                        }

                    }else{

                        if(vValue.indexOf('~') != -1){
                            alert("'" + vValue +"'이(가) 입력된 필드에 범위연산(~)이 적용되지 않습니다");
                            document.f.elements[inx].focus();
                            return false;
                        }
                    }

                    //2. 전방절단 체크
                    words = vValue.split(' ');
                    for( ixa = 0 ; ixa < words.length ; ixa++ ) {
                        switch( words[ixa].substring( 0, 1 ) )
                        {
                            case '*':
                            case '?':

                            alert(" 전방절단은 지원되지 않습니다.\n입력하신 검색어 \"" + words[ixa] + "\"는 적용되지 않습니다.");
                            document.f.elements[inx].focus();
                            return false;
                        }
                    }

                    //3. 맨앞과 맨뒤의 특수문자 자동 제거
                    vValue = parsingErr(vValue);

                    //4. ㄱ-ㅎ단어라면 alert 띄우기
                    if (vValue.search(/[ㄱ-ㅎ]/) != -1) {
                        alert("입력한 '" + vValue +"'에 유효하지 않은 문자가 있습니다");
                        document.f.elements[inx].focus();
                        return false;
                    }

                    //5. 섹션지정자인 특수 기호는 alert 띄우기
                    if (vValue.search(/[:=<>]/) != -1) {
                        alert("\":<>=\"기호는 섹션지정자이므로 검색어로 사용할 수 없으며 \n범위연산은 \"~\"기호를 넣어 검색할 수 있습니다");
                        document.f.elements[inx].focus();
                        return false;
                    }

                    //6. 검색어로 쓰이면 오류를 발생하는 특수기호는 alert 띄우기
                    if (vValue.search(/[]\[{},]/) != -1) {
                        alert("\"[]{},\"기호는 검색어로 쓰일수 없습니다");
                        document.f.elements[inx].focus();
                        return false;
                    }

                    //7. 질의어의 특수 문자 자동 삭제
                    vValue = removeSpecialChar(vValue);

                    var newLineCnt = 1;
                    var row, cols;
                    //사용자가 입력한 값이 있는 경우 tb테이블 필드명과 값 쓰기
                    var vTb = top.frames['hidden'].document.getElementById('tb');
                    var rowIndex = vTb.rows.length-1;
                    row = vTb.insertRow(rowIndex);

                    // 필드명
                    cols = row.insertCell(0);
                    cols.innerHTML = "<input type='hidden' name='Item' value='"+document.f.elements[inx].name+"'>";
                    // 값
                    cols = row.insertCell(1);
                    cols.innerHTML = "<input type='hidden' name='Query' value='"+vValue+"'>";

                    fullQuery += vValue + ' ';
                }
            }
        }

        if(trim(fullQuery) == '') {
            alert("질의어를 다시 입력해 주세요");
            return false;
        }

        //top.frames['hidden'].document.f.query.value = trim(fullQuery);
        top.frames['hidden'].document.f.fullQuery.value = trim(fullQuery);
    }

    /*---------------------------------------------------------------------
    * 다시 검색하기를 클릭한 경우 질의어가 그대로 남아 있도로 구현하기 위해
    * save 프레임에 질의어 저장
    *---------------------------------------------------------------------*/
    function saveSearch() {

        //save프레임에 저장된 질의어 삭제
        var vTb = top.frames['save'].document.getElementById('tb');
        var rowIndex = vTb.rows.length-1;

        for (var idx = rowIndex-1; idx >= 0; idx--) {
            vTb.deleteRow(idx)
        }

        var el = document.f.elements;
        for(var inx = 0; inx < el.length; inx++) {

            if(el[inx].type == "text" || el[inx].type == "textarea") {

                var vValue = el[inx].value;
            rowIndex = vTb.rows.length-1;
            var row = vTb.insertRow(rowIndex);
            var cell = row.insertCell();
            cell.innerHTML = "<input type=\"text\" name=\""+document.f.elements[inx].name+"\" value=\'"+vValue+"\'>";
            }
        }

        //자동질의 확장 셋팅
        for(var inx = 0; inx < document.f.autoExpand.length; inx++){
            top.frames['save'].document.f.autoExpand[inx].checked = document.f.autoExpand[inx].checked;
        }
        top.frames['save'].document.f.noAutoExpand.checked = document.f.noAutoExpand.checked;
    }

    /*---------------------------------------------------------------------
    * save프레임에 저장된 질의어 보여주기
    *---------------------------------------------------------------------*/
    function setSave() {

        var el = document.f;
        var el2 = top.frames['save'].document.f;

        if(el2.elements.length > 0) {

            for(var inx = 0; inx < el2.elements.length; inx++){
                if(el2[inx].type == "text" || el2[inx].type == "textarea") {
                    el.elements[inx].value = el2.elements[inx].value;
                }
            }
            //자동질의 확장 셋팅
            for(var inx = 0; inx < el2.autoExpand.length; inx++){
                el.autoExpand[inx].checked = el2.autoExpand[inx].checked;
            }
            el.noAutoExpand.checked = el2.noAutoExpand.checked;
        }
    }

    /* -----------------------------------------------------------
    * 질의어 가공하기
    * 파라미터 : 크리스탈에 보낼 질의어(사용자 입력)
    * -----------------------------------------------------------*/
    function checkQuery(inputQuery){

        //개행문자 삭제
        var vValue = inputQuery.replaceAll("\n",'');
        if(trim(vValue) != '') {
                        ;
            //1. 전방절단 체크
            words = vValue.split(' ');
            for( ixa = 0 ; ixa < words.length ; ixa++ ) {
                switch( words[ixa].substring( 0, 1 ) )
                {
                    case '*':
                    case '?':

                    alert(" 전방절단은 지원되지 않습니다.\n입력하신 검색어 \"" + words[ixa] + "\"는 적용되지 않습니다.");
                    return ":";
                }
            }

            //3. ㄱ-ㅎ단어라면 alert 띄우기
            if (vValue.search(/[ㄱ-ㅎ]/) != -1) {
                alert("입력한 '" + vValue +"'에 유효하지 않은 문자가 있습니다");
                return ":";
            }

            //4. 섹션지정자인 특수 기호는 alert 띄우기
            if (vValue.search(/[:=<>]/) != -1) {
                alert("\":<>=\"기호는 섹션지정자이므로 검색어로 사용할 수 없으며 \n범위연산은 \"~\"기호를 넣어 검색할 수 있습니다");
                return ":";
            }

            //5. 검색어로 쓰이면 오류를 발생하는 특수기호는 alert 띄우기
            if (vValue.search(/[]\[{},]/) != -1) {
                alert("\"[]{},\"기호는 검색어로 쓰일수 없습니다");
                return ":";
            }

            //6. 질의어의 특수 문자 자동 삭제
            //vValue = removeSpecialChar(vValue);

            //2. 맨앞과 맨뒤의 특수문자 자동 제거
            vValue = parsingErr(vValue);

            return vValue;

        }else {
            alert("질의어를 다시 입력해 주세요");
            return ":";
        }

    }




//--------------------------검색관련 공통 함수 끝               -----------------------//
//--------------------------일반적으로 쓰이는  공통 함수 시작 -----------------------//

    /* -----------------------------------------------------------
    * 숫자와 ~만 입력 가능하게 바꿈
    * -----------------------------------------------------------*/
    function NumberFldChk(input) {
        var chars = " ~0123456789";
        return rtnNumChk(input,chars);
    }

    /* -----------------------------------------------------------
    * 숫자와 ~만 입력됐는지 여부 리턴
    * -----------------------------------------------------------*/
    function rtnNumChk(input,chars) {

        var rtnValue = "";
        for (var inx = 0; inx < input.length; inx++) {
        if (chars.indexOf(input.charAt(inx)) == -1)
                return false;
        }

        return true;
    }

    /* -----------------------------------------------------------
    * 허용하지 않는 특수문자 자동 제거
    * -----------------------------------------------------------*/
    function removeSpecialChar(input) {
        var chars = "`@#$%^;_.+?'\"";
        return rtnString(input,chars);
    }

    /* -----------------------------------------------------------
    * 특수문자 제거하는 함수
    * -----------------------------------------------------------*/
    function rtnString(input,chars) {
        var rtnValue = "";
        for (var inx = 0; inx < input.length; inx++) {
        if (chars.indexOf(input.charAt(inx)) == -1)
                rtnValue += input.charAt(inx);
        }
        return rtnValue;
    }

    /* -----------------------------------------------------------
    * 검색어 앞과 뒤에 특수 문자 있는 경우 자동 제거
    * -----------------------------------------------------------*/
    function parsingErr(vValue)
    {
        //맨 앞과 뒤의 공백 제거
        var cutValue = trim(vValue);

        //앞 문자 체크
        switch(cutValue.substr( 0, 1))
        {
            case '~':
            case '*':
            case '&':
            case '|':
            case '!':

            cutValue = cutValue.substr(1,cutValue.length);
        }

        //뒷문자 체크
        switch(cutValue.substr( cutValue.length-1, cutValue.length ))
        {
            case '~':
            case '&':
            case '|':
            case '!':

            cutValue = cutValue.substr(0,cutValue.length-1);
        }

        return cutValue;
    }

    /* -----------------------------------------------------------
    * 한문자(영어,숫자) 삭제
    * -----------------------------------------------------------*/
    function removeOneChar(str){
        var reOne = new RegExp("\\b[a-zA-Z]{1}\\b", "g");
        rtnStr = str.replace(reOne," ");

        return rtnStr;
    }

    /* -----------------------------------------------------------
    * (문자)형태제거--한문제거
    * -----------------------------------------------------------*/
    function removeHanMun(str){
        var reKaro = new RegExp("[(]([^가-힣0-9(]+)[)]", "g");
        rtnStr = str.replace(reKaro," ");

        return rtnStr;
    }

    /* -----------------------------------------------------------
    * 원하는 문자열 전부 replace
    * -----------------------------------------------------------*/
    String.prototype.trim = function()
    {
    return this.replace(/(^\s*)|(\s*$)/gi, "");
    }
    String.prototype.replaceAll = function(str1, str2)
    {
    var temp_str = "";

    if (this.trim() != "" && str1 != str2)
    {
        temp_str = this.trim();

        while (temp_str.indexOf(str1) > -1)
        {
        temp_str = temp_str.replace(str1, str2);
        }
    }

    return temp_str;
    }

    /* -----------------------------------------------------------
    * 다음 포커스로 자동 이동 (일자)
    * -----------------------------------------------------------*/
    function MoveNextFocus(form, length, nextField)
    {
        if(form.value.length == length)
        {
            eval('document.f.'+ nextField +'.focus()')
        }
    }

    //팝업할때 사용(중간으로 팝업창 보이게 하기)
    function popUp(url, name, width, height,scrollYN, resizable )   {

        var top    =    screen.height /2  - height / 2 ;
        var left    =    screen.width / 2 - width / 2 ;
        if (typeof(scrollYN) == "undefinded") scrollYN='no';
        if (typeof(resizable) == "undefinded") resizable='yes';
        var win;
        win = open(url, name, 'width='+width+',height='+height+',top='+top+',left='+left+', resizable=yes,status=no,toolbar=no,menubar=no,scrollbars='+scrollYN);        
        //win = open(url, name, 'width='+width+',height='+height+',top='+top+',left='+left+', resizable=' + resizable + ',status=no,toolbar=no,menubar=no,scrollbars='+scrollYN);
        win.focus();

    }
    //팝업할때 사용(입력된 값으로 팝업창 보이게 하기
    function userPopUp(url, name, width, height, top, left, scrollYN, resizable )   {
        if (typeof(scrollYN) == "undefinded") scrollYN='no';
        if (typeof(resizable) == "undefinded") resizable='no';
        var win;
        win = open(url, name, 'width='+width+',height='+height+',top='+top+',left='+left+', resizable=' + resizable + ',status=no,toolbar=no,menubar=no,scrollbars='+scrollYN);
        win.focus();

    }

    //달력 오픈
    function openCalendar(arg,arg2){
        var top    =    screen.height / 2 - 200 / 2 - 50;
        var left=    screen.width / 2 - 220 / 2 ;
        var win;

        if(typeof(arg2) != "undefinde"){
            arg2 = "&foname="+arg2
        }else{
            arg2 = "";
        }

        var url = "/common/JZ3300.html?actval="+arg+arg2;
        win = open(url, 'Calendar', 'width=203,height=230,top='+top+',left='+left+',resizable=yes,status=no,toolbar=no,menubar=no,scrollbars=no');
        win.focus();
    }


    //unput only number in text filed
    function onlyNumber(){
        var keyCode = event.keyCode ? event.keyCode :
        event.which ? event.which : event.charCode;
        if (keyCode!=13) {
            if((keyCode>47 && keyCode<58)) {
                event.returnValue = true;
            } else {
                event.returnValue = false;
            }
        }
    }

    function hasOnlyNumDN() {
        var code = event.keyCode ? event.keyCode :
                event.which ? event.which : event.charCode;
        if (code!=13) {
            event.returnValue =
                ( code >= 48 && code <= 57)     // Number
                || code == 8                    // Backspace
                || code == 9                    // Tab
                || code == 46                   // Delete
                || ( code >= 37 && code <= 40)  // Cursor Key
                || ( code >= 96 && code <= 105) // Key Pad
        }
    }

    function keyCheck_num1(obj) {
        if(obj.value == "") return true;
        var s       = new String("0123456789");
        var re_data = String(obj.value);
        var len     = re_data.length;
        var numYn   = false;

        for(var i = 0 ; i < len; i++){
            numYn   = false;
            for(var k = 0 ; k < 10; k++){
                if(re_data.charAt(i) == s.charAt(k)){
                    numYn = true;
                }
            }
            if(!numYn) {
                //alert("숫자만 입력할 수 있습니다.");
                //obj.focus();
                return false;
            }
        }
        return true;
    }

    //날짜가 유효한지 체크
    function CheckDate(arg) {

        strDate = arg.value;
        var cur_year, cur_mon, cur_day

        if (strDate.length > 0) {
        for (i = 0; i < strDate.length; i++) {
            if (strDate.charAt(i) < '0' || strDate.charAt(i) > '9'){
                //alert('유효한날짜를 입력하여주세요');
                //arg.focus();
                return false;
            }
        }
        } else{
            //alert('유효한날짜를 입력하여주세요');
            //arg.focus();
            return false;
        }

        cur_year = strDate.substring(0, 4)
        cur_mon  = strDate.substring(4, 6)
        cur_day  = strDate.substring(6, 8)

        if (cur_mon == "00" || cur_mon > "12"){
                //alert('유효한날짜를 입력하여주세요');
                //arg.focus();
                return false;
        }

        if (cur_mon=="01"||cur_mon=="03"||cur_mon=="05"||cur_mon=="07"||cur_mon=="08"||cur_mon =="10"||cur_mon=="12") {
        if (cur_day == "00" || cur_day > "31") {
                //alert('유효한날짜를 입력하여주세요');
                //arg.focus();
                return false;
        }
        }
        else {
        if (cur_day == "00" || cur_day > "30") {
                //alert('유효한날짜를 입력하여주세요');
                //arg.focus();
                return false;
        }
        }

        if (cur_mon == "02" && cur_day == "29" ) {
        if (!((cur_year % 4 == 0) && ((cur_year % 100 != 0) || (cur_year % 400 == 0)))){
                //alert('유효한날짜를 입력하여주세요');
                //arg.focus();
                return false;
        }
        }
        else if (cur_mon == "02" && cur_day > "28" ) {
                //alert('유효한날짜를 입력하여주세요');
                //arg.focus();
                return false;
        }

        return true;
    }

    function isNull(stObj){
        var SpaceOX    = 0;

        for (var i = 0; i<stObj.value.length; i++){
            if (stObj.value.charAt(i)==" "){
                SpaceOX = SpaceOX + 0;
            }else{
                SpaceOX = SpaceOX + 1;
            }
        }

        if (SpaceOX == 0)     return false;
        else                return true;

    }

    function byteLen(arg,arg2){

        var len = 0;
        var fbyte = arg.value;

        if ( fbyte == null ) return 0;
        for(var i=0;i<fbyte.length;i++){
            var c = escape(fbyte.charAt(i));
            if ( c.length == 1 ) len ++;
            else if ( c.indexOf("%u") != -1 ) len += 2;
        }

        if(arg2 < len){
            return false;
        }else{
            return true;
        }

    }

    function move_focus(Obj) {
        if(event.keyCode == 13) {
        Obj.focus();
        event.returnValue = false;
        }
    }

    function enterSubmit(Obj) {
        if(event.keyCode == 13) {
            Obj.submit();
        }

    }

    function JuminCheck(jumin1){

        var strParam = "";
        var temp = removeDash(jumin1);
        if(temp.length == 15) temp = temp.substring(0,13);
        strParam = temp;

        var nYear, nMonth, nDate;
        var nSum, nMod;
        nMod = nSum = nYear = nMonth = nDate = 0;

        if(strParam.length != 13) return false;
        for(i=0; i<12; i++) {
            if(i == 0) nYear += parseInt(strParam.charAt(i)) * 10;
            if(i == 1) nYear += parseInt(strParam.charAt(i));
            if(i == 2) nMonth += parseInt(strParam.charAt(i)) * 10;
            if(i == 3) nMonth += parseInt(strParam.charAt(i));
            if(i == 4) nDate += parseInt(strParam.charAt(i)) * 10;
            if(i == 5) nDate += parseInt(strParam.charAt(i));
            if(i < 6) nSum += parseInt(strParam.charAt(i)) * (i+2);
            if(i > 5 && i < 8) nSum += parseInt(strParam.charAt(i)) * (i+2);
            if(i > 7) nSum += parseInt(strParam.charAt(i)) * (i-6);
        }

        nMod = 11 - (nSum % 11);
        if((11 - (nSum % 11)) >= 10) nMod -= 10;

        if(nMod != parseInt(strParam.charAt(12))) return false;
        if(nMonth < 1 || nMonth > 12 || nDate < 1 || nDate > 31) return false;
        if((nMonth == 4 || nMonth == 6 || nMonth == 9 || nMonth == 11) && nDate > 30) return false;
        if(nMonth == 2 && nDate > 29) return false;

        return true;
    }

    function IsValidEmail(obj) {
        num = 0;
        num_1 = 0;
        var email = obj.value;
        for (i=0;i<email.length;i++){
            if (email.charAt(i) == '@') num++;
            if (email.charAt(i) == '.') num_1++;
        }
        if (num != 1 || num_1 == 0) {
            alert("유효하지 않은 메일주소 입니다.");
            obj.focus();
            return false;
        }
        return true;
    }

    function removeValue(obj) {
        val = obj.value;
        str = "";
        strr = val.split(",");
        for (i=0;i<strr.length;i++){
            str += strr[i];
        }
        obj.value = str;
    }

    function removeComma(objValue) {
        val = objValue;
        str = "";
        strr = val.split(",");
        for (i=0;i<strr.length;i++){
            str += strr[i];
        }
        //obj.value = str;
        return str;
    }

    function formatComma(tx) {
        var oldv = "";
        if(oldv == tx.value) return;
        oldv = removeComma(tx.value);
        tx.value = formatNumber(oldv);
    }

    function formatNumber(s) {
        var str  = s.replace(/\D/g,"");
        var len  = str.length;
        var tmp  = "";
        var tm2  = "";
        var i    = 0;
        while (str.charAt(i) == '0') i++;
        str = str.substring(i,len);
        len = str.length;
        if(len < 3) {
            return str;
        } else {
            var sit = len % 3;
            if (sit > 0) {
                tmp = tmp + str.substring(0,sit) + ',';
                len = len - sit;
            }
            while (len > 3) {
                tmp = tmp + str.substring(sit,sit+3) + ',';
                len = len - 3;
                sit = sit + 3;
            }
            tmp = tmp + str.substring(sit,sit+3) + tm2;
            str = tmp;
        }
        return str;
    }

    function onlyNumChar(){
        var keyCode = event.keyCode ? event.keyCode :
                event.which ? event.which : event.charCode;
        if( keyCode==13 ||
            (keyCode>47 && keyCode<58) ||
            (keyCode>64 && keyCode<91) ||
            (keyCode>96 && keyCode<123) ) {
            event.returnValue = true;
            } else {
            event.returnValue = false;
            }
    }

    function keyCheck_num2(obj) {
        if(obj.value == "") return true;
        var s       = new String("0123456789");
        var re_data = String(obj.value);
        var len     = re_data.length;
        var numYn   = false;

        for(var i = 0 ; i < len; i++){
            numYn   = false;
            for(var k = 0 ; k < 10; k++){
                if(re_data.charAt(i) == s.charAt(k) || re_data.charAt(i) == ','){
                    numYn = true;
                }
            }
            if(!numYn) {
                //alert("숫자만 입력할 수 있습니다.");
                obj.focus();
                return false;
            }
        }
        return true;
    }

    function setPage(arg) {
        if( typeof(arg)=="object") arg = parseInt(arg,10); else arg = 0;
        if( typeof(parent.document.all.ifr)=="object") {
            parent.document.all.ifr.style.height = (document.body.scrollHeight + 5) + arg;
        }else if( typeof(parent.document.all.Bbody)=="object") {
            parent.document.all.Bbody.style.height = (document.body.scrollHeight + 5) + arg;
        }
        parent.scrollTo(0,0);
    }

    function moveFocus(obj, len, target){
        if(obj.value.length == len){
            target.focus();
        }
    }

    function fprint(){

        try{
            ifr.focus();
        }catch(e){
            Bbody.focus();
        }

        window.print();
    }

    var aBankCode = new Array('02','03','04','05','07','08','09','11','20','21','23'
            ,'26','27','31','32','34','35','37','39','45','48','53','54','71','81','50');

    var aBankName = new Array('산업은행','기업은행','국민은행','외환은행','수협중앙회','한국수출입은행'
        ,'장기신용은행','농협','우리은행','조흥은행','제일은행','신한은행','한미은행','대구은행','부산은행'
        ,'광주은행','제주은행','전북은행','경남은행','새마을금고','신협','시티은행','홍콩은행','우체국','하나은행','상호저축은행');

    var iBankCount = aBankCode.length;

    function getBankName(code) {
        for(var i=0; i<iBankCount; i++) {
            if(aBankCode[i] == code) return aBankName[i];
        }
    }
    function getBankCode(name) {
        for(var i=0; i<iBankCount; i++) {
            if(aBankName[i] == name) return aBankCode[i];
        }
    }

    function getBankSelectBox(name, event, data ) {

        var temp;
        if(typeof(data)!="undefinded" && data!="" ) temp = data;
        else temp = '34';

        document.write("<select name='" + name + "' " + event + ">");
        document.write("<option value=''> 선택하십시요. </option>");
        for(var b=0; b<iBankCount; b++) {

            if(aBankCode[b] == temp){
                document.write("<option value='" + aBankCode[b] + "' selected >" + aBankCode[b]+". "+aBankName[b]);
            }else{
                document.write("<option value='" + aBankCode[b] + "' >" + aBankCode[b]+". "+aBankName[b]);
            }



        }
        document.write("</select>");
    }


    function plus_day(day, obj, obj2) { //day의 값에 따라 날짜를 더해서 출력한다.

        var today2= new Date();
        var today = new Date();    // 현재날짜를 구함

        var nowyear = today.getYear();
        if(nowyear < 1900) nowyear = nowyear + 1900;

        var nowmonth = today.getMonth()+1;
        if (nowmonth < 10){ nowmonth = "0"+nowmonth;}

        var nowday = today.getDate();
        if(nowday < 10) nowday = "0"+nowday;

        var tdate = today.getDate()-day; // day 이전날짜를 구함

        today2.setDate(tdate);

        var tyear = today2.getYear();
        if(tyear < 1900) tyear = tyear + 1900;

        var tmon = today2.getMonth()+1;
        if(tmon < 10) tmon = "0"+tmon;

        var tday = today2.getDate();
        if(tday < 10) tday = "0"+tday;

        obj.value = tyear + "" + tmon + "" + tday;
        obj2.value = nowyear + "" + nowmonth + "" + nowday;
    }


    function getOutaccSelectBox(name, event) {
        document.write("<select name='" + name + "' " + event + ">");
        document.write("<option value=''> 선택하십시요. </option>");
        for(var b=0; b<top.outAccno.length; b++) {
            document.write("<option value='" + top.outAccno[b] + "' >"+top.outAccname[b]+"</option>");
        }
        document.write("</select>");
    }

    function copyOpen(sMsg) {

        if(typeof(eval(sMsg)) == "undefined") return ;
        else sMsg = eval(sMsg).innerHTML;

        var frm = document.fCopy;
        var sOption = "width=700,height=250,top=498,left=10,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1";
        var tarName    = randomValue();

        popWindow = window.open("",tarName, sOption);
        frm.target = tarName;
        frm.cvalue.value = sMsg;
        frm.submit();
    }

    function randomValue(){
        var sNum = Math.round(Math.random()*10000);
        sNum = "A"+sNum;
        return sNum;
    }

    function setJumin(arg){

        var val = removeDash(arg);

        if(val.length <= 6) return val;
        else if(val.length <= 13){
            arg.value = val.substring(0,6)+"-"+val.substring(6,val.length);
        }else{
            arg.value = val.substring(0,6)+"-"+val.substring(6,13)+"-"+val.substring(13,val.length);
        }

    }

    function setAccno(arg){

        var val = removeDash(arg);

        if(val.length <= 3) return val;
        else if(val.length <= 6){
            arg.value = val.substring(0,3)+"-"+val.substring(3,val.length);
        }else if(val.length <= 12){
            arg.value = val.substring(0,3)+"-"+val.substring(3,6)+"-"+val.substring(6,val.length);
        } else  {
            arg.value = val.substring(0,3)+"-"+val.substring(3,6)+"-"+val.substring(6,12)+"-"+val.substring(12,val.length);
        }
    }

    function setVija(arg){

        var val = removeDash(arg);

        if(val.length <= 4) return val;
        else if(val.length <= 8){
            arg.value = val.substring(0,4)+"-"+val.substring(4,val.length);
        }else if(val.length <= 12){
            arg.value = val.substring(0,4)+"-"+val.substring(4,8)+"-"+val.substring(8,val.length);
        }else{
            arg.value = val.substring(0,4)+"-"+val.substring(4,8)+"-"+val.substring(8,12)+"-"+val.substring(12,val.length);
        }
    }

    function removeDash(obj) {
        val = obj.value;
        str = "";
        strr = val.split("-");
        for (i=0;i<strr.length;i++){
            str += strr[i];
        }
        return str;
    }

    function setFocusToFirstTextField(form) {
    if ( typeof(form) == 'undefined' ){
        return; }

    var count = form.elements.length;

    for ( var i = 0; i < count; i++ ) {
        if ( form.elements[i].type == "text" || form.elements[i].type == "password" || form.elements[i].type == "select-one" || form.elements[i].type == "select-multiple") {
            //alert("if_focus");
        form.elements[i].focus();
        return;
        }
    }
    }


    var strConpButton = "";
    strConpButton +="<table width='80' border='0' cellspacing='0' cellpadding='0' height='18'>";
    strConpButton +="<tr>";
    strConpButton +="<td></td>";
    strConpButton +="<td bgcolor='#4A4A4A' height='1' colspan='2'></td>";
    strConpButton +="<td></td>";
    strConpButton +="</tr>";
    strConpButton +="<tr>";
    strConpButton +="<td bgcolor='#4A4A4A'></td>";
    strConpButton +="<td bgcolor='#ffffff' height='2' colspan='2'></td>";
    strConpButton +="<td bgcolor='#4A4A4A'></td>";
    strConpButton +="</tr>";
    strConpButton +="<tr>";
    strConpButton +="<td rowspan='2' bgcolor='#4A4A4A' width='1'></td>";
    strConpButton +="<td height='13' align='center' bgcolor='F1F8EC' width='78'><font style=' color: black; font-family: 굴림; font-size: 11px; letter-spacing:1px'>처리중</font></td>";
    strConpButton +="<td width='2' align='center' bgcolor='CEE4BC' valign='bottom'></td>";
    strConpButton +="<td rowspan='2' bgcolor='#4A4A4A' width='1'></td>";
    strConpButton +="</tr>";
    strConpButton +="<tr>";
    strConpButton +="<td bgcolor='#CEE4BC' height='1' colspan='2'> </td>";
    strConpButton +="</tr>";
    strConpButton +="<tr>";
    strConpButton +="<td height='1'></td>";
    strConpButton +="<td bgcolor='#4A4A4A' height='1' colspan='2'></td>";
    strConpButton +="<td></td>";
    strConpButton +="</tr>";
    strConpButton +="</table>";


    /*    TOP에서 가져오는정보들 START..
    */

    function getJumin(arg){
        if(opener){
            if(typeof(top.opener.top.userJumin) != "undefined") arg.value = top.opener.top.userJumin;
        }else{
            if(typeof(top.userJumin) != "undefined") arg.value = top.userJumin;
        }
    }

    function getName(arg){
        if(opener)    arg.value = top.opener.top.userName;
        else         arg.value = top.userName;
    }

    function getPwd(arg){
        if(opener){
            top.opener.top.GetPassword(arg);
        }else{
            top.GetPassword(arg);
        }
    }

    function objCheck(arg){
        if(opener)    top.opener.top.isObj(arg);
        else         top.isObj(arg);
    }

  //Object Check!!! **********************************************************
    function isObj(arg){
        if( typeof((arg)) == "object") {
            alert("true");
        } else {
            alert("false");
        }
    }

    function delinput(arg){
        arg.value="";
    }

    /*    TOP에서 가져오는정보들 END..
    */


// 기능 : 주민번호 체크
// 작성자 : 김용학
// 작성일 : 2003.11.24
function isValidJuno(no1, no2)
{
  var weight = 0;
  var check;

  if (isValidJuno.arguments.length<1) return false;

  if (isValidJuno.arguments.length==2 && no1.length==6) no1 += no2;

  if (no1.length!=13 || !isNumber(no1)) return false;

  weight += (no1.charAt(0) - '0') * 2;
  weight += (no1.charAt(1) - '0') * 3;
  weight += (no1.charAt(2) - '0') * 4;
  weight += (no1.charAt(3) - '0') * 5;
  weight += (no1.charAt(4) - '0') * 6;
  weight += (no1.charAt(5) - '0') * 7;
  weight += (no1.charAt(6) - '0') * 8;
  weight += (no1.charAt(7) - '0') * 9;
  weight += (no1.charAt(8) - '0') * 2;
  weight += (no1.charAt(9) - '0') * 3;
  weight += (no1.charAt(10) - '0') * 4;
  weight += (no1.charAt(11) - '0') * 5;

  check = (11 - weight % 11) % 10;

  return ((no1.charAt(12) - '0') == check);
}

// 기능 : 문자열 str의 오른쪽끝부분의 문자 ch를 모두 제거.
//        ch의 default값은 ' '
// 작성자 : 김용학
// 작성일 : 2003.11.24
function rTrim(str, ch) {
  var i=0;

  if (ch==null || ch.length==0) ch=' ';

  for (i=str.length; i>0;i--) {
    if ( str.charAt(i-1)!=ch)    break;
  }
  return str.substring(0,i);
}

// 기능   : 문자열 str의 왼쪽끝부분의 문자 ch를 모두 제거.
//          ch의 default값은 ' '
// 작성자 : 김용학
// 작성일 : 2003.11.24
function lTrim(str, ch) {
  var i=0;

  if (ch==null || ch.length!=1) ch=' ';

  for (i=0;i<str.length;i++) {
    if ( str.charAt(i)!=ch)    break;
  }
  return str.substring(i);
}

// 기능   : 오른쪽 왼쪽 스페이스 제거
//          ch의 default값은 ' '
// 작성자 : 김용학
// 작성일 : 2003.11.24
function trim(str,ch) {
  return rTrim( lTrim(str,ch) ,ch);
}


// 기능   : 일자를 SETTING
// 작성자 : 김용학
// 작성일 : 2003.11.26
function dateFormat(chr,format) {
    if (format == null || format.length !=1 ) format = '-';
    return chr.substr(0,4) + format + chr.substr(4, 2) + format + chr.substr(6, 2);
}

// 기능   : 알파벳 인지 검사
// 작성자 : 김용학
// 작성일 : 2003.11.28
function isAlphabet(chr) {
    for (var i = 0; i < chr.length; i++){
        if (chr.charAt(i) < 'A' || chr.charAt(i) > 'z' ) return false;

    }
    return true;
}

// 기능   : 숫자 인지 검사
// 작성자 : 김용학
// 작성일 : 2003.11.28
function isNumber(chr) {
    for (var i = 0; i < chr.length; i++){
        if (chr.charAt(i) <  '0' || chr.charAt(i) > '9' ) return false;
    }
    return true;
}

// 기능   : 영문자 와 알파벳 인지 검사
// 작성자 : 김용학
// 작성일 : 2003.11.28
function isAlphabetNumeric(chr) {
    for (var i = 0; i < chr.length; i++){
        if ( !isAlphabet(chr.charAt(i)) && !isNumber(chr.charAt(i)) ) return false;
    }
    return true;
}

// 기능   : 문자를 return. NULL일 경우 는 ''로 return
// 작성자 : 김용학
// 작성일 : 2003.12.05
function getString(str) {
    if (trim(str) == '' || str == null || str == 'null') return '';
    return str;
}

// 기능   : day의 값에 따라 날짜를 더해서 출력한다.
// 작성자 : 윤혁
// 작성일 : 2003.12.01
function plus_day_kt(day, obj1, obj2, obj3, obj4, obj5, obj6) {

    var today2= new Date();
    var today = new Date();    // 현재날짜를 구함

    var nowyear = today.getYear();
    if(nowyear < 1900) nowyear = nowyear + 1900;

    var nowmonth = today.getMonth()+1;
    if (nowmonth < 10){ nowmonth = "0"+nowmonth;}

    var nowday = today.getDate();
    if(nowday < 10) nowday = "0"+nowday;

    var tdate = today.getDate()-day; // day 이전날짜를 구함

    today2.setDate(tdate);

    var tyear = today2.getYear();
    if(tyear < 1900) tyear = tyear + 1900;

    var tmon = today2.getMonth()+1;
    if(tmon < 10) tmon = "0"+tmon;

    var tday = today2.getDate();
    if(tday < 10) tday = "0"+tday;

    obj1.value    = tyear;
    obj2.value    = tmon;
    obj3.value    = tday;
    obj4.value    = nowyear;
    obj5.value    = nowmonth;
    obj6.value    = nowday;
    //obj1.value = tyear + "" + tmon + "" + tday;
    //obj2.value = nowyear + "" + nowmonth + "" + nowday;
}
function setSchDate(flag) {

    var frm = document.f;
    var year;
    var month;
    var day;
    var makedate;
    var s_date = new Date();
    var e_date = new Date();

    switch(flag){
        case 1:
            makedate=e_date.getDate()-7;
            s_date.setDate(makedate);
            break;
        case 2:
            makedate=e_date.getDate()-15;
            s_date.setDate(makedate);
            break;
        case 3:
            makedate=e_date.getMonth()-1;
            s_date.setMonth(makedate);
            break;
        case 4:
            makedate=e_date.getMonth()-2;
            s_date.setMonth(makedate);
            break;
        case 5:
            makedate=e_date.getMonth()-3;
            s_date.setMonth(makedate);
            break;
        case 6:
            makedate=e_date.getDate()-3;
            s_date.setDate(makedate);
            break;

    }
    //month는 지정이 되었으니 날짜를 지정해준다
    if(flag == 3 || flag == 4 || flag == 5){
        makedate=s_date.getDate();
        s_date.setDate(makedate);
    }

    year = s_date.getYear();
    if(year < 1900) year = year + 1900;
    month = s_date.getMonth() + 1;
    day = s_date.getDate();
    frm.start_year.value = year;
    if (month < 10){ frm.start_month.value = "0"+month; }else{ frm.start_month.value = month;}
    if (day < 10){ frm.start_day.value = "0"+day; }else{ frm.start_day.value = day;}

    year = e_date.getYear();
    if(year < 1900) year = year + 1900;
    //month = e_date.getMonth() + 1;
    //makedate = e_date.getDate() - 1;
    makedate = e_date.getDate();
    e_date.setDate(makedate);

    year = e_date.getYear();
    month = e_date.getMonth() + 1;
    day = e_date.getDate();

    frm.end_year.value = year;
    if (month < 10){ frm.end_month.value = "0"+month; }else{ frm.end_month.value = month;}
    if (day < 10){ frm.end_day.value = "0"+day; }else{ frm.end_day.value = day;}
}
function setSchDate2(flag) {

    var frm = document.f;
    var year;
    var month;
    var day;
    var makedate;
    var s_date = new Date();
    var e_date = new Date();

    switch(flag){
        case 1:
            makedate=e_date.getDate()+5;
            s_date.setDate(makedate);
            break;
        case 2:
            makedate=e_date.getDate()+13;
            s_date.setDate(makedate);
            break;
        case 3:
            makedate=e_date.getMonth()+1;
            s_date.setMonth(makedate);
            break;
        case 4:
            makedate=e_date.getMonth()+2;
            s_date.setMonth(makedate);
            break;
        case 5:
            makedate=e_date.getMonth()+3;
            s_date.setMonth(makedate);
            break;
        case 6:
            makedate=e_date.getDate()+1;
            s_date.setDate(makedate);
            break;

    }
    //month는 지정이 되었으니 날짜를 지정해준다
    if(flag == 3 || flag == 4 || flag == 5){
        makedate=s_date.getDate();
        s_date.setDate(makedate-1);
    }else{
        makedate=s_date.getDate();
        s_date.setDate(makedate+1);
    }

    year = s_date.getYear();
    if(year < 1900) year = year + 1900;
    month = s_date.getMonth() + 1;
    day = s_date.getDate();
    frm.end_year.value = year;
    if (month < 10){ frm.end_month.value = "0"+month; }else{ frm.end_month.value = month;}
    if (day < 10){ frm.end_day.value = "0"+day; }else{ frm.end_day.value = day;}
//    alert(day);

    year = e_date.getYear();
    if(year < 1900) year = year + 1900;
    //month = e_date.getMonth() + 1;
    makedate = e_date.getDate();
    e_date.setDate(makedate);

    year = e_date.getYear();
    month = e_date.getMonth() + 1;
    day = e_date.getDate();

    frm.start_year.value = year;
    if (month < 10){ frm.start_month.value = "0"+month; }else{ frm.start_month.value = month;}
    if (day < 10){ frm.start_day.value = "0"+day; }else{ frm.start_day.value = day;}
//    alert(day);
}

function setSchDate3(flag) {

    var frm = document.f;
    var year;
    var month;
    var day;
    var makedate;
    var s_date = new Date();
    var e_date = new Date();

    switch(flag){
        case 1:
            makedate=e_date.getDate()-6;
            s_date.setDate(makedate);
            break;
        case 2:
            makedate=e_date.getDate()-14;
            s_date.setDate(makedate);
            break;
        case 3:
            makedate=e_date.getMonth()-1;
            s_date.setMonth(makedate);
            break;
        case 4:
            makedate=e_date.getMonth()-2;
            s_date.setMonth(makedate);
            break;
        case 5:
            makedate=e_date.getMonth()-3;
            s_date.setMonth(makedate);
            break;
        case 6:
            makedate=e_date.getDate()-2;
            s_date.setDate(makedate);
            break;

    }
    //month는 지정이 되었으니 날짜를 지정해준다
    if(flag == 3 || flag == 4 || flag == 5){
        makedate=s_date.getDate();
        s_date.setDate(makedate);
    }

    year = s_date.getYear();
    if(year < 1900) year = year + 1900;
    month = s_date.getMonth() + 1;
    day = s_date.getDate();
    //frm.start_year.value = year;
    if (month < 10){ month = "0"+month; }else{ month = month;}
    if (day < 10){ day = "0"+day; }else{ day = day;}

    frm.search_Start_Day.value = year + month + day;

    year = e_date.getYear();
    if(year < 1900) year = year + 1900;
    //month = e_date.getMonth() + 1;
    //makedate = e_date.getDate() - 1;
    makedate = e_date.getDate();
    e_date.setDate(makedate);

    year = e_date.getYear();
    month = e_date.getMonth() + 1;
    day = e_date.getDate();

    //frm.end_year.value = year;
    if (month < 10){ month = "0"+month; }else{ month = month;}
    if (day < 10){ day = "0"+day; }else{ day = day;}

    frm.search_End_Day.value = year + month + day;
}

/*
 * 날짜의 특정 기간 구하기
 * param flag (1:7일, 2:15일, 3:한달, 4:두달, 5:세달, 6:3일)
 * 수정 : 2006.11.03_김명숙_데이터 리턴값 오류 수정
 */
function setSchDate4(flag) {

    var frm = document.f;
    var year;
    var month;
    var day;
    var makedate;
    var s_date = new Date();
    var e_date = new Date();
    var returnDate;

    switch(flag){
        case 1:
            makedate=e_date.getDate()+5;
            s_date.setDate(makedate);
            break;
        case 2:
            makedate=e_date.getDate()+13;
            s_date.setDate(makedate);
            break;
        case 3:
            makedate=e_date.getMonth()+1;
            s_date.setMonth(makedate);
            break;
        case 4:
            makedate=e_date.getMonth()+2;
            s_date.setMonth(makedate);
            break;
        case 5:
            makedate=e_date.getMonth()+3;
            s_date.setMonth(makedate);
            break;
        case 6:
            makedate=e_date.getDate()+1;
            s_date.setDate(makedate);
            break;

    }

    //month는 지정이 되었으니 날짜를 지정해준다
    if(flag == 3 || flag == 4 || flag == 5){
        makedate=s_date.getDate();
        s_date.setDate(makedate-1);
    }else{
        makedate=s_date.getDate();
        s_date.setDate(makedate+1);
    }

    year = s_date.getYear();
    if(year < 1900) year = year + 1900;
    month = s_date.getMonth() + 1;
    day = s_date.getDate();

    //frm.start_year.value = year;
    if (month < 10){ month = "0"+month; }else{ month = month;}
    if (day < 10){ day = "0"+day; }else{ day = day;}

    //alert(year + month + day);
    returnDate = year + "_" + month + "_" + day;
    returnDate = returnDate.replaceAll('_', '');

    //종료날짜
    frm.search_End_Day.value = returnDate;

    year = e_date.getYear();
    if(year < 1900) year = year + 1900;
    //month = e_date.getMonth() + 1;
    makedate = e_date.getDate();
    e_date.setDate(makedate);

    year = e_date.getYear();
    month = e_date.getMonth() + 1;
    day = e_date.getDate();
    //frm.end_year.value = year;
    if (month < 10){ month = "0"+month; }else{ month = month;}
    if (day < 10){ day = "0"+day; }else{ day = day;}

    returnDate = year + "_" + month + "_" + day;
    returnDate = returnDate.replaceAll('_', '');

    //시작날짜
    frm.search_Start_Day.value = returnDate;
}

// 기능   : day의 값에 따라 날짜를 더해서 출력한다.
// 작성자 : 윤혁
// 작성일 : 2003.12.01
function plus_day_kt2(day, obj1, obj2, obj3, obj4, obj5, obj6) {

    var today2= new Date();
    var today = new Date();    // 현재날짜를 구함

    var nowyear = today.getYear();
    if(nowyear < 1900) nowyear = nowyear + 1900;

    var nowmonth = today.getMonth()+1;
    if (nowmonth < 10){ nowmonth = "0"+nowmonth;}

    var nowday = today.getDate();
    if(nowday < 10) nowday = "0"+nowday;

    var tdate = today.getDate()+day; // day 이후날짜를 구함

    today2.setDate(tdate);

    var tyear = today2.getYear();
    if(tyear < 1900) tyear = tyear + 1900;

    var tmon = today2.getMonth()+1;
    if(tmon < 10) tmon = "0"+tmon;

    var tday = today2.getDate();
    if(tday < 10) tday = "0"+tday;

    obj1.value    = nowyear;
    obj2.value    = nowmonth;
    obj3.value    = nowday;
    obj4.value    = tyear;
    obj5.value    = tmon;
    obj6.value    = tday;
    //obj1.value = tyear + "" + tmon + "" + tday;
    //obj2.value = nowyear + "" + nowmonth + "" + nowday;
}


//길이체크
function isNullValue(inputValue){
    if (inputValue == null || inputValue.length == 0 || inputValue == ""){
        return true;
    }else{
        return false;
    }
}

// 기능   : element길이체크 한글 2바이트
// 작성자 : 윤혁
// 작성일 : 2003.12.09
function lengthCheckKor(inputElement, maxLength, title){
    var c;
    var byteLength = 0;
    var strLength = 0;
    var halfMaxLength = parseInt(maxLength/2);
    for(i=0; i<inputElement.value.length; i++){
        c = inputElement.value.charAt(i);
        if (escape(c).length > 4){ // 한글이면
            byteLength += 2;
        }else{
            byteLength++;
        }
        strLength++;
        if (byteLength > maxLength){
            if(isNullValue(title)){
                alert(t + halfMaxLength + "자 이내로, 영문은 " + maxLength + "자 이내로 입력해 주세요");
            }else{
                alert("\""+title+"\"에는 한글은 " + halfMaxLength + "자 이내로, 영문은 " + maxLength + "자 이내로 입력해 주세요");
            }
            inputElement.value = inputElement.value.substring(0, strLength-1);
            if(inputElement.type != "hidden"){
                inputElement.focus();
            }
            return false;
        }
    }
    return true;
}

// 사용예 : if ( !checkEmpty(frm.OpnGjaSctNbr,   "비밀번호를 입력하십시오", false) ) return false;
function checkEmpty(obj, msg, emptyOk) {
    res = true;
    if(isEmptyObj(obj))    {
        if(!emptyOk) {
            alert(msg);
            obj.focus();
        }
        res = emptyOk;
    }
    return res;
}

function isEmptyObj(para) {
  for(var i=0; i<isEmptyObj.arguments.length; i++)
  {
    if( typeof(isEmptyObj.arguments[i]) == "object" && isEmptyObj.arguments[i].value.length > 0)
      return false;
  }

  return true;
}

//사용예 : if ( !checkLength(frm.OpnGjaSctNbr, 4, "신규통장 비밀번호는 [숫자] 4자리입니다.") ) return false;
function checkLength(obj, len, msg){
    if( byteLen(obj) != len ) {
        alert(msg);
        obj.focus();
        obj.value = "";
        return false;
    }
    return true;
}

function fexcel(){
        //document.fCopy.action = "/common/excel.jsp";

        if(!ifr.copyValue){
            alert('조회 후 사용하세요.');
        }else{
            document.toExcel.cvalue.value = ifr.copyValue.innerHTML;
            document.toExcel.submit();
        }
/*
        if(ifr.copyValue){
            document.fCopy.cvalue.value = ifr.copyValue.innerHTML;
            document.fCopy.submit();
        }else{
            alert('조회 후 사용하세요.');
        }
*/
    }


    function box_Check_All_Test(obj, arg){
        var f = document.f;
        var isMiJum = false;

        for(i=0; i<f.length; i++){//체크 박스 이름으로 있는지 검사
            if(f.elements[i].name == arg) isMiJum = true;
        }
        if(f.select_test.checked){
            if(isMiJum){//
                if(obj.length > 1) {
                    for(var i=0;i<obj.length;i++) {
                        if(obj[i].checked == false){
                            obj[i].checked = true;
                        }
                    }
                }else{
                    if(obj.checked == false){
                        obj.checked = true;
                    }
                }
                //select.innerHTML = '선택취소';
                //f.checkAll.value = checked;
            }else{
                alert('선택할 항목이 없습니다.');
            }
        }else{
            if(isMiJum){//ifr_4 에 beJum체크박스에 체크 된 점번 가져오기
                if(obj.length > 1) {
                    for(var i=0;i<obj.length;i++) {
                        if(obj[i].checked == true){
                            obj[i].checked = false;
                        }
                    }
                }else{
                    if(obj.checked == true){
                        obj.checked = false;
                    }
                }
                //select.innerHTML = '선택';
                //f.checkAll.value = checked;
            }else{
                alert('선택 취소할 항목이 없습니다.');
            }
        }
    }


    //이미지로딩
    function chageChart(tmpID, targetID) {
        var tmp = document.all[tmpID];
        var target = document.all[targetID];

        if(tmp != null) {
            tmp.style.display = 'none';
        }

        if(target != null) {
            target.style.display = '';
        }
    }

    //인쇄화면
    function goPrint(partnum, menunum, id, width, height, appscript) {
        //var win = window.open("/common/JZ3301.jsp?id=" + id + "&width=" + width + "&height=" + height + "&partnum=" + partnum + "&menunum=" + menunum + "&appscript=" + appscript, "print", "width=500, height=500, scrollbars=yes");
        var win = window.open("/common/print.jsp?id=" + id + "&width=" + width + "&height=" + height + "&partnum=" + partnum + "&menunum=" + menunum + "&appscript=" + appscript + "&css=basic.css", "print", "resizable=yes, scrollbars=yes, status=no");
        win.focus();
    }

    //엑셀다운
    function goExcel(loc) {
        document.location.href = loc;
    }




    /***************************************************************************
                                2007.10.05 추가함수
    ***************************************************************************/

    /*********************************************************************
    체크박스 전체선택 클릭시
    ************************************************************************/
    var flag = true;
    function revcheck(theform, thename) {
        var tblname="";
        if(arguments.length==3)
            tblname=arguments[2];
        allcheck_(theform, thename, tblname);
    }

    /*********************************************************************
    전체 선택
    ************************************************************************/
    function allcheck_(theform, thename, tblname){
        var Checks = eval("document." + theform+"."+thename );
        var objtbl;

        var chkflag;
        var chkcnt=0;

        if(tblname!="")objtbl= eval(tblname);
        if(Checks==null)return;
        if(Checks.length==null){
            Checks.checked = true;
        }else{
            for( var i=0; i<Checks.length; i++) {
                if (Checks[i].style!=null&&Checks[i].style.visibility!="hidden"
                &&(tblname!=""&&Checks[i].parentElement.parentElement.parentElement.parentElement==objtbl)||tblname==""){
                    chkcnt=chkcnt+1;
                    if(chkcnt==1){
                        chkflag=Checks[i].checked;
                        if(chkflag)chkflag=false;
                        else chkflag=true;
                    }
                    Checks[i].checked = chkflag;
                }
            }
        }
        return;
    }

    /*********************************************************************
    전체 해제
    ************************************************************************/
    function discheck(theform, thename,tblname){
        var Checks = eval("document." + theform+"."+thename );
        var objtbl;
        if(tblname!="")objtbl= eval(tblname);

        if(Checks==null)return;
        if(Checks.length==null){
            Checks.checked = true;
        }else{
            for( var i=0; i<Checks.length; i++) {
                if (Checks[i].style!=null&&Checks[i].style.visibility!="hidden"
                &&(tblname!=""&&Checks[i].parentElement.parentElement.parentElement.parentElement==objtbl)||tblname==""){
                    Checks[i].checked = false;
                }
            }
        }
        return;
    }

    /*********************************************************************
    오늘 날짜 얻어오기
    ************************************************************************/
    function getToday(seperator){
        var gubn = seperator;
        if(arguments.length==1) gubn = arguments[0];
        toDay = new Date();
        var year = toDay.getYear();
        var month= toDay.getMonth()+1;
        var day= toDay.getDate();
        return year + gubn + (month>9?month:"0"+month) + gubn + (day>9?day:"0"+day);
    }

    /*********************************************************************
    오늘 날짜 얻어오기
    ************************************************************************/
    function getToday(){
        var gubn = "";
        if(arguments.length==1) gubn = arguments[0];
        toDay = new Date();
        var year = toDay.getYear();
        var month= toDay.getMonth()+1;
        var day= toDay.getDate();
        return year + gubn + (month>9?month:"0"+month) + gubn + (day>9?day:"0"+day);
    }

/*
 *20091113 KHM 추가
 *음식/생업/생활 검색 추가 
 */
function openMainSub(frm) {

    var scope = frm.scope.value;

    // 검색쿼리 필터링
    if( checkQuery(frm.query.value) == ":") {
        return;
    }

    frm.Query.value = encodeURIComponent(frm.query.value);

    //THESIS", "MEDIC", "DISEASE", "PRESCRIPT"
    if(scope == 'TOTAL') { // 통합검색
        frm.chkScope.value = "THESIS|MEDIC|DISEASE|PRESCRIPT|FOOD|AGRI|LIFE";
    } else if(scope == 'THESIS') { // 논문검색
        frm.chkScope.value = "THESIS";
    } else if(scope == 'MEDIC') { // 약재검색
            frm.chkScope.value = "MEDIC";
    } else if(scope == 'DISEASE') { // 병증검색
            frm.chkScope.value = "DISEASE";
    } else if(scope == 'PRESCRIPT') { // 처방검색
            frm.chkScope.value = "PRESCRIPT";
    } else if(scope == 'FOOD') { // 음식검색
            frm.chkScope.value = "FOOD";
    } else if(scope == 'LIFE') { // 생활검색
            frm.chkScope.value = "LIFE";
    } else if(scope == 'AGRI') { // 생업검색
            frm.chkScope.value = "AGRI";
    }

    frm.action = "/servlet/TotalSearchServlet";
    frm.target = "_self";
    frm.submit();

}

/* 전달의 날짜를 구한다 */
function preMonthday(str){

  var preMonthDay = "";
  var yyyy = "";
  var mm = "";
  var dd = "";

  if(str.length == 10){
   var Cal = str.split("/");
   yyyy = Cal[0];
   mm = Cal[1];
   dd = Cal[2];
  }else{
   yyyy = str.substring(0,4);
   mm = str.substring(4,6);
   dd = str.substring(6);
  }

  if(parseInt(mm,10) != 1){

   var preMM = "" + (parseInt(mm,10) -1);
   preMonthDay = yyyy +"/" + fixStrLen(preMM,2) + "/" + dd;
  }else{

   preMonthDay = (parseInt(yyyy,10) - 1) + "/12/" + dd;
  }

  var nowDate = new Date();
  nowDate.setYear(preMonthDay.substring(0,4));
  nowDate.setMonth(preMonthDay.substring(5,7) - 1); // 월은 0=1월, 1=2월... 11=12월
  nowDate.date= getLastDay(nowDate);
  var Lastday = getLastDay(nowDate);

  if(parseInt(dd,10)  > parseInt(Lastday,10)){

   preMonthDay = preMonthDay.substring(0,8) + Lastday;

  }

  if(str.length == 8)
   preMonthDay = preMonthDay.replace(/\//gi,"");
  return preMonthDay;
}

function fixStrLen(str1, str2) {
    if(str1.length == 1) {
        return '0' + str1;
    }
    return str1;
}

/* 해당월의 마지막 일 수를 구함 */
function getLastDay(solar_date)
{
 var MonthTable = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
 if (((solar_date.getYear() % 4 == 0) && (solar_date.getYear() % 100 != 0)) || (solar_date.getYear()% 400 == 0))
  MonthTable[1] = 29;
 else
  MonthTable[1] = 28;
 return MonthTable[solar_date.getMonth()];
}

/* 
 * 091029 KHM 추가 
 * sleep()기능 일정 시간 멈추기 
 */
function pause(numberMillis) {     var now = new Date();     var exitTime = now.getTime() + numberMillis;     while (true) {          now = new Date();          if (now.getTime() > exitTime)              return;     }}

