
function goSearch2(form) 
{	
	var frm = document.getElementById(form);
	
	if ( $.trim($("#search_keyword2").val()).length < 1 ){
		alert("검색어를 입력하십시요.");
		//frm.search_keyword2.fucus();
		//$("#search_keyword").focus();
		return false;
	}
	
    frm["page"].value = 1;	
    //frm.submit();
}

function goSearch(form) 
{	//alert("goSearch");
	var frm = document.getElementById(form);
	
	if($.trim($("#search_keyword2").val()).length < 1) {
        alert("검색어를 입력해 주십시요");
        //frm["search_keyword2"].focus();
        return false;
    }
    
    frm["page"].value = 1;	
 //   frm.submit();
}

function goFitSearch(form)
{
	var frm = document.getElementById(form);        
    
    frm["page"].value = 1;    
    frm.submit();
}

function nation_add() {
	var temp ='';        
	
	temp = temp + '<input type="radio" name="search_nation" id="search_nation" title="러시아" value="RU" class="chk" /> <label for="s_nation8">러시아</label>&nbsp;&nbsp;&nbsp;';
	temp = temp + '<input type="radio" name="search_nation" id="search_nation" title="이탈리아" value="ITA" class="chk" /> <label for="s_nation9">이탈리아</label>&nbsp;&nbsp&nbsp;';
	temp = temp + '<input type="radio" name="search_nation" id="search_nation" title="멕시코" value="ME" class="chk" /> <label for="s_nation10">맥시코</label>&nbsp;&nbsp;&nbsp;';
	temp = temp + '<input type="radio" name="search_nation" id="search_nation" title="브라질" value="BR" class="chk" /> <label for="s_nation11">브라질</label>&nbsp;&nbsp;&nbsp;';
	temp = temp + '<input type="radio" name="search_nation" id="search_nation" title="사우디아라비아" value="SA" class="chk" /> <label for="s_nation12">사우디아라비아</label>&nbsp;&nbsp;&nbsp;';
	temp = temp + '<input type="radio" name="search_nation" id="search_nation" title="아르헨티나" value="ARG" class="chk" /> <label for="s_nation13">아르헨티나</label>&nbsp;<br/>';
	temp = temp + '<input type="radio" name="search_nation" id="search_nation" title="남아프리카공화국" value="AF" class="chk" /> <label for="s_nation14">남아프리카공화국</label>&nbsp;&nbsp;';
	temp = temp + '<input type="radio" name="search_nation" id="search_nation" title="터키" value="TU" class="chk" /> <label for="s_nation15">터키</label>&nbsp;';
	temp = temp + '<input type="radio" name="search_nation" id="search_nation" title="인도" value="IND" class="chk" /> <label for="s_nation16">인도</label>&nbsp;';
	temp = temp + '<input type="radio" name="search_nation" id="search_nation" title="캐나다" value="CA" class="chk" /> <label for="s_nation17">캐나다</label>&nbsp;&nbsp;&nbsp;';
	temp = temp + '<input type="radio" name="search_nation" id="search_nation" title="유럽연합" value="EUR" class="chk" /> <label for="s_nation18">유럽연합</label>&nbsp;';	
	temp = temp + '<input type="radio" name="search_nation" id="search_nation" title="인도네시아" value="INA" class="chk" /> <label for="s_nation19">인도네시아</label>&nbsp;';
	temp = temp + '<input type="radio" name="search_nation" id="search_nation" title="기타" value="ETC" class="chk" /> <label for="s_nation20">기타</label>&nbsp;';
	nation_add_form.innerHTML = temp;
}

function goClean()
{
	document.location.href = "/kor/communication/comClean.do";
}

function goCleanInsert(id)
{
	if(id == '' || id == null)
	{
		alert("윤리경영 신고접수는  로그인 후에 사용가능합니다.");
	}
	else
	{
		document.location.href = "/kor/communication/comCleanPrpInsert.do?member_id=" + id;
	}
}

function goFitPrpInsert(id)
{
	if(id == '' || id == null)
	{
		alert("맞춤형 외국법제 정보 신청은  로그인 후에 사용가능합니다.");
	}
	else
	{
		document.location.href = "/kor/communication/comFitPrpInsert.do?id=" + id;
	}
}
function deleteAllCheck()
{
	var frm = document.getElementById('FitPrpListForm');
	
	frm["search_nation_all"].checked = false;
}

function allCheck()
{
	var frm = document.getElementById('FitPrpListForm');
	
	var check = frm["search_nation_all"].checked;
	if (check) {		
		frm["search_nation_de"].checked = true;
		frm["search_nation_am"].checked = true;
		frm["search_nation_en"].checked = true;
		frm["search_nation_jp"].checked = true;
		frm["search_nation_fr"].checked = true;
		frm["search_nation_ch"].checked = true;
		frm["search_nation_au"].checked = true;
		frm["search_nation_etc"].checked = true;
	} else {
		frm["search_nation_de"].checked = false;
		frm["search_nation_am"].checked = false;
		frm["search_nation_en"].checked = false;
		frm["search_nation_jp"].checked = false;
		frm["search_nation_fr"].checked = false;
		frm["search_nation_ch"].checked = false;
		frm["search_nation_au"].checked = false;
		frm["search_nation_etc"].checked = false;
	}	
}

function goFitList()
{
	document.location.href = "/kor/communication/comFitList.do";
}

function goFitPrpList()
{
	document.location.href = "/kor/communication/comFitPrpList.do";
}

function goFitView(seq)
{
	document.location.href = "/kor/communication/comFitView.do?seq=" + seq;
}

function goPoolInfo() 
{
	document.location.href = "/kor/communication/comExpPool.do";
}

function goPoolDelete()
{
	document.location.href = "/kor/communication/comExpPoolDelete.do";
}
function doPoolDelete()
{
	var form = document.getElementById("PoolDeleteForm");
	
	form.action = "/kor/communication/comExpPoolDelete.do";
	form.submit();
}

function goMain()
{
	document.location.href = "/kor/main.do";
}

function goPoolInsert(id)
{	
	document.location.href = "/kor/communication/comExpPoolInsert.do?id=" + id;
}

function goHistoryBack()
{
	history.go(-1);
}
function goPoolRule(id)
{
	if(id == '' || id == null)
	{
		alert("전문가POOL 회원가입은  로그인 후에 사용가능합니다.");
	}
	else
	{
		document.location.href = "/kor/communication/comExpPoolRule.do";
	}	
}

function blank()
{
	return;
}

function goQnaFileDelete(fseq, seq)
{
	document.location.href="/kor/communication/comQnaFileDelete.do?fseq=" + fseq + "&seq=" + seq;
}

function goCustomerFileDelete(fseq, seq)
{
	document.location.href="/kor/communication/comCustomerFileDelete.do?fseq=" + fseq + "&seq=" + seq;
}

function goFitPrpFileDelete(fseq, seq, type)
{
	document.location.href="/kor/communication/comFitPrpFileDelete.do?fseq=" + fseq + "&seq=" + seq + "&type=" + type;
}


function goFitPrpPage(page)
{
	var form = document.getElementById("FitPrpListForm");	

	form.page.value = page;	
	form.submit();
}

function goFitPage(page)
{
	var form = document.getElementById("FitListForm");	

	form.page.value = page;	
	form.submit();
	
}

function goSurveyPage(page)
{
	var form = document.getElementById("SurveyListForm");	

	form.page.value = page;	
	form.submit();
}

function goSurveyView(seq)
{	
	document.location.href = "/kor/communication/comSurveyView.do?seq="+seq;
}

//설문투표참여
function goSurveyVote(member_id) {
	
	if( member_id != '' ){
		alert("이미설문에 참여하셨습니다.");
		return;
	}
	
	var form = document.getElementById("SurveyVoteForm");
	var questCnt = form["questCnt"].value;
	var isFlag = false;
  
	var questionId, essent, kind, answerLength;  
	var errorMsg;

	for( var i=0; i< questCnt; i++)
	{
		try{
	    	questionId = document.getElementById("questionId"+(i+1)).value;	    	
	    	essent = document.getElementById("essent"+(i+1)).value;
	    	kind = document.getElementById("kind"+(i+1)).value;
	    	answerLength = document.getElementsByName("answer"+(i+1)).length;	    	
		}catch(e){
			alert(e);
		}
  	
	  	//객관식
		if( kind == '1'){
			//필수선택
			if( essent == 'Y' ){
				isFlag = false;
				for(var j=0; j < answerLength; j++ ){
	
		    		if( document.getElementsByName("answer"+(i+1))[j].checked){
		    			isFlag = true;
		    			break;
		    		}else{
		    			errorMsg = (i+1)+"번 설문의 항목을 선택하십시요.";
		    			isFlag = false;		    			
		    		}
		    	}
				if( !isFlag ){
					alert(errorMsg);
					document.getElementsByName("answer"+(i+1))[0].focus();
					return;
				}
			}
		}
		else if( kind == '2'){
			if( essent = 'Y'){
				isFlag = false;
				if( document.getElementsByName("answer"+(i+1))[0].value.trim() == '' ){
	    			alert((i+1)+"번 설문의 내용을 입력하세요.");
	    			document.getElementsByName("answer"+(i+1))[0].focus();
	    			return;
	    		}
			}
		}
	}    
	form.action = "/kor/communication/comSurveyVote.do";
	form.submit();
}

function doSurveyLoginChk(seq)
{	
	alert('로그인 후 이용가능합니다.');	
	document.location.href = "/kor/member/korLogin.do?code=M460_"+seq;
}

function doSurveyValidateChk(startDt, endDt)
{
	//	날자 체크
	var startDate = replaceAll(startDt, "-");
	var endDate   = replaceAll(endDt, "-");
	
	var start_yy = startDate.substring(0,4);
	var start_mm = startDate.substring(4,6);
	var start_dd = startDate.substring(6);
	
	var end_yy = endDate.substring(0,4);
	var end_mm = endDate.substring(4,6);
	var end_dd = endDate.substring(6);
	
	var today = new Date();
	var start_day = new Date(start_yy, start_mm-1, start_dd, 00,00,00);
	var end_day = new Date(end_yy, end_mm-1, end_dd, 24,00,00);
	
	//alert("start_day ::"+ start_day + "\ntoday::"+ today+"\nend_day ::"+ end_day);
	
	if( start_day > today ){
		alert('설문이 아직 시작되지 않았습니다.');
		document.location.href = "/kor/communication/comSurveyList.do";
	}else if( end_day < today ){
		alert('설문 참여기간이 만료되었습니다.');
		document.location.href = "/kor/communication/comSurveyList.do";		
	}			
}

function goSurveyList()
{
	document.location.href = "/kor/communication/comSurveyList.do";
}
function doParticipateChk(result, msg)
{
	if( result != '' )	alert(msg);	
}
function goFaqPage(page)
{
	var form = document.getElementById("FaqListForm");	

	form.page.value = page;	
	form.submit();
}

function goFaqView(seq)
{
	document.location.href="/kor/communication/comFAQView.do?seq=" + seq;
}

function goFitPrpView(seq, openis)
{
	if (openis == 'N') {
		removeMessage('FitPrpListForm');
		
		var xpos = event.x;
		var ypos = event.y;
		MM_showHideLayersEx('apDiv3','','show', xpos-400, ypos - 400);
		document.getElementById("FitPrpListForm").seq.value = seq;
		document.getElementById("FitPrpListForm").pwd.focus();
	} else {
		document.location.href="/kor/communication/comFitPrpView.do?seq=" + seq;
	}
}

function goPrpView(seq, openis)
{
	if (openis == 'N') {
		//removeMessage('PrpListForm');
		
		var xpos = event.x;
		var ypos = event.y;
		MM_showHideLayersEx('apDiv2','','show', xpos-400, ypos - 400);
		document.getElementById("PrpListForm").seq.value = seq;
		document.getElementById("PrpListForm").openIs.value = openis;
		document.getElementById("PrpListForm").checkPwd.focus();
	} else {
		document.getElementById("PrpListForm").method = "get";
		document.getElementById("PrpListForm").seq.value = seq;
		document.getElementById("PrpListForm").openIs.value = openis;
		document.getElementById("PrpListForm").action = "/kor/communication/comResearchPrpView.do";
		//document.getElementById("PrpListForm").submit();
		document.location.href="/kor/communication/comResearchPrpView.do?seq=" + seq + "&openIs=" + openis;
	}
}

function goPrpViewAdmin(seq, openis)
{
	document.getElementById("PrpListForm").method = "post";
	
	document.getElementById("PrpListForm").seq.value = seq;
	
	document.getElementById("PrpListForm").action = "/kor/communication/comResearchPrpView.do";
	//document.getElementById("PrpListForm").submit();

	document.location.href="/kor/communication/comResearchPrpView.do?seq=" + seq;
}

function goPrpConfirmAdmin()
{
	if( !confirm('게시물의 확인여부를 "Y"로 변경하시겠습니까?'))return;
	var seq = document.getElementById("PrpViewForm").seq.value;			
	document.location.href="/kor/communication/comResearchPrpConfirm.do?seq=" + seq;	
}

function goLegConfirmOneAdmin()
{
	if( !confirm('게시물의 확인여부를 "Y"로 변경하시겠습니까?'))return;
	var seq = document.getElementById("LegViewForm").seq.value;
	document.location.href = "/kor/communication/comLegPrpConfirmOne.do?seq="+seq;
}

function goLegConfirmTwoAdmin()
{
	if( !confirm('게시물의 확인여부를 "Y"로 변경하시겠습니까?'))return;
	var seq = document.getElementById("LegViewForm").seq.value;
	document.location.href = "/kor/communication/comLegPrpConfirmTwo.do?seq="+seq;
}


function goLegView(seq, status, openis)
{
	if (openis == 'N') {
		
		removeMessageLeg('LegListForm');
		var xpos = event.x;
		var ypos = event.y;
		
		
		MM_showHideLayersEx('apDiv1','','show', xpos, ypos - 200);
		document.getElementById("LegListForm").seq.value = seq;
		document.getElementById("LegListForm").pwd.focus();
		gstatus = status;
	} else {
		if (status == 'PI') {
			document.location.href="/kor/communication/comLegPrpViewOne.do?seq=" + seq+"&#goLegInfo";
		} else {
			document.location.href="/kor/communication/comLegPrpViewTwo.do?seq=" + seq+"&#goLegInfo";
		}
	}	
}

function goLegViewAdmin(seq, status, openis)
{
	if (status == 'PI') {
		document.location.href="/kor/communication/comLegPrpViewOne.do?seq=" + seq+"&#goLegInfo";
	} else {
		document.location.href="/kor/communication/comLegPrpViewTwo.do?seq=" + seq+"&#goLegInfo";
	}
}

function goQnaView(seq, depth, openyn)
{
	if (openyn == '비공개') {
		removeMessage('QnaListForm');
		
		var xpos = event.x;
		var ypos = event.y;
		MM_showHideLayersEx('apDiv4','','show', xpos-400, ypos -400);
		document.getElementById("QnaListForm").seq.value = seq;
		document.getElementById("QnaListForm").depth.value = depth;
		document.getElementById("QnaListForm").pwd.focus();		
	} else {
		document.location.href="/kor/communication/comQnaView.do?seq=" + seq + "&depth=" + depth;
	}	
}

function goCustomerView(seq, depth, openyn)
{	
	if (openyn == '비공개') {
		removeMessage('CustomerListForm');
		
		var xpos = event.x;
		var ypos = event.y;
		MM_showHideLayersEx('apDiv4','','show', xpos-400, ypos - 400);
		document.getElementById("CustomerListForm").seq.value = seq;
		document.getElementById("CustomerListForm").depth.value = depth;
		document.getElementById("CustomerListForm").pwd.focus();		
	} else {
		document.location.href="/kor/communication/comCustomerView.do?seq=" + seq + "&depth=" + depth;
	}	
}

function goPrpDelete()
{
	document.getElementById("PrpViewForm").type.value="DEL";
	var xpos = event.x;
	var ypos = event.y;
	MM_showHideLayersEx('apDiv1','','show', xpos-400, ypos - 400);	
	document.getElementById("PrpViewForm").pwd.focus();	
}

function goPrpDeleteAdmin()
{
	if( !confirm('게시물을 삭제하시겠습니까?'))	return;
	var seq = document.getElementById("PrpViewForm").seq.value;			
	document.location.href="/kor/communication/comResearchPrpDelete.do?seq=" + seq;
}

function goLegDeleteOne()
{
	document.getElementById("LegViewForm").type.value="DEL";
	var xpos = event.x;
	var ypos = event.y;
	MM_showHideLayersEx('apDiv1','','show', xpos-400, ypos - 400);	
	document.getElementById("LegViewForm").pwd.focus();
}

function goLegDeleteOneAdmin()
{
	if( !confirm("게시물을 삭제하시겠습니까?"))return;
	var seq = document.getElementById("LegViewForm").seq.value;
	var gubun = document.getElementById("LegViewForm").gubun.value;
	document.location.href="/kor/communication/comLegPrpDelete.do?seq=" + seq + "&gubun=" + gubun;	
}

function goLegDeleteTwo()
{
	document.getElementById("LegViewForm").type.value="DEL";
	var xpos = event.x;
	var ypos = event.y;
	MM_showHideLayersEx('apDiv1','','show', xpos-400, ypos - 400);	
	document.getElementById("LegViewForm").pwd.focus();
}

function goLegDeleteTwoAdmin()
{
	if( !confirm("게시물을 삭제하시겠습니까?"))return;
	var seq = document.getElementById("LegViewForm").seq.value;
	var gubun = document.getElementById("LegViewForm").gubun.value;
	document.location.href="/kor/communication/comLegPrpDelete.do?seq=" + seq + "&gubun=" + gubun;	
}

function goDeleteQna()
{
	document.getElementById("QnaForm").type.value="DEL";
	var xpos = event.x;
	var ypos = event.y;
	MM_showHideLayersEx('apDiv4','','show', xpos-400, ypos - 400);	
	document.getElementById("QnaForm").pwd.focus();
}

function goDeleteCustomer()
{
	document.getElementById("CustomerForm").type.value="DEL";
	var xpos = event.x;
	var ypos = event.y;
	MM_showHideLayersEx('apDiv4','','show', xpos-400, ypos - 400);	
	document.getElementById("CustomerForm").pwd.focus();
}

function goDeleteFitPrp()
{
	document.getElementById("FitPrpForm").type.value="DEL";
	var xpos = event.x;
	var ypos = event.y;
	MM_showHideLayersEx('apDiv4','','show', xpos-400, ypos - 400);	
	document.getElementById("FitPrpForm").pwd.focus();
}

function goPrpModify()
{
	document.getElementById("PrpViewForm").type.value="MODIFY";
	var xpos = event.x;
	var ypos = event.y;
	MM_showHideLayersEx('apDiv1','','show', xpos - 400, ypos - 400);	
	document.getElementById("PrpViewForm").pwd.focus();	
}

function goPrpModifyAdmin()
{	
	if( !confirm("게시물을 수정하시겠습니까?"))	return;
	var seq = document.getElementById("PrpViewForm").seq.value;			
	document.location.href="/kor/communication/comResearchPrpModify.do?seq=" + seq;	
}

function goLegModifyOne()
{
	document.getElementById("LegViewForm").type.value="MODIFY";
	var xpos = event.x;
	var ypos = event.y;
	MM_showHideLayersEx('apDiv1','','show', xpos-400, ypos - 400);	
	document.getElementById("LegViewForm").pwd.focus();	
}

function goLegModifyOneAdmin()
{
	if( !confirm("게시물을 수정하시겠습니까?"))return;
	var seq = document.getElementById("LegViewForm").seq.value;
	var status = document.getElementById("LegViewForm").status.value;			
	if (status == "PI") {
		document.location.href="/kor/communication/comLegPrpModifyOne.do?seq=" + seq;
	} else {
		document.location.href="/kor/communication/comLegPrpModifyTwo.do?seq=" + seq;
	}			
}

function goLegModifyTwo()
{
	document.getElementById("LegViewForm").type.value="MODIFY";
	var xpos = event.x;
	var ypos = event.y;
	MM_showHideLayersEx('apDiv1','','show', xpos-400, ypos-400);	
	document.getElementById("LegViewForm").pwd.focus();	
}

function goLegModifyTwoAdmin()
{
	if( !confirm("게시물을 수정하시겠습니까?"))return;
	var seq = document.getElementById("LegViewForm").seq.value;
	var status = document.getElementById("LegViewForm").status.value;			
	if (status == "PI") {
		document.location.href="/kor/communication/comLegPrpModifyOne.do?seq=" + seq;
	} else {
		document.location.href="/kor/communication/comLegPrpModifyTwo.do?seq=" + seq;
	}			
}

function goModifyQna()
{
	document.getElementById("QnaForm").type.value="MODIFY";
	var xpos = event.x;
	var ypos = event.y;
	MM_showHideLayersEx('apDiv4','','show', xpos - 400, ypos - 400);	
	document.getElementById("QnaForm").pwd.focus();
}

function goModifyCustomer()
{
	document.getElementById("CustomerForm").type.value="MODIFY";
	var xpos = event.x;
	var ypos = event.y;
	MM_showHideLayersEx('apDiv4','','show', xpos-400, ypos - 400);	
	document.getElementById("CustomerForm").pwd.focus();
}

function goModifyFitPrp()
{
	document.getElementById("FitPrpForm").type.value="MODIFY";
	var xpos = event.x;
	var ypos = event.y;
	MM_showHideLayersEx('apDiv4','','show', xpos -400, ypos - 400);	
	document.getElementById("FitPrpForm").pwd.focus();
}

function showDetailWriter()
{
	var xpos = event.x;
	var ypos = event.y;
	MM_showHideLayersEx('person','','show', xpos-400, ypos - 400);
}

function goPrpPage(page)
{
	var form = document.getElementById("PrpListForm");	

	form.page.value = page;	
	form.submit();
}

function goLegPage(page)
{
	var form = document.getElementById("LegListForm");	

	form.page.value = page;	
	form.submit();
	
}

function goQnaPage(page)
{
	var form = document.getElementById("QnaListForm");	

	form.page.value = page;
	form.submit();
}

function goCustomerPage(page)
{
	var form = document.getElementById("CustomerListForm");	

	form.page.value = page;
	form.submit();
}

var xmlHttp = null;
var secType = "";
var gstatus = "";
var gaction = "";

function doConfirmPrp()
{	
	var form = document.getElementById("PrpListForm");
	var pwd = form["checkPwd"].value;
	
	if(form["checkPwd"].value == '') {
        alert("비밀번호를 입력하세요.");
        form["checkPwd"].focus();
        return;
    }
	//removeMessage('PrpListForm');
    // Ajax 처리	
	form.method="GET";
	form.action = "/kor/communication/comResearchPrpView.do?seq="+form["seq"].value+"&openIs="+form["openIs"].value;
	form.submit();
	//doCheckPwdPrp('PrpListForm', pwd);	
}

function doConfirmLeg()
{		
	var form = document.getElementById("LegListForm");
	var pwd = form["pwd"].value;	
	if(form["pwd"].value == '') {
        alert("비밀번호를 입력하세요.");
        form["pwd"].focus();
        return;
    }
	document.getElementById("LegListForm").pwd2.value = pwd;
	removeMessageLeg('LegListForm');
	
    // Ajax 처리
	gaction = "VIEW";
	doCheckPwdLeg('LegListForm', pwd);
}

function doConfirmQna()
{		
	var form = document.getElementById("QnaListForm");
	var pwd = form["pwd"].value;	
	if(form["pwd"].value == '') {
        alert("비밀번호를 입력하세요.");
        form["pwd"].focus();
        return;
    }
	document.getElementById("QnaListForm").pwd2.value = pwd;
	removeMessage('QnaListForm');
    // Ajax 처리		
	gaction = "VIEW";
	doCheckPwdQna('QnaListForm', pwd);	
}

function doConfirmCustomer()
{		
	var form = document.getElementById("CustomerListForm");
	var pwd = form["pwd"].value;	
	if(form["pwd"].value == '') {
        alert("비밀번호를 입력하세요.");
        form["pwd"].focus();
        return;
    }
	document.getElementById("CustomerListForm").pwd2.value = pwd;
	removeMessage('CustomerListForm');
    // Ajax 처리		
	gaction = "VIEW";
	doCheckPwdCustomer('CustomerListForm', pwd);	
}

function doConfirmFitPrp()
{
	var form = document.getElementById("FitPrpListForm");
	var pwd = form["pwd"].value;	
	if(form["pwd"].value == '') {
        alert("비밀번호를 입력하세요.");
        form["pwd"].focus();
        return;
    }
	document.getElementById("FitPrpListForm").pwd2.value = pwd;
	removeMessage('FitPrpListForm');
	// Ajax 처리		
	gaction = "VIEW";
	doCheckPwdFitPrp('FitPrpListForm', pwd);
}


/**
 * 수정 및 삭제
 */

function doConfirmActionPrp(seq)
{		
	var form = document.getElementById("PrpViewForm");
	var pwd = form["pwd"].value;
	form["seq"].value = seq;
	if(form["pwd"].value == '') {
        alert("비밀번호를 입력하세요.");
        form["pwd"].focus();
        return;
    }
	removeMessagePrp('PrpViewForm');
	// Ajax 처리
	if(form["type"].value == "DEL") {
		gaction = "DEL";
	} else {
		gaction = "MODIFY";
	}
	doCheckPwdPrp('PrpViewForm', pwd);
			
	return;
}
/*
function doConfirmActionPrp(seq){
	var form = document.getElementById("PrpViewForm");
	var pwd = form["pwd"].value;
	form["seq"].value = seq;
	if(form["pwd"].value == '') {
        alert("비밀번호를 입력하세요.");
        form["pwd"].focus();
        return;
    }
	
	if(form["type"].value == 'MODIFY'){
		form.action = "/kor/communication/comResearchPrpModify.do";
	}else{
		form.action = "/kor/communication/comResearchPrpDelete.do";
	}
	form.submit();
	
}
*/

function doConfirmActionLeg(seq)
{		
	var form = document.getElementById("LegViewForm");
	var pwd = form["pwd"].value;	
	form["seq"].value = seq;
	if(form["pwd"].value == '') {
        alert("비밀번호를 입력하세요.");
        form["pwd"].focus();
        return;
    }		
	removeMessage('LegViewForm');	
	// Ajax 처리
	if(form["type"].value == "DEL") {
		gaction = "DEL";
	} else {
		gaction = "MODIFY";
	}
	doCheckPwdLeg('LegViewForm', pwd);
			
	return;
}

function doConfirmActionQna(seq)
{
	var form = document.getElementById("QnaForm");
	var pwd = form["pwd"].value;	
	form["seq"].value = seq;
	if(form["pwd"].value == '') {
        alert("비밀번호를 입력하세요.");
        form["pwd"].focus();
        return;
    }		
	removeMessageQna('QnaForm');	
	// Ajax 처리
	if(form["type"].value == "DEL") {
		gaction = "DEL";
	} else {
		gaction = "MODIFY";
	}
	doCheckPwdQna('QnaForm', pwd);
			
	return;
}

function doConfirmActionCustomer(seq)
{
	var form = document.getElementById("CustomerForm");
	var pwd = form["pwd"].value;	
	form["seq"].value = seq;
	if(form["pwd"].value == '') {
        alert("비밀번호를 입력하세요.");
        form["pwd"].focus();
        return;
    }		
	removeMessageCustomer('CustomerForm');	
	// Ajax 처리
	if(form["type"].value == "DEL") {
		gaction = "DEL";
	} else {
		gaction = "MODIFY";
	}
	doCheckPwdCustomer('CustomerForm', pwd);
			
	return;
}

function doConfirmActionFitPrp(seq)
{
	var form = document.getElementById("FitPrpForm");
	var pwd = form["pwd"].value;	
	form["seq"].value = seq;
	if(form["pwd"].value == '') {
        alert("비밀번호를 입력하세요.");
        form["pwd"].focus();
        return;
    }		
	removeMessageFitPrp('FitPrpForm');	
	// Ajax 처리
	if(form["type"].value == "DEL") {
		gaction = "DEL";
	} else {
		gaction = "MODIFY";
	}
	doCheckPwdFitPrp('FitPrpForm', pwd);
			
	return;
}

function createXMLHttpRequest()
{
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();    
	}
}

function doCheckPwdPrp(form, pwd)
{				
	var frm = document.getElementById(form);	
	var seq = frm.seq.value;	
	var url = "/kor/communication/checkPwd.do?seq=" + seq + "&pwd=" + pwd + "&type=PRP";
	secType="PRP";
	createXMLHttpRequest();
	if(xmlHttp != null) {
		xmlHttp.open("POST", url, true);
		xmlHttp.onreadystatechange = callback;	    
	    xmlHttp.send(null);	    
	}
	
}

function doCheckPwdLeg(form, pwd)
{	
	var frm = document.getElementById(form);	
	var seq = frm.seq.value;	
	createXMLHttpRequest();
	var url = "/kor/communication/checkPwd.do?seq=" + seq + "&pwd=" + pwd + "&type=LEG";;
	secType="LEG";
	if(xmlHttp != null) {
		xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange = callback;	    
	    xmlHttp.send(null);
	}	
}

function doCheckPwdQna(form, pwd)
{
	var frm = document.getElementById(form);	
	var seq = frm.seq.value;	
	createXMLHttpRequest();
	var url = "/kor/communication/checkPwd.do?seq=" + seq + "&pwd=" + pwd + "&type=QNA";;
	secType="QNA";
	if(xmlHttp != null) {
		xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange = callback;	    
	    xmlHttp.send(null);
	}	
}

function doCheckPwdCustomer(form, pwd)
{
	var frm = document.getElementById(form);	
	var seq = frm.seq.value;	
	createXMLHttpRequest();
	var url = "/kor/communication/checkPwd.do?seq=" + seq + "&pwd=" + pwd + "&type=CUSTOMER";;
	secType="CUSTOMER";
	if(xmlHttp != null) {
		xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange = callback;	    
	    xmlHttp.send(null);
	}	
}

function doCheckPwdFitPrp(form, pwd)
{
	var frm = document.getElementById(form);	
	var seq = frm.seq.value;	
	createXMLHttpRequest();
	var url = "/kor/communication/checkPwd.do?seq=" + seq + "&pwd=" + pwd + "&type=FITPRP";;
	secType="FITPRP";
	if(xmlHttp != null) {
		xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange = callback;	    
	    xmlHttp.send(null);
	}
}

function callback()
{				
	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			if (secType == "PRP") {
				setMessagePrp(xmlHttp.responseXML.getElementsByTagName("result"));
	    	} else if (secType == "LEG") {
	    		setMessageLeg(xmlHttp.responseXML.getElementsByTagName("result"));
	    	} else if (secType == "QNA") {
	    		setMessageQna(xmlHttp.responseXML.getElementsByTagName("result"));
	    	} else if (secType == "CUSTOMER") {
	    		setMessageCustomer(xmlHttp.responseXML.getElementsByTagName("result"));
	    	} else if (secType == "FITPRP") {
	    		setMessageFitPrp(xmlHttp.responseXML.getElementsByTagName("result"));
	    	}
	    } else {	    	
	    	if (secType == "PRP") {
	    		removeMessage('PrpListForm');
	    	} else if (secType == "LEG") {
	    		removeMessageLeg('LegListForm');
	    	} else if (secType == "QNA") {
	    		removeMessageLeg('QnaListForm');
	    	} else if (secType == "CUSTOMER") {
	    		removeMessageLeg('CustomerListForm');
	    	} else if (secType == "FITPRP") {
	    		removeMessage('FitPrpListForm');
	    	}
	    }
	}
}

function setMessagePrp(msg) 
{
	var msgNode = msg[0].firstChild.data;
	var errDiv = document.getElementById("errMsg");
	var txtNode = document.createTextNode(msgNode);	
	if (txtNode.nodeValue == 'OK') {		
		if (gaction == "VIEW") {
			
			var seq = document.getElementById("PrpListForm").seq.value;
			document.getElementById("PrpListForm").method="post";
			document.getElementById("PrpListForm").action = "/kor/communication/comResearchPrpView.do";
			document.getElementById("PrpListForm").submit();
			//document.location.href="/kor/communication/comResearchPrpView.do?seq=" + seq;
		} else if (gaction == "MODIFY") {
			var seq = document.getElementById("PrpViewForm").seq.value;		
			document.getElementById("PrpViewForm").method="post";
			document.getElementById("PrpViewForm").action = "/kor/communication/comResearchPrpModify.do";
			document.getElementById("PrpViewForm").submit();
			//document.location.href="/kor/communication/comResearchPrpModify.do?seq=" + seq;
		} else {
			var seq = document.getElementById("PrpViewForm").seq.value;
			document.getElementById("PrpViewForm").method="post";
			document.getElementById("PrpViewForm").action = "/kor/communication/comResearchPrpDelete.do";
			document.getElementById("PrpViewForm").submit();
			//document.location.href="/kor/communication/comResearchPrpDelete.do?seq=" + seq;
		}
	} else {
		errDiv.appendChild(txtNode);		
	}
}

function setMessageLeg(msg) 
{
	var msgNode = msg[0].firstChild.data;
	var errDiv = document.getElementById("errMsg");
	var txtNode = document.createTextNode(msgNode);
	
	if (txtNode.nodeValue == 'OK') {		
		if (gaction == "VIEW") {
			var form = document.getElementById("LegListForm");
			var seq = document.getElementById("LegListForm").seq.value;
			var pwd = form["pwd2"].value;
			var gubun = form["gubun"].value;
			
			if (gstatus == "PI") {
				document.location.href="/kor/communication/comLegPrpViewOne.do?seq=" + seq + "&pwd=" + pwd + "&gubun=" + gubun;
			} else {
				document.location.href="/kor/communication/comLegPrpViewTwo.do?seq=" + seq + "&pwd=" + pwd + "&gubun=" + gubun;
			}
		} else if (gaction == "MODIFY") {
			var seq = document.getElementById("LegViewForm").seq.value;
			var status = document.getElementById("LegViewForm").status.value;			
			if (status == "PI") {
				document.location.href="/kor/communication/comLegPrpModifyOne.do?seq=" + seq;
			} else {
				document.location.href="/kor/communication/comLegPrpModifyTwo.do?seq=" + seq;
			}			
		} else {
			var seq = document.getElementById("LegViewForm").seq.value;
			var gubun = document.getElementById("LegViewForm").gubun.value;
			document.location.href="/kor/communication/comLegPrpDelete.do?seq=" + seq + "&gubun=" + gubun;			
		}
	} else {
		errDiv.appendChild(txtNode);
	}
}

function setMessageQna(msg)
{
	var msgNode = msg[0].firstChild.data;
	var errDiv = document.getElementById("errMsg");
	var txtNode = document.createTextNode(msgNode);
	if (txtNode.nodeValue == 'OK') {
		if (gaction == "VIEW") {
			var form = document.getElementById("QnaListForm");
			var seq = document.getElementById("QnaListForm").seq.value;
			var depth = document.getElementById("QnaListForm").depth.value;
			var pwd = form["pwd2"].value;
			document.location.href="/kor/communication/comQnaView.do?seq=" + seq + "&depth=" + depth + "&pwd=" + pwd;		
		} else if (gaction == "MODIFY") {
			var seq = document.getElementById("QnaForm").seq.value;
			document.location.href="/kor/communication/comQnaModify.do?seq=" + seq;								
		} else {
			var seq = document.getElementById("QnaForm").seq.value;			
			document.location.href="/kor/communication/comQnaDelete.do?seq=" + seq;			
		}
		
	} else {
		errDiv.appendChild(txtNode);
	}
}

function setMessageCustomer(msg)
{
	var msgNode = msg[0].firstChild.data;
	var errDiv = document.getElementById("errMsg");
	var txtNode = document.createTextNode(msgNode);
	
	if (txtNode.nodeValue == 'OK') {
		if (gaction == "VIEW") {
			var form = document.getElementById("CustomerListForm");
			var seq = document.getElementById("CustomerListForm").seq.value;
			var depth = document.getElementById("CustomerListForm").depth.value;
			var pwd = form["pwd2"].value;
			document.location.href="/kor/communication/comCustomerView.do?seq=" + seq + "&depth=" + depth + "&pwd=" + pwd;		
		} else if (gaction == "MODIFY") {
			var seq = document.getElementById("CustomerForm").seq.value;
			document.location.href="/kor/communication/comCustomerModify.do?seq=" + seq;								
		} else {
			var seq = document.getElementById("CustomerForm").seq.value;			
			document.location.href="/kor/communication/comCustomerDelete.do?seq=" + seq;			
		}
		
	} else {
		errDiv.appendChild(txtNode);
	}
}

function setMessageFitPrp(msg)
{
	var msgNode = msg[0].firstChild.data;
	var errDiv = document.getElementById("errMsg");
	var txtNode = document.createTextNode(msgNode);
	if (txtNode.nodeValue == 'OK') {
		if (gaction == "VIEW") {
			var form = document.getElementById("FitPrpListForm");
			var seq = document.getElementById("FitPrpListForm").seq.value;
			var pwd = form["pwd2"].value;
			
			document.location.href="/kor/communication/comFitPrpView.do?seq=" + seq + "&pwd=" + pwd;		
		} else if (gaction == "MODIFY") {
			var seq = document.getElementById("FitPrpForm").seq.value;
			document.location.href="/kor/communication/comFitPrpModify.do?seq=" + seq;								
		} else {
			var seq = document.getElementById("FitPrpForm").seq.value;			
			document.location.href="/kor/communication/comFitPrpDelete.do?seq=" + seq;			
		}
		
	} else {
		errDiv.appendChild(txtNode);
	}
}	

function removeMessage(form)
{
	var errDiv = document.getElementById("errMsg");
	var index = errDiv.childNodes.length;
	for (var i = index - 1; i >= 0 ; i--) {
		errDiv.removeChild(errDiv.childNodes[i]);
	}
	
	var frm = document.getElementById(form);
	frm.pwd.value="";
	secType = "";
}

function removeMessageLeg()
{
	var errDiv = document.getElementById("errMsg");
	var index = errDiv.childNodes.length;
	for (var i = index - 1; i >= 0 ; i--) {
		errDiv.removeChild(errDiv.childNodes[i]);
	}
	
	var frm = document.getElementById("LegListForm");
	frm.pwd.value="";
	secType = "";
	status = "";
}

function removeMessageQna()
{
	var errDiv = document.getElementById("errMsg");
	var index = errDiv.childNodes.length;
	for (var i = index - 1; i >= 0 ; i--) {
		errDiv.removeChild(errDiv.childNodes[i]);
	}
	
	var frm = document.getElementById("QnaForm");
	frm.pwd.value="";
	secType = "";
	status = "";
}

function removeMessageCustomer()
{
	var errDiv = document.getElementById("errMsg");
	var index = errDiv.childNodes.length;
	for (var i = index - 1; i >= 0 ; i--) {
		errDiv.removeChild(errDiv.childNodes[i]);
	}
	
	var frm = document.getElementById("CustomerForm");
	frm.pwd.value="";
	secType = "";
	status = "";
}

function removeMessageFitPrp()
{
	var errDiv = document.getElementById("errMsg");
	var index = errDiv.childNodes.length;
	for (var i = index - 1; i >= 0 ; i--) {
		errDiv.removeChild(errDiv.childNodes[i]);
	}
	
	var frm = document.getElementById("FitPrpForm");
	frm.pwd.value="";
	secType = "";
	status = "";
}

function removeMessagePrp()
{
	var errDiv = document.getElementById("errMsg");
	var index = errDiv.childNodes.length;
	for (var i = index - 1; i >= 0 ; i--) {
		errDiv.removeChild(errDiv.childNodes[i]);
	}
	
	var frm = document.getElementById("PrpViewForm");
	frm.pwd.value="";
	secType = "";
	status = "";
}

function doInsertOne(name, gubun)
{
	if(name == '' || name == null)
	{
		alert("비회원은 작성하실 수 없습니다. 로그인 후에 작성해 주시길 바랍니다.");
	}
	else
	{
		document.location.href = "/kor/communication/comLegPrpInsertOne.do?gubun=" + gubun + "&id=" + name;
	}
}

function doInsertTwo(name, gubun)
{
	if(name == '' || name == null)
	{
		alert("비회원은 작성하실 수 없습니다. 로그인 후에 작성해 주시길 바랍니다.");
	}
	else
	{
		document.location.href = "/kor/communication/comLegPrpInsertTwo.do?gubun=" + gubun + "&id=" + name;
	}
}

function doQnaInsert(id)
{
	if(id == '' || id == null)
	{
		alert("비회원은 작성하실 수 없습니다. 로그인 후에 작성해 주시길 바랍니다.");
	}
	else
	{
		document.location.href = "/kor/communication/comQnaInsert.do?id=" + id;
	}
}

function doCustomerInsert(id)
{
	if(id == '' || id == null)
	{
		alert("비회원은 작성하실 수 없습니다. 로그인 후에 작성해 주시길 바랍니다.");
	}
	else
	{
		document.location.href = "/kor/communication/comCustomerInsert.do?id=" + id;
	}
}

function goLegPrpList(gubun)
{
	document.location.href = "/kor/communication/comLegPrpList.do?gubun=" + gubun;
}

function goQnaList()
{
	document.location.href = "/kor/communication/comQnaList.do";
}

function goCustomerList()
{
	document.location.href = "/kor/communication/comCustomerList.do";
}
