﻿var community=
{

    // 검색어 조회
    searchBoard:function(dateTyp,forumTyp){
		var f = document.frm;

		if(forumTyp == "EN"){
			location.href = "/relationship-forum/singles-advice.asp?date_typ=" + dateTyp + "&txt_search_keywd=" + f.txt_search_keywd.value;
		}else if(forumTyp == "KR"){
			location.href = "/relationship-forum/forum-korea.asp?date_typ=" + dateTyp + "&txt_search_keywd=" + f.txt_search_keywd.value;
		}else if(forumTyp == "CN"){
			location.href = "/relationship-forum/forum-china.asp?date_typ=" + dateTyp + "&txt_search_keywd=" + f.txt_search_keywd.value;
		}
	},

	// 뷰페이지로 이동
	datecoachView:function(sel_searchField,search_keywd,page,date_typ,mainSeq,main_typ,forumTyp){

		search_keywd = search_keywd.replace(/\{SINGLE_QUOTATION\}/gi,"'");
		search_keywd = search_keywd.replace(/\{DOUBLE_QUOTATION\}/gi,"\"");

        if(forumTyp == "EN"){
		    location.href = "/relationship-forum/singles-advice-view.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&date_typ="+date_typ+"&txt_main_seq=" + mainSeq+"&txt_main_typ="+main_typ;
		}else if(forumTyp == "KR"){
		    location.href = "/relationship-forum/forum-korea-view.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&date_typ="+date_typ+"&txt_main_seq=" + mainSeq+"&txt_main_typ="+main_typ;
		}else if(forumTyp == "CN"){
		    location.href = "/relationship-forum/forum-china-view.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&date_typ="+date_typ+"&txt_main_seq=" + mainSeq+"&txt_main_typ="+main_typ;
	    }
	},

	//센터홈보기
	openCenterMain:function(orgCd){
        var top  = screen.height/2 - 835/2;
        var left = screen.width/2 -850/2;
        var sFeatures="top="+top+",left="+left+",width=850,height=835,scrollbars=yes,menubar=no,status=no,resizable=yes";

        window.open("/about-us/center-branch.asp?orgCd="+orgCd,"",sFeatures);
	},

	// 글쓰기로 이동
	goWrite:function (sel_searchField,search_keywd,page,bbs_writ_psbl_yn,forumTyp){

		if(isEmpty(js_vg_login_id) && isEmpty(js_vg_real_login_id)){
			Login_RtnUrl('');
			return;
		}

		//글쓰기권한 부여된 회원만 작성가능
		if (!(bbs_writ_psbl_yn == "Y" )){
			alert(Message.getMessage("MSG00639"));
			return;
		}

		search_keywd = search_keywd.replace(/\{SINGLE_QUOTATION\}/gi,"'");
		search_keywd = search_keywd.replace(/\{DOUBLE_QUOTATION\}/gi,"\"");

        if(forumTyp == "EN"){
		    location.href = "/relationship-forum/singles-advice-write.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&hid_mode=WRITE";
		}else if(forumTyp == "KR"){
		    location.href = "/relationship-forum/forum-korea-write.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&hid_mode=WRITE";
		}else if(forumTyp == "CN"){
		    location.href = "/relationship-forum/forum-china-write.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&hid_mode=WRITE";
        }
	},

	// 목록
	datecoach_goList:function(sel_searchField,search_keywd,page,main_seq,date_typ,forumTyp){

		search_keywd = search_keywd.replace(/\{SINGLE_QUOTATION\}/gi,"'");
		search_keywd = search_keywd.replace(/\{DOUBLE_QUOTATION\}/gi,"\"");

        if(forumTyp == "EN"){
            location.href = "/relationship-forum/singles-advice.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&date_typ="+date_typ;
        }else if(forumTyp == "KR"){
            location.href = "/relationship-forum/forum-korea.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&date_typ="+date_typ;
        }else if(forumTyp == "CN"){
            location.href = "/relationship-forum/forum-china.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&date_typ="+date_typ;
        }
    },

    //본인 추천
	self_hot:function(){
		alert(Message.getMessage("MSG00556"));
		return;
	},

	//본인 신고
	self_warn:function(){
		alert(Message.getMessage("MSG00557"));
		return;
	},

	//댓글추천2
	Main_goHot:function(mainSeq,hotYn,forumTyp){
		var f = document.frm;

		if(hotYn == "Y"){
			alert(Message.getMessage("MSG00498"));
			return;
		}

		if(!confirm(Message.getMessage("MSG00493"))){
        	return;
		}

		f.hid_mode.value       = "Main_HOT";
		f.hid_main_seq.value   = mainSeq;
		procFlag = true;

		f.method = "post";
        f.target = "if_datecoach";

        if(forumTyp == "EN"){
            f.action = "/relationship-forum/singles-advice-comment-proc.asp";
        }else if(forumTyp == "KR"){
            f.action = "/relationship-forum/forum-korea-comment-proc.asp";
        }else if(forumTyp == "CN"){
            f.action = "/relationship-forum/forum-china-comment-proc.asp";
        }

        f.submit()
	},

    //댓글신고2
	Main_goWar:function(mainSeq,warYn,forumTyp){
		var f = document.frm;

		if(warYn == "Y"){
			alert(Message.getMessage("MSG00499"));
			return;
		}

		if (!confirm(Message.getMessage("MSG00494"))){
        	return;
		}

		f.hid_mode.value       = "Main_WAR";
		f.hid_main_seq.value   = mainSeq;
		procFlag = true;

		f.method = "post";
        f.target = "if_datecoach";

        if(forumTyp == "EN"){
            f.action = "/relationship-forum/singles-advice-comment-proc.asp";
        }else if(forumTyp == "KR"){
            f.action = "/relationship-forum/forum-korea-comment-proc.asp";
        }else if(forumTyp == "CN"){
            f.action = "/relationship-forum/forum-china-comment-proc.asp";
        }

        f.submit()

	},

	//로그인 없는경우 메세지 출력
	goMsg:function(){
		alert(Message.getMessage("MSG00271"));
		return;
	},

	//매니저 정보보기 팝업
	popConsultant:function(mngrCustNm, forumTyp){
        var top  = screen.height/2 - 700/2;
        var left = screen.width/2 - 498/2;
        var sFeatures = "top=" + top + ",left=" + left + ",width=498,height=700,scrollbars=no,menubar=no,status=no,resizable=no";

		window.open("/common/popCommunityConsultant.asp?txt_emp_cust_no=" + mngrCustNm + "&forum_typ=" + forumTyp ,"popConsultant" ,sFeatures);
    },

    // 수정 화면으로 이동
	goEdit:function(sel_searchField,search_keywd,page,main_seq,forumTyp){

		if(forumTyp == "EN"){
		    location.href = "/relationship-forum/singles-advice-write.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&hid_mode=EDIT";
	    }else if(forumTyp == "KR"){
	        location.href = "/relationship-forum/forum-korea-write.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&hid_mode=EDIT";
	    }else if(forumTyp == "CN"){
	        location.href = "/relationship-forum/forum-china-write.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&hid_mode=EDIT";
	    }
	},

	// 게시글 삭제
	goDel:function(mainSeq,forumTyp){
		var f = document.frm;

		if (!confirm(Message.getMessage("MSG00290"))){
        	return;
		}

		f.hid_mode.value       = "DEl";
		f.hid_main_seq.value   = mainSeq;
		procFlag = true;

		f.method = "post";
        f.target = "if_datecoach";

        if(forumTyp == "EN"){
            f.action = "/relationship-forum/singles-advice-delete-proc.asp";
        }else if(forumTyp == "KR"){
            f.action = "/relationship-forum/forum-korea-delete-proc.asp";
        }else if(forumTyp == "CN"){
            f.action = "/relationship-forum/forum-china-delete-proc.asp";
        }

        f.submit();
	},

	//추천시간순으로 댓글 조회
	goSearch:function(search,sel_searchField,search_keywd,page,main_seq,v_date_typ,forumTyp){

	    if(forumTyp == "EN"){
		    location.href = "/relationship-forum/singles-advice-view.asp?search=" + search + "&sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&date_typ="+v_date_typ;
		}else if(forumTyp == "KR"){
		    location.href = "/relationship-forum/forum-korea-view.asp?search=" + search + "&sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&date_typ="+v_date_typ;
		}else if(forumTyp == "CN"){
		    location.href = "/relationship-forum/forum-china-view.asp?search=" + search + "&sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&date_typ="+v_date_typ;
	    }
	},

	//댓글추천
	goHot:function(cmmtSeq, mainSeq, hotYn, forumTyp){
		var f = document.frm;

		if(hotYn == "Y"){
			alert(Message.getMessage("MSG00498"));
			return;
		}

		if (!confirm(Message.getMessage("MSG00493"))){
        	return;
		}

		f.hid_mode.value       = "HOT";
		f.hid_cmmt_seq.value   = cmmtSeq;
		f.hid_main_seq.value   = mainSeq;
		procFlag = true;

		f.method = "post";
        f.target = "if_datecoach";

        if(forumTyp == "EN"){
            f.action = "/relationship-forum/singles-advice-comment-proc.asp";
        }else if(forumTyp == "KR"){
            f.action = "/relationship-forum/forum-korea-comment-proc.asp";
        }else if(forumTyp == "CN"){
            f.action = "/relationship-forum/forum-china-comment-proc.asp";
        }

        f.submit()

	},

	//댓글신고
	goWar:function(cmmtSeq, mainSeq,warYn,forumTyp){
		var f = document.frm;

		if(warYn == "Y"){
			alert(Message.getMessage("MSG00499"));
			return;
		}

		if (!confirm(Message.getMessage("MSG00494"))){
        	return;
		}

		f.hid_mode.value       = "WAR";
		f.hid_cmmt_seq.value   = cmmtSeq;
		f.hid_main_seq.value   = mainSeq;
		procFlag = true;

		f.method = "post";
        f.target = "if_datecoach";

        if(forumTyp == "EN"){
            f.action = "/relationship-forum/singles-advice-comment-proc.asp";
        }else if(forumTyp == "KR"){
            f.action = "/relationship-forum/forum-korea-comment-proc.asp";
        }else if(forumTyp == "CN"){
            f.action = "/relationship-forum/forum-china-comment-proc.asp";
        }

        f.submit()

	},

	// 댓글 삭제
	goComment:function(cmmtSeq, mainSeq, forumTyp){
		var f = document.frm;

		if (!confirm(Message.getMessage("MSG00290"))){
        	return;
		}

		f.hid_mode.value       = "DEL";
        f.hid_cmmt_seq.value   = cmmtSeq;
		f.hid_main_seq.value   = mainSeq;
		procFlag = true;

		f.method = "post";
        f.target = "if_datecoach";

        if(forumTyp == "EN"){
            f.action = "/relationship-forum/singles-advice-comment-proc.asp";
        }else if(forumTyp == "KR"){
            f.action = "/relationship-forum/forum-korea-comment-proc.asp";
        }else if(forumTyp == "CN"){
            f.action = "/relationship-forum/forum-china-comment-proc.asp";
        }

        f.submit();
	},

	//답변채택
	goPublish:function(cmmtSeq, mainSeq, forumTyp){
		var f = document.frm;

		if (!confirm(Message.getMessage("MSG00492"))){
        	return;
		}

		f.hid_mode.value        = "PUBLISH";
		f.hid_cmmt_seq.value    = cmmtSeq;
		f.hid_main_seq.value    = mainSeq;
		procFlag = true;

		f.method = "post";
        f.target = "if_datecoach";

        if(forumTyp == "EN"){
            f.action = "/relationship-forum/singles-advice-comment-proc.asp";
        }else if(forumTyp == "KR"){
            f.action = "/relationship-forum/forum-korea-comment-proc.asp";
        }else if(forumTyp == "CN"){
            f.action = "/relationship-forum/forum-china-comment-proc.asp";
        }

        f.submit()
	},

	// 댓글등록
	goSave:function(mainSeq,real_cust_typ,login_id,bbs_writ_psbl_yn, forumTyp){
		//글쓰기권한 부여된 회원만 작성가능
		if (!(bbs_writ_psbl_yn == "Y" )){
			alert(Message.getMessage("MSG00639"));
			return;
		}

		var f = document.frm;

		if (real_cust_typ != "03" ){
			if (login_id == ""){
				alert(Message.getMessage("MSG00180"));
				return;
			}
		}

		//회원만 작성가능
		if (!(js_vg_mbr_typ == "03" || js_vg_real_cust_typ == "03")){
			alert(Message.getMessage("MSG00525"));
			return;
		}

		if(isEmpty($("txt_name").value)){
			alert(Message.getMessage("MSG00461"));
			$("txt_name").focus();
			return;
		}

		if(forumTyp == "KR") {
		    var strNm = "고객만족팀";
		}else{
		    var strNm = "CSR Team";
		}

		if($("txt_name").value.indexOf(strNm)>= 0){
			if(js_vg_real_login_id != "wjlee" && js_vg_real_login_id != "sjlee::1" && js_vg_real_login_id != "toto777" && js_vg_real_login_id != "cwhyun" && js_vg_real_login_id != "sunyoun" && js_vg_real_login_id != "hera2008"){
				alert(Message.getMessage("MSG00406"));
				$("txt_name").focus();
				return;
			}
		}
		
		if(isMaxLenOver($("txt_name").value.trim(),16))
		{
			alert(Message.getMessage("MSG00722"));
			f.txt_name.focus();
			return;
		}
		
		if(isEmpty($("txt_comment").value)){
			alert(Message.getMessage("MSG00021"));
			$("txt_comment").focus();
			return;
		}
		if(isMaxLenOver($("txt_comment").value.trim(),1000)){
			alert(Message.getMessage("MSG00559"));
			$("txt_comment").select();
            $("txt_comment").focus();
			return;
		}

		if (!confirm(Message.getMessage("MSG00462"))){
        	return;
		}

		f.hid_mode.value       = "CMMT";
		f.hid_main_seq.value  = mainSeq;
		procFlag = true;

		f.method = "post";
        f.target = "if_datecoach";

        if(forumTyp == "EN"){
            f.action = "/relationship-forum/singles-advice-comment-proc.asp";
        }else if(forumTyp == "KR"){
            f.action = "/relationship-forum/forum-korea-comment-proc.asp";
        }else if(forumTyp == "CN"){
            f.action = "/relationship-forum/forum-china-comment-proc.asp";
        }

        f.submit();
	},

	// 이전글 다음글
	moveSelf:function(gbn,sel_searchField,search_keywd,page,main_seq,main_typ,forumTyp){
        if(gbn == "PREV"){
            if(forumTyp == "EN"){
                location.href = "/relationship-forum/singles-advice-view.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&txt_main_typ="+main_typ;
            }else if(forumTyp == "KR"){
                location.href = "/relationship-forum/forum-korea-view.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&txt_main_typ="+main_typ;
            }else if(forumTyp == "CN"){
                location.href = "/relationship-forum/forum-china-view.aspp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&txt_main_typ="+main_typ;
           }
        }else{
            if(forumTyp == "EN"){
                location.href = "/relationship-forum/singles-advice-view.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&txt_main_typ="+main_typ;
            }else if(forumTyp == "KR"){
                location.href = "/relationship-forum/forum-korea-view.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&txt_main_typ="+main_typ;
            }else if(forumTyp == "CN"){
                location.href = "/relationship-forum/forum-china-view.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&txt_main_typ="+main_typ;
            }
        }
    },

    goChk:function(){
		//회원만 작성가능
		if (!(js_vg_mbr_typ == "03" || js_vg_real_cust_typ == "03")){
			alert(Message.getMessage("MSG00525"));
			return;
		}
	},

	login_com:function(){
		alert(Message.getMessage("MSG00555"));
		return;
	},

	CommentLength:function(field){
		var TextLength = getByteLength(field.value);

		if(parseInt(TextLength) > 1000 ){
			$("TextLengthF").innerHTML = "<a style='color:red'>" + TextLength + "</a> Bytes";
		}else{
			$("TextLengthF").innerHTML = TextLength + " Bytes";
		}
	},

	popForumGuideline:function(forumTyp){
        var top  = screen.height/2 - 675/2;
        var left = screen.width/2 - 620/2;
        var sFeatures = "top=" + top + ",left=" + left + ",width=620,height=675,scrollbars=yes,menubar=no,status=no,resizable=no";

		window.open("/common/popCommunityForumGuidelines.asp?forum_typ=" + forumTyp ,"popForumGuideline" ,sFeatures);
    },

    // 새글 등록
	goSave_main:function(forumTyp)
{
		var f = document.frm;

		//회원만 작성가능
		if (!(js_vg_mbr_typ == "03" || js_vg_real_cust_typ == "03")){
			alert(Message.getMessage("MSG00525"));
			return;
		}

		if(isEmpty(f.txt_ttl.value)){
			alert(Message.getMessage("MSG00020"));
			f.txt_ttl.focus();
			return;
		}

		if(isMinLenOver($("txt_ttl").value.trim(),8)){
			alert(Message.getMessage("MSG00625"));
			f.txt_ttl.focus();
			return;
		}

        if(forumTyp == "KR") {
		    var strNm = "고객만족팀";
		}else{
		    var strNm = "CSR Team";
		}

		if(f.txt_name.value.indexOf(strNm)>= 0){
			if(js_vg_real_login_id != "wjlee" && js_vg_real_login_id != "sjlee::1" && js_vg_real_login_id != "toto777" && js_vg_real_login_id != "cwhyun" && js_vg_real_login_id != "sunyoun" && js_vg_real_login_id != "hera2008"){
				alert(Message.getMessage("MSG00406"));
				f.txt_name.focus();
				return;
			}
		}

		if(isEmpty($("txt_name").value)){
			alert(Message.getMessage("MSG00461"));
			f.txt_name.focus();
			return;
		}

		if(isMaxLenOver($("txt_name").value.trim(),16))
		{
			alert(Message.getMessage("MSG00722"));
			f.txt_name.focus();
			return;
		}

		if(isEmpty(f.txt_content.value)){
			alert(Message.getMessage("MSG00021"));
			f.txt_content.focus();
			return;
		}

//        if(js_vg_real_login_id == "wjlee"){
//		    if(f.chk_ask_yn.checked == true && f.chk_mrg_yn.checked == true && f.chk_matching_yn.checked == true || f.chk_ask_yn.checked == true && f.chk_mrg_yn.checked == false && f.chk_matching_yn.checked == true || f.chk_ask_yn.checked == false && f.chk_mrg_yn.checked == true && f.chk_matching_yn.checked == true || f.chk_ask_yn.checked == true && f.chk_mrg_yn.checked == true && f.chk_matching_yn.checked == false){
//		        alert(Message.getMessage("MSG00658"));
//		        return;
//		    }
//		}else{
//		    if(f.chk_ask_yn.checked == true && f.chk_mrg_yn.checked == true){
//		        alert(Message.getMessage("MSG00658"));
//		        return;
//		    }
//		}

		if (!confirm(Message.getMessage("MSG00462"))){
        	return;
		}

		f.hid_mode.value  = "WRITE";
		procFlag = true;

		f.method = "post";
        f.target = "if_write";

        if(forumTyp == "EN"){
            f.action = "/relationship-forum/singles-advice-proc.asp";
        }else if(forumTyp == "KR"){
            f.action = "/relationship-forum/forum-korea-proc.asp";
        }else if(forumTyp == "CN"){
            f.action = "/relationship-forum/forum-china-proc.asp";
        }

        f.submit();

	},

	// 새글 수정
	goEdit_main:function(forumTyp){
		var f = document.frm;

		if(isEmpty(f.txt_ttl.value)){
			alert(Message.getMessage("MSG00020"));
			f.txt_ttl.focus();
			return;
		}

		if(isMinLenOver($("txt_ttl").value.trim(),8)){
			alert(Message.getMessage("MSG00625"));
			f.txt_ttl.focus();
			return;
		}


		if(isEmpty(f.txt_content.value)){
			alert(Message.getMessage("MSG00021"));
			f.txt_content.focus();
			return;
		}


		if (!confirm(Message.getMessage("MSG00476"))){
        	return;
		}


		f.hid_mode.value  = "EDIT";
		procFlag = true;

		f.method = "post";
        f.target = "if_write";

        if(forumTyp == "EN"){
            f.action = "/relationship-forum/singles-advice-proc.asp";
        }else if(forumTyp == "KR"){
            f.action = "/relationship-forum/forum-korea-proc.asp";
        }else if(forumTyp == "CN"){
            f.action = "/relationship-forum/forum-china-proc.asp";
        }

        f.submit();
	},

	// 목록
	goList_main:function(forumTyp){

	    if(forumTyp == "EN"){
		    location.href = "/relationship-forum/singles-advice.asp";
		}else if(forumTyp == "KR"){
		    location.href = "/relationship-forum/forum-korea.asp";
		}else if(forumTyp == "CN"){
		    location.href = "/relationship-forum/forum-china.asp";
		}
	},

	// 서버처리 결과
	saveRslt:function(flag,msg,mode,sel_searchField,search_keywd,page,main_seq,forumTyp){
		procFlag = false;

        message(msg);

		if(flag == "True"){
			if(mode == "WRITE"){
			    if(forumTyp == "EN"){
				    location.href = "/relationship-forum/singles-advice.asp";
				}else if(forumTyp == "KR"){
				    location.href = "/relationship-forum/forum-korea.asp";
				}else if(forumTyp == "CN"){
				    location.href = "/relationship-forum/forum-china.asp";
				}
			}else if(mode == "EDIT"){
			    if(forumTyp == "EN"){
				    location.href = "/relationship-forum/singles-advice-view.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq;
				}else if(forumTyp == "KR"){
				    location.href = "/relationship-forum/forum-korea-view.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq;
				}else if(forumTyp == "CN"){
				    location.href = "/relationship-forum/forum-china-view.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq;
			    }
			}
		}
	},

	saveCmmtRslt:function(flag,msg,sel_searchField,search_keywd,page,main_seq,txt_date_typ,forumTyp){
		procFlag = false;

        message(msg);

		if(flag == "True"){
		    if(forumTyp == "EN"){
                location.href = "/relationship-forum/singles-advice-view.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&date_typ="+txt_date_typ;
            }else if(forumTyp == "KR"){
                location.href = "/relationship-forum/forum-korea-view.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&date_typ="+txt_date_typ;
            }else if(forumTyp == "CN"){
                location.href = "/relationship-forum/forum-china-view.asp?sel_searchField="+sel_searchField+"&txt_search_keywd="+search_keywd+"&txt_curPage="+page+"&txt_main_seq="+main_seq+"&date_typ="+txt_date_typ;
		    }
		}
	},

	// 게시글 서버처리 결과
	delRslt:function(flag,msg,forumTyp){
		procFlag = false;

        message(msg);

		if(flag == "True"){
            if(forumTyp == "EN"){
			    location.href = "/relationship-forum/singles-advice.asp";
			}else if(forumTyp == "KR"){
			    location.href = "/relationship-forum/forum-korea.asp";
			}else if(forumTyp == "CN"){
			    location.href = "/relationship-forum/forum-china.asp";
			}
		}
	},

	//닉네임 중복 여부 체크
	chkDuplNick:function(writeTyp)
	{
		var f = document.frm;
		
		if(isEmpty($("txt_name").value) || $("txt_name").value == $("txt_name").defaultValue)
		{
			alert(Message.getMessage("MSG00461"));
			$("txt_name").focus();
			return;
		}
		
		if(isMaxLenOver($("txt_name").value.trim(),16))
		{
			alert(Message.getMessage("MSG00722"));
			f.txt_name.focus();
			return;
		}
		
		procFlag = true;

		f.method = "post";
        
        if(writeTyp == "MAINBOARD") {// 게시글
        	f.target = "if_write";
        	f.action = "singles-advice-proc.asp";
        }else {// 댓글
        	f.target = "if_datecoach";
        	f.action = "singles-advice-comment-proc.asp";
		}
		
		f.hid_mode.value = "DUPL_NICK";
		f.submit();
	}

}
