var getFFVersion  = navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];
var FFextraHeight = parseFloat(getFFVersion) >= 0.1 ? 16 : 0;

var profile = {

	show_layer:function(tgetImg,tgetLayer) {
		if($(tgetLayer).style.display != "none") {
		    $(tgetImg).src = "/img/w3c/self/new/icon_profil_on.gif";
			$(tgetLayer).style.display = "none";
		}else {
		    $(tgetImg).src = "/img/w3c/self/new/icon_profil_off.gif";
		    $(tgetLayer).style.display = "";
		}

		p_couple.fixup();
	},

	show_layer2:function(tgetImg,tgetLayer) {
		if($(tgetLayer).style.display != "none") {
		    $(tgetImg).src = "/images/on_profile.gif";
			$(tgetLayer).style.display = "none";
		}else {
		    $(tgetImg).src = "/images/off_profile.gif";
		    $(tgetLayer).style.display = "";
		}

	},


	// 연령
	checkedNotChkAge:function(obj)
	{
        if(obj.checked)
        {
            $("txt_birth_yyyy_strt").value = "";
            $("txt_birth_yyyy_end").value  = "";
            $("txt_birth_yyyy_strt").disabled = true;
            $("txt_birth_yyyy_end").disabled  = true;
            $("txt_birth_yyyy_strt").style.background = "#ECE9D8";
            $("txt_birth_yyyy_end").style.background  = "#ECE9D8";
        }
        else
        {
            $("txt_birth_yyyy_strt").disabled = false;
            $("txt_birth_yyyy_end").disabled  = false;
            $("txt_birth_yyyy_strt").style.background = "#ffffff";
            $("txt_birth_yyyy_end").style.background  = "#ffffff";
            $("txt_birth_yyyy_strt").focus();
        }
	},


	// 연령2
	checkedNotChkAge2:function(obj)
	{
        if(obj.checked)
        {
            $("txt_age_start").value = "";
            $("txt_age_end").value  = "";
            $("txt_age_start").disabled = true;
            $("txt_age_end").disabled  = true;
            $("txt_age_start").style.background = "#ECE9D8";
            $("txt_age_end").style.background  = "#ECE9D8";
        }
        else
        {
            $("txt_age_start").disabled = false;
            $("txt_age_end").disabled  = false;
            $("txt_age_start").style.background = "#ffffff";
            $("txt_age_end").style.background  = "#ffffff";
            $("txt_age_start").focus();
        }
	},

    //연봉
	checkedNotChkSale:function(obj){
	    var f = document.frm;

        if(obj.checked) {
            f.sel_self_sale_from_typ.disabled = "none";
            f.sel_self_sale_to_typ.disabled = "none";
            f.sel_self_sale_from_typ.style.background = "#ECE9D8";
            f.sel_self_sale_to_typ.style.background  = "#ECE9D8";
        }else {
            f.sel_self_sale_from_typ.disabled = "";
            f.sel_self_sale_to_typ.disabled = "";
            f.sel_self_sale_from_typ.style.background = "#ffffff";
            f.sel_self_sale_to_typ.style.background  = "#ffffff";
        }
	},

	onfocus_age:function(obj) {
	    obj.className = "input29_f tac";

	    if  ($("txt_birth_yyyy_strt").value=="Min")
	    {
	        $("txt_birth_yyyy_strt").value="";
        }
	    if  ($("txt_birth_yyyy_end").value=="Max")
	    {
	        $("txt_birth_yyyy_end").value="";
        }
	},

	onblur_age:function(obj) {
	    obj.className = "input29 tac";
	},

	checkedAll:function(obj,tgetName)
	{
        if(isEmpty(js_vg_login_id))
        {
            alert(Message.getMessage("MSG00271"));
            obj.checked = true;
        }

        var tgetArr = document.getElementsByName(tgetName);

        for(var i=0; i<tgetArr.length; i++) {
            tgetArr[i].checked = obj.checked;

            if(obj.checked == true)
                tgetArr[i].disabled = true;
            else
                tgetArr[i].disabled = false;
        }
	},
	
	// 모두 비선택
	checkedNot:function(obj,tgetName)
	{
        if(isEmpty(js_vg_login_id))
        {
            //alert(Message.getMessage("MSG00271"));
            //obj.checked = true;
        }

        var tgetArr = document.getElementsByName(tgetName);

        for(var i=0; i<tgetArr.length; i++) {
            tgetArr[i].checked = false;
            if(obj.checked == true)
                tgetArr[i].disabled = true;
            else
                tgetArr[i].disabled = false;
        }

	},
	
	//자녀없는 재혼 체크
	chk_rmrg_typ:function(obj)
	{
		rmrg_typ = document.getElementsByName("chk_cust_rcp_typ");
		if (obj.value == "02")
		{
			rmrg_typ[2].checked = false;
		}
		else
		{
			rmrg_typ[1].checked = false;
		}
	},

	//신장
	checkedNotHeit:function(obj)
	{
        if(obj.checked)
        {
            $("sel_heit_ft").value = "";
            $("sel_heit_ft").disabled = true;
            $("sel_heit_ft").style.background = "#ECE9D8";
			$("sel_heit_in").value = "";
            $("sel_heit_in").disabled = true;
            $("sel_heit_in").style.background = "#ECE9D8";
        }
        else
        {
            $("sel_heit_ft").disabled = false;
            $("sel_heit_ft").style.background = "#ffffff";
            $("sel_heit_ft").focus();
			$("sel_heit_in").disabled = false;
            $("sel_heit_in").style.background = "#ffffff";

        }
	},

	//거리지수 선택
	check_GAI:function(obj, chkPsblYN, rsdcNationNM)
	{
		if(js_vg_login_id != "") {
			if (chkPsblYN == "N")
			{
				alert("Distance (domestic) option is not yet available to members in" + rsdcNationNM);
					obj.checked = false;
			}else {
				var GAIArr = document.getElementsByName("chk_gai_idx");

				if (obj.checked == false)
				{
					var all_not_chk = "Y";
				}
				for (i = 0; i < GAIArr.length ; i ++)
				{
					if (all_not_chk == "Y") {
						GAIArr[i].checked = false;
						GAIArr[i].disabled = false;
					}else {
						if (i < obj.value)	{
							GAIArr[i].checked = true;
						
							//상위 체크 disabled
							if (i+1 < obj.value) {
								GAIArr[i].disabled = true;
							}
						}else { 
							GAIArr[i].checked = false;
						}
					}
				}
				
			}
		}
	},
	
	// 지역 처리
	checkedNotChkAddr:function(obj) {
		f = document.frm;
		if(obj.checked) {
			//for (i = 2; i < 6 ; i ++ ) // 대륙,국가,지역1,지역2
			for (i = 3; i < 6 ; i ++ ) // 국가,지역1,지역2
			{
				document.getElementById("rsdt_loc"+i).value = ""
				document.getElementById("rsdt_loc"+i).disabled = true;
				document.getElementById("rsdt_loc"+i).style.background = "#ECE9D8"
			}
		}else {
			//for (i = 2; i < 6 ; i ++ ) // 대륙,국가,지역1,지역2
			for (i = 3; i < 6 ; i ++ ) // 국가,지역1,지역2
			{
				document.getElementById("rsdt_loc"+i).value = ""
				document.getElementById("rsdt_loc"+i).disabled = false;
				document.getElementById("rsdt_loc"+i).style.background = "#ffffff"
			}
		}

	},


	//대륙선택
	chgContinent:function(obj) {
		var f = document.frm;
		var sql = "";
		var opt = null;
		
		//f.sel_rsdc_nation_cd.value = "";
		f.sel_rsdc_sido_cd1.value = "";
		f.sel_rsdc_sido_cd2.value = "";

		f.sel_rsdc_nation_cd.options.length = 0;
		opt = new Option("Country","");
		opt.title = "Country";
		f.sel_rsdc_nation_cd.options.add(opt);

		if(isEmpty(obj.value) == false) {
			var url = "/common/getCntrySidoList.asp";
			var params = "";

			params = "sql_type=" + escape("CONTINENT") + "&obj_val=" + escape(obj.value);
			url += "?" + params;

			var objHttp = MakeHttpObject();
			objHTTP.open("GET", url, true);
			objHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

			objHTTP.onreadystatechange = function() { 
				if(objHTTP.readyState == 4) {
					if(objHTTP.status == 200) {
						var cntryCdArr = objHTTP.responseXML.documentElement.getElementsByTagName("CNTRY_SIDO_CD");
						var cntryCdNmArr = objHTTP.responseXML.documentElement.getElementsByTagName("CNTRY_SIDO_NM");

						f.sel_rsdc_nation_cd.disabled = false;
						for(var i=0; i <cntryCdArr.length; i ++) {
							var opt = new Option();
							opt.value	= cntryCdArr[i].firstChild.nodeValue;
							opt.text	= cntryCdNmArr[i].firstChild.nodeValue;
							opt.title	= cntryCdNmArr[i].firstChild.nodeValue;
							f.sel_rsdc_nation_cd.options.add(opt);
							opt = null;
						}
					}
				}
			}
			objHTTP.send(null);
    	}else {
    		f.sel_rsdc_nation_cd.value = "";
    	}

	},

	//국가선택
    chgNation:function(obj) {
    	var f = document.frm;
    	var sql = "";
    	var opt1 = null;
		var opt2 = null;

    	f.sel_rsdc_sido_cd1.options.length = 0;
    	opt1 = new Option("State/Province","");
    	opt1.title = "State/Province";
    	f.sel_rsdc_sido_cd1.options.add(opt1);

		f.sel_rsdc_sido_cd2.options.length = 0;
    	opt2 = new Option("State/Province","");
    	opt2.title = "State/Province";
    	f.sel_rsdc_sido_cd2.options.add(opt2);

    	if(isEmpty(obj.value) == false) {
    		var url    = "/common/getCntrySidoList.asp";
    		var params = "";
			
			if(obj.value != "Z99000"){
    			params = "sql_type=" + escape("SIDO") + "&obj_val=" + escape(obj.value) + "&cond_str=" + escape("CNTRY_SIDO_CD <> 'Z99001'");
			}
			else{			
    			params = "sql_type=" + escape("SIDO") + "&&obj_val=" + escape(obj.value) + "&cond_str=" + escape("CNTRY_SIDO_CD = 'Z99001'");
			}
    		url += "?" + params;

    		var objHTTP = MakeHttpObject();
    		objHTTP.open("GET", url, true);
    		objHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

    		objHTTP.onreadystatechange = function() {
    			if(objHTTP.readyState == 4) {
    				if(objHTTP.status == 200) {
    					var cntrySidoCdArr = objHTTP.responseXML.documentElement.getElementsByTagName("CNTRY_SIDO_CD");
    					var cntrySidoNmArr = objHTTP.responseXML.documentElement.getElementsByTagName("CNTRY_SIDO_NM");
						
						f.sel_rsdc_sido_cd1.disabled = false;
						f.sel_rsdc_sido_cd2.disabled = false;
    					for(var i=0; i<cntrySidoCdArr.length; i++) {
    						var opt1 = new Option();
    						opt1.value = cntrySidoCdArr[i].firstChild.nodeValue;
    						opt1.text  = cntrySidoNmArr[i].firstChild.nodeValue;
    						opt1.title = cntrySidoNmArr[i].firstChild.nodeValue;
    						f.sel_rsdc_sido_cd1.options.add(opt1);
    						opt1 = null;

							var opt2 = new Option();
    						opt2.value = cntrySidoCdArr[i].firstChild.nodeValue;
    						opt2.text  = cntrySidoNmArr[i].firstChild.nodeValue;
    						opt2.title = cntrySidoNmArr[i].firstChild.nodeValue;
    						f.sel_rsdc_sido_cd2.options.add(opt2);
    						opt2 = null;
    					}

    					//chgSido(f.sel_rsdc_sido_cd1);

    				}
    			}
    		}

    		objHTTP.send(null);
    	}else {
    		f.sel_rsdc_sido_cd1.value = "";
			f.sel_rsdc_sido_cd2.value = "";
    	}
    },

    // 거주지 처리(선택)
	checkedChkAddr:function(obj) {
        var nationArr = document.getElementsByName("chk_rsdt_nation");

        for(var i=0; i<nationArr.length; i++) {
            if(obj.value != nationArr[i].value) {
                if(obj.value.charAt(1) == nationArr[i].value.charAt(1)) {
                    if(obj.checked) {
                        nationArr[i].checked  = false;
                        nationArr[i].disabled = true;
                    }else {
                        nationArr[i].disabled = false;
                    }
                }
            }
        }
	},

	// 종교 처리 checkbox용
//	checkedNotChkRlgn:function(obj) {
//        var rlgnTypArr = document.getElementsByName("chk_rlgn_typ");
//
//        for(var i=0; i<rlgnTypArr.length; i++) {
//            if(obj.checked) {
//                rlgnTypArr[i].checked  = false;
//                rlgnTypArr[i].disabled = true;
//            }else {
//                rlgnTypArr[i].disabled = false;
//            }
//        }
//	},
	
	// 종교 처리 selectbox용
	checkedNotChkRlgn:function(obj) {
		var f = document.frm;
		
		if(obj.checked) {
			for (i = 1; i < 4 ; i ++ )
			{
				document.getElementById("sel_rlgn_typ"+i).value = ""
				document.getElementById("sel_rlgn_typ"+i).disabled = true;
				document.getElementById("sel_rlgn_typ"+i).style.background = "#ECE9D8"
			}
		}else {
			for (i = 1; i < 4 ; i ++ )
			{
				document.getElementById("sel_rlgn_typ"+i).value = ""
				document.getElementById("sel_rlgn_typ"+i).disabled = false;
				document.getElementById("sel_rlgn_typ"+i).style.background = "#ffffff"
			}
		}
	},

	// 취미 처리 checkbox용
//	checkedNotChkHoby:function(obj) {
//        var hobyTypArr = document.getElementsByName("chk_hoby_typ");
//
//        for(var i=0; i<hobyTypArr.length; i++) {
//            if(obj.checked) {
//                hobyTypArr[i].checked  = false;
//                hobyTypArr[i].disabled = true;
//            }else {
//                hobyTypArr[i].disabled = false;
//            }
//        }
//	},
	
	// 취미 처리 selectbox용
	checkedNotChkHoby:function(obj) {
        var f = document.frm;
        
        if(obj.checked) {
			for (i = 1; i < 4 ; i ++ )
			{
				document.getElementById("sel_hoby_typ"+i).value = ""
				document.getElementById("sel_hoby_typ"+i).disabled = true;
				document.getElementById("sel_hoby_typ"+i).style.background = "#ECE9D8"
			}
		}else {
			for (i = 1; i < 4 ; i ++ )
			{
				document.getElementById("sel_hoby_typ"+i).value = ""
				document.getElementById("sel_hoby_typ"+i).disabled = false;
				document.getElementById("sel_hoby_typ"+i).style.background = "#ffffff"
			}
		}
	},

	// 신장
	checkedNotChkHeight:function(obj) {
        if(obj.checked) {
            $("txt_heit1").value = "";
            $("txt_heit2").value  = "";
            $("txt_heit1").disabled = true;
            $("txt_heit2").disabled  = true;
            $("txt_heit1").style.background = "#ECE9D8";
            $("txt_heit2").style.background  = "#ECE9D8";
        }else {
            $("txt_heit1").disabled = false;
            $("txt_heit2").disabled  = false;
            $("txt_heit1").style.background = "#ffffff";
            $("txt_heit2").style.background  = "#ffffff";
            $("txt_heit1").focus();
        }
	},

	hideLayer:function() {
        $("jisu_01").style.display = "none";
        $("jisu_02").style.display = "none";
        $("jisu_03").style.display = "none";
        $("jisu_04").style.display = "none";
	},

	showLayer:function(flg) {
		if (flg == 1) {
			$("jisu_01").style.display = "";
			$("jisu_02").style.display = "none";
			$("jisu_03").style.display = "none";
			$("jisu_04").style.display = "none";
		} else if (flg == 2) {
			$("jisu_01").style.display = "none";
			$("jisu_02").style.display = "";
			$("jisu_03").style.display = "none";
			$("jisu_04").style.display = "none";
		} else if (flg == 3) {
			$("jisu_01").style.display = "none";
			$("jisu_02").style.display = "none";
			$("jisu_03").style.display = "";
			$("jisu_04").style.display = "none";
		} else if (flg == 4) {
			$("jisu_01").style.display = "none";
			$("jisu_02").style.display = "none";
			$("jisu_03").style.display = "none";
			$("jisu_04").style.display = "";
		}
	},

    // 검색
	profileSearchResult:function() {
        var f = document.frm;

        $("if_result").style.height = "100px";

        f.method = "get";
        f.target = "if_result";
        f.action = "/singles/profile-search-result.asp";
        f.submit();
	},

    // 검색2
	profileSearchResult2:function() {
        var f = document.frm;

        $("if_result").style.height = "100px";
        if (if_result.location.href.indexOf("profile_loading.asp") < 0)
           if_result.loading();

		var rankMenu = document.getElementById("rank_menu");
		var class_off = rankMenu.getElementsByTagName("li");
		for (i=0; i < class_off.length; i++ ) {
			class_off[i].className = "a01";
		}

        f.method = "get";
        f.target = "if_result";
        f.action = "/singles/profile-search-result.asp";
        f.submit();
	},

    // 라이프스타일 검색
	lifestyleSearchResult:function()
	{
        var f = document.frm;

        $("if_result").style.height = "100px";

        f.method = "get";
        f.target = "if_result";
        f.action = "profile_newlifeStyleSearchResult.asp";
        f.submit();
	},

    // 라이프스타일 검색
	lifestyleSearchResult4:function()
	{
        var f = document.frm;

        $("if_result").style.height = "100px";
        if (if_result.location.href.indexOf("profile_loading.asp") < 0)
           if_result.loading();

        f.method = "get";
        f.target = "if_result";
        f.action = "lifestyle-result.asp";
        f.submit();
	},

    resultReload:function(resultTyp,photoExistYn,mbrTyp)
    {

        var f = document.frm;

        f.hid_result_typ.value     = resultTyp;
        f.hid_photo_exist_yn.value = photoExistYn;
        f.hid_mbr_typ.value        = mbrTyp;

        switch(f.txt_mode.value)
        {
            case "CHAR"          : profile.charSearchResult();
                                   break;

            case "PROFILE"       : profile.profileSearchResult2();
                                   break;

            case "TASTE"         : profile.tasteSearchResult();
                                   break;

            case "LIFE_STYLE"    : profile.lifeStyleSearchResult3();
                                   break;
            case "LIFE_STYLE3"    : profile.lifeStyleSearchResult4();
                                   break;

            case "MOST_PROPOSED" : profile.mostPrpsSearchResult2();
                                   break;

            case "MOST_CUPIDING" : profile.mostCupidSearchResult2();
                                   break;

            case "MOST_SAVED"    : profile.mostSavedSearchResult2();
                                   break;

            case "NEW_PHOTO"     : profile.newPhotoSearchResult();
                                   break;

            case "NEW_GREETING"  : profile.newGreetingSearchResult();
                                   break;

            case "NEW_MEMBER"    : profile.newMemberSearchResult();
                                   break;

            case "NEW_UPDATE"    : profile.newUpdateSearchResult();
                                   break;
        }
    },

	selfReload:function(typ) {
        var f = document.frm;
        var photoExistYn = "";

        if(f.chk_photo_exist_yn.checked)
        {
            photoExistYn = "Y";
        }else {
            photoExistYn = "N";
        }
        parent.profile.resultReload(typ, photoExistYn, f.sel_mbr_typ.value);
	},

    resizeIframe:function(dpTyp,cnt)
    {
        if(document.all) {
            var objBody  = if_result.document.body;
            var objFrame = document.all["if_result"];

            ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
            objFrame.style.height = ifrmHeight;
        }else {
            if(dpTyp == "LIST")
            {

                if(isEmpty(js_vg_login_id)) {
                    $("if_result").style.height = 170 + (cnt*100) + FFextraHeight + "px";
                }else {
                    $("if_result").style.height = 220 + (cnt*100) + FFextraHeight + "px";
                }
            }else {
                if(isEmpty(js_vg_login_id)) {
                    $("if_result").style.height = 100 + (Math.round(cnt/2)*305) + FFextraHeight + "px";
                }else {
                    $("if_result").style.height = 160 + (Math.round(cnt/2)*305) + FFextraHeight + "px";
                }
            }
        }

        p_couple.fixup();
    },

    resizeIframe2:function(dpTyp,cnt)
    {
		var objFrm=document.getElementById("if_result");
		var frameHeight=objFrm.contentWindow.document.documentElement.scrollHeight;
		//alert(frameHeight);
		if(frameHeight!=0)  {
			objFrm.style.height=frameHeight + "px";
		}

		// 페이징(페이지) 내 이동시
		window.scrollTo(0,0);

		/*
        if(document.all)
        {
            var objBody  = if_result.document.body;
            var objFrame = document.all["if_result"];

            ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
            objFrame.style.height = ifrmHeight;

        }
        else
        {
            if(dpTyp == "LIST")
            {

                if(isEmpty(js_vg_login_id))
                {
                    $("if_result").style.height = 170 + (cnt*100) + FFextraHeight + "px";
                }
                else
                {
                    $("if_result").style.height = 220 + (cnt*100) + FFextraHeight + "px";
                }
            }
            else
            {
                if(isEmpty(js_vg_login_id))
                {
                    $("if_result").style.height = 100 + (Math.round(cnt/2)*305) + FFextraHeight + "px";
                }
                else
                {
                    $("if_result").style.height = 160 + (Math.round(cnt/2)*305) + FFextraHeight + "px";
                }
            }
        }
        //left보정

                //$("box_left").style.height=$("box_right").offsetHeight+120;
		*/


    },

    checkedPhoto:function()
    {
        if($("chk_photo_exist_yn").checked)
        {
            $("chk_photo_exist_yn").checked = false;
        }
        else
        {
            $("chk_photo_exist_yn").checked = true;
        }
    },

    chgTyp:function(obj,targetObj) {
        if(obj.value == "") {
            $(targetObj).options.length = 0;
            $(targetObj).options.add(new Option("::: 선택[Select] :::",""));
        }else {
            var tmpArr = obj.value.split("::");
            var secTyp = "";
            if(tmpArr[0] == "TASTE_TYP") {
                secTyp = "TASTE_DTL_TYP";
            }else if(tmpArr[0] == "LIFE_STYLE_TYP") {
                secTyp = "LIFE_STYLE_DTL_TYP";
            }

            var url    = "getSubjectList.asp";
            var params = "com_cd_val=" + escape(tmpArr[1]) + "&com_cd_en_nm=" + escape(secTyp);
            url += "?" + params;

    		var objHTTP = MakeHttpObject();
    		objHTTP.open("GET", url, true);
    		objHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

            objHTTP.onreadystatechange = function() {
                if(objHTTP.readyState == 4) {
                    if(objHTTP.status == 200) {
                        var comCdArr   = objHTTP.responseXML.documentElement.getElementsByTagName("COM_CD_VAL");
                        var comNmKrArr = objHTTP.responseXML.documentElement.getElementsByTagName("COM_CD_VAL_DESC_KR");
                        var comNmEnArr = objHTTP.responseXML.documentElement.getElementsByTagName("COM_CD_VAL_DESC_EN");

                        if(comCdArr.length > 0) {
                            $(targetObj).options.length = 0;
                            $(targetObj).options.add(new Option("::: 선택[Select] :::",""));

                            for(var i=0; i<comCdArr.length; i++) {
                                var opt = new Option(comNmKrArr[i].firstChild.nodeValue+"["+comNmEnArr[i].firstChild.nodeValue+"]",secTyp+"::"+comCdArr[i].firstChild.nodeValue);
                                opt.title = comNmKrArr[i].firstChild.nodeValue+"["+comNmEnArr[i].firstChild.nodeValue+"]";
                                $(targetObj).options.add(opt);
                            }
                        }
                    }
                }
            }

    		objHTTP.send(null);
        }
    },

    tasteSearchResult:function() {
        var f = document.frm;

        if(isEmpty(f.sel_taste_typ.value)) {
            alert(Message.getMessage("MSG00178"));
            f.sel_taste_typ.focus();
            return;
        }
        if(isEmpty(f.sel_taste_dtl_typ.value)) {
            alert(Message.getMessage("MSG00178"));
            f.sel_taste_dtl_typ.focus();
            return;
        }

        $("if_result").style.height = "100px";

        f.method = "get";
        f.target = "if_result";
        f.action = "profile_tasteSearchResult.asp";
        f.submit();
    },

    lifeStyleSearchResult2:function()
    {
        var f = document.frm;

        $("if_result").style.height = "100px";

        f.method = "get";
        f.target = "if_result";
        f.action = "profile_newlifeStyleSearchResult.asp";
        f.submit();
    },

    lifeStyleSearchResult4:function()
    {
        var f = document.frm;

        $("if_result").style.height = "100px";

        f.method = "get";
        f.target = "if_result";
        f.action = "lifestyle-result.asp";
        f.submit();
    },


    lifeStyleSearchResult3:function()
    {

        var f = document.frm;

        if(isEmpty(f.sel_life_style_typ.value))
        {
            alert(Message.getMessage("MSG00178"));
            f.sel_life_style_typ.focus();
            return;
        }
        if(isEmpty(f.sel_life_style_dtl_typ.value))
        {
            alert(Message.getMessage("MSG00178"));
            f.sel_life_style_dtl_typ.focus();
            return;
        }

        $("if_result").style.height = "100px";

        f.method = "get";
        f.target = "if_result";
        f.action = "profile_lifeStyleSearchResult.asp";
        f.submit();
    },

    chgMostTab:function(mode,obj) {
        var f = document.frm;

        $("now_tab").style.backgroundPosition="left top";
        $("now_tab").id = "";
        obj.id = "now_tab";

        p_couple.mover($("now_tab"),p_couple.c_obj5);
        p_couple.c_obj5=$("now_tab");

        f.txt_srch_mode.value = mode;

       /* if(f.txt_srch_mode.value == "MOST_PROPOSED_F" || f.txt_srch_mode.value == "MOST_CUPIDING_F" || f.txt_srch_mode.value == "MOST_SAVED_F") {
            $("spn_gender_kr").innerHTML  = "여";
            $("spn_gender_en").innerHTML  = "female";
        }else {
            $("spn_gender_kr").innerHTML  = "남";
            $("spn_gender_en").innerHTML  = "male";
        }*/

        if(f.txt_srch_mode.value.indexOf("MOST_PROPOSED") >= 0) {
            profile.mostPrpsSearchResult();
        }else if(f.txt_srch_mode.value.indexOf("MOST_CUPIDING") >= 0) {
            profile.mostCupidSearchResult();
        }else if(f.txt_srch_mode.value.indexOf("MOST_SAVED") >= 0) {
            profile.mostSavedSearchResult();
        }
    },

    chgMostTab2:function(mode,gubun)
    {
        var f = document.frm;

        f.txt_srch_mode.value = mode;


        //이미지 변경

        if  (gubun=="A")
        {
            $("f_no_select").style.display="";
            $("f_select").style.display="none";
        }
        else if (gubun=="B")
        {
            $("f_no_select").style.display="none";
            $("f_select").style.display="";
        }

        else if  (gubun=="C")
        {
            $("m_no_select").style.display="none";
            $("m_select").style.display="";
        }
        else if (gubun=="D")
        {
            $("m_no_select").style.display="";
            $("m_select").style.display="none";
        }

        if(f.txt_srch_mode.value.indexOf("MOST_PROPOSED") >= 0) {
            profile.mostPrpsSearchResult2();
        }else if(f.txt_srch_mode.value.indexOf("MOST_CUPIDING") >= 0) {
            profile.mostCupidSearchResult2();
        }else if(f.txt_srch_mode.value.indexOf("MOST_SAVED") >= 0) {
            profile.mostSavedSearchResult2();
        }
    },

    mostPrpsSearchResult:function() {
        var f = document.frm;

        $("if_result").style.height = "100px";

        f.method = "post";
        f.target = "if_result";
        f.action = "profile_mostProposedResult.asp";
        f.submit();
    },

    mostPrpsSearchResult2:function() {
        var f = document.frm;

        $("if_result").style.height = "100px";
        if (if_result.location.href.indexOf("profile_loading.asp") < 0)
           if_result.loading();

        f.method = "post";
        f.target = "if_result";
        f.action = "most-propose-result.asp";
        f.submit();

    },


    mostCupidSearchResult:function() {
        var f = document.frm;

        $("if_result").style.height = "100px";

        f.method = "post";
        f.target = "if_result"
        f.action = "profile_mostCupidingResult.asp";
        f.submit();
    },

    mostCupidSearchResult2:function() {
        var f = document.frm;

        $("if_result").style.height = "100px";
        if (if_result.location.href.indexOf("profile_loading.asp") < 0)
           if_result.loading();

        f.method = "post";
        f.target = "if_result"
        f.action = "most-cupiding-result.asp";
        f.submit();
    },

    mostSavedSearchResult:function() {
        var f = document.frm;

        $("if_result").style.height = "100px";

        f.method = "post";
        f.target = "if_result"
        f.action = "profile_mostSavedResult.asp";
        f.submit();
    },


    mostSavedSearchResult2:function() {
        var f = document.frm;

        $("if_result").style.height = "100px";
        if (if_result.location.href.indexOf("profile_loading.asp") < 0)
           if_result.loading();

        f.method = "post";
        f.target = "if_result"
        f.action = "most-save-profile-result.asp";
        f.submit();
    },

    newPhotoSearchResult:function() {
        var f = document.frm;

        $("if_result").style.height = "100px";

        f.method = "post";
        f.target = "if_result"
        f.action = "profile_newPhotoResult.asp";
        f.submit();
    },

    newGreetingSearchResult:function() {
        var f = document.frm;

        $("if_result").style.height = "100px";

        f.method = "post";
        f.target = "if_result"
        f.action = "profile_newGreetingResult.asp";
        f.submit();
    },

    newMemberSearchResult:function() {
        var f = document.frm;

        $("if_result").style.height = "100px";

        f.method = "post";
        f.target = "if_result"
        f.action = "profile_newMemberResult.asp";
        f.submit();
    },

    newUpdateSearchResult:function() {
        var f = document.frm;

        $("if_result").style.height = "100px";

        f.method = "post";
        f.target = "if_result"
        f.action = "featured-singles-profiles-latestphotos-result.asp";
        f.submit();
    },

    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("/common/popCenterMain.asp?orgCd="+orgCd,"",sFeatures);
    },

    openCenterMain2: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);
    },


    goSpcPrpsList:function(curPage) {
        location.href = "/singles/profile_featuredProfilesList.asp?txt_curPage=" + curPage;
    },

    goSpcPrpsList2:function(curPage) {
        location.href = "/singles/featured-profiles.asp?txt_curPage=" + curPage;
    },

    popSpcPrps:function(recvEmailAddr,mainSeq,rplySeq) {
        var top  = screen.height/2 - 520/2;
        var left = screen.width/2 - 500/2;
        var sFeatures = "top=" + top + ",left=" + left + ",width=500,height=520,scrollbars=no,menubar=no,status=no,resizable=no";

		window.open("/common/popSpcPrps.asp?recv_email_addr="+recvEmailAddr+"&amp;main_seq="+mainSeq+"&amp;rply_seq="+rplySeq,"popSpcPrps",sFeatures);
    },

    // 프러포즈제한안내(스페셜프러포즈)
    showProposeLimit:function(gbn,basicPhoto,profileWrite,svcPoss) {
        profile.showProfileBox("/common/popCheckedPrpsPsbl.asp?txt_gbn="+gbn+"&txt_basic_photo_poss_yn="+basicPhoto+"&txt_csltg_rpt_writ_typ="+profileWrite+"&txt_svc_poss_yn="+svcPoss,450,158);
    },

    showFeaturedBox:function() {
		var arrayPageSize = getPageSize();

		if(IE) {
			$("featured_blind").style.filter="alpha(opacity=60)";
		}else {
			$("featured_blind").style.opacity="0.6";
		}

		$("featured_blind").style.width=arrayPageSize[0]+"px";
		$("featured_blind").style.height=arrayPageSize[1]+"px";

		$("featured_blind").style.display="block";

        var f = document.frm;

		var l_width  = 600;
		var l_height = 619;

		var page_scroll = getPageScroll();

		var maxsize_w = getWindowWidth();
		var maxsize_h = getWindowHeight();
		if(maxsize_w < 500) maxsize_w = 500;
		if(maxsize_h < 500) maxsize_h = 500;

		var l_margin_w = (maxsize_w - l_width) / 2;
		var l_margin_h = (maxsize_h - l_height) / 2;

		$("featured_box").style.width  = l_width+"px";
		$("featured_box").style.height = l_height+"px";

		$("featured_box").style.left = (page_scroll[0]+l_margin_w)+"px";
		$("featured_box").style.top  = (page_scroll[1]+l_margin_h)+"px";

		$("featured_box").style.display = "block";

		f.method = "post";
		f.target = "ifr_featured_box";
		f.action = "/common/showSpecialPropose.asp";
		f.submit();
    },

    showFeaturedProfileApply:function() {
		var arrayPageSize = getPageSize();

		if(IE) {
			$("featured_blind").style.filter="alpha(opacity=60)";
		}else {
			$("featured_blind").style.opacity="0.6";
		}

		$("featured_blind").style.width=arrayPageSize[0]+"px";
		$("featured_blind").style.height=arrayPageSize[1]+"px";

		$("featured_blind").style.display="block";

        var f = document.frm;

		var l_width  = 600;
		var l_height = 575;

		var page_scroll = getPageScroll();

		var maxsize_w = getWindowWidth();
		var maxsize_h = getWindowHeight();
		if(maxsize_w < 500) maxsize_w = 500;
		if(maxsize_h < 500) maxsize_h = 500;

		var l_margin_w = (maxsize_w - l_width) / 2;
		var l_margin_h = (maxsize_h - l_height) / 2;

		$("featured_box").style.width  = l_width+"px";
		$("featured_box").style.height = l_height+"px";

		$("featured_box").style.left = (page_scroll[0]+l_margin_w)+"px";
		$("featured_box").style.top  = (page_scroll[1]+l_margin_h)+"px";

		$("featured_box").style.display = "block";

    },

    showFeaturedBox1:function() {
		var arrayPageSize = getPageSize();

		if(IE) {
			$("featured_blind").style.filter="alpha(opacity=60)";
		}else {
			$("featured_blind").style.opacity="0.6";
		}

		$("featured_blind").style.width=arrayPageSize[0]+"px";
		$("featured_blind").style.height=arrayPageSize[1]+"px";

		$("featured_blind").style.display="block";

        var f = document.frm;

		var l_width  = 600;
		var l_height = 619;

		var page_scroll = getPageScroll();

		var maxsize_w = getWindowWidth();
		var maxsize_h = getWindowHeight();
		if(maxsize_w < 500) maxsize_w = 500;
		if(maxsize_h < 500) maxsize_h = 500;

		var l_margin_w = (maxsize_w - l_width) / 2;
		var l_margin_h = (maxsize_h - l_height) / 2;

		$("featured_box").style.width  = l_width+"px";
		$("featured_box").style.height = l_height+"px";

		$("featured_box").style.left = (page_scroll[0]+l_margin_w)+"px";
		$("featured_box").style.top  = (page_scroll[1]+l_margin_h)+"px";

		$("featured_box").style.display = "block";

		f.method = "post";
		f.target = "ifr_featured_box";
		f.action = "/common/showSpecialPropose.asp";
		f.submit();
    },


    showFeaturedBox3:function()
    {
		var arrayPageSize = getPageSize();

		if(IE)
		{
			$("featured_blind").style.filter="alpha(opacity=60)";
		}
		else
		{
			$("featured_blind").style.opacity="0.6";
		}


		$("featured_blind").style.width=arrayPageSize[0]+"px";
		$("featured_blind").style.height=arrayPageSize[1]+"px";

		$("featured_blind").style.display="block";

        var f = document.frm;

		var l_width  = 600;
		var l_height = 481;

		var page_scroll = getPageScroll();


		var maxsize_w = getWindowWidth();
		var maxsize_h = getWindowHeight();


		if(maxsize_w < 500) maxsize_w = 500;
		if(maxsize_h < 500) maxsize_h = 500;

		var l_margin_w = (maxsize_w - l_width) / 2;
		var l_margin_h = (maxsize_h - l_height) / 2;


		$("featured_box").style.width  = l_width+"px";
		$("featured_box").style.height = l_height+"px";

		$("featured_box").style.left = (page_scroll[0]+l_margin_w)+"px";
		$("featured_box").style.top  = (page_scroll[1]+l_margin_h)+"px";
		$("featured_box").style.display = "block";


		f.method = "post";
		f.target = "ifr_featured_box";
		f.action = "/common/showSpecialPropose.asp";
		f.submit();
    },

    hideFeaturedBox:function() {
        var f = document.frm;

        $("featured_box").style.display   = "none";
        $("featured_blind").style.display = "none";

		f.method = "post";
		f.target = "ifr_featured_box";
		f.action = "/Blank.asp";
		f.submit();
    },

	resizeFeaturedBox:function(heightStr,topStr) {
		$("featured_box").style.height = heightStr + "px";
		$("featured_box").style.top  = topStr + "px";
	},
	resizetoFeaturedBox:function(widthStr,HeightStr) {
		$("featured_box").style.width  = widthStr+"px";
		$("featured_box").style.height = HeightStr+"px";
	},
	
	resizeMainBox:function(heightStr,topStr) {
		$("main_box").style.height = heightStr + "px";
		$("main_box").style.top  = topStr + "px";
	},
	resizetoMainBox:function(widthStr,HeightStr) {
		$("main_box").style.width  = widthStr+"px";
		$("main_box").style.height = HeightStr+"px";
	},

    showFeaturedResultBox:function(encodePartnrId,prpsGbn,mnnrYn,expirDttm) {
        var f = document.frm;

		var l_width  = 450;
		var l_height = 160;

		var page_scroll = getPageScroll();

		var maxsize_w = getWindowWidth();
		var maxsize_h = getWindowHeight();
		if(maxsize_w < 500) maxsize_w = 500;
		if(maxsize_h < 500) maxsize_h = 500;

		var l_margin_w = (maxsize_w - l_width) / 2;
		var l_margin_h = (maxsize_h - l_height) / 2;

		$("featured_box").style.width  = l_width+"px";
		$("featured_box").style.height = l_height+"px";

		$("featured_box").style.left = (page_scroll[0]+l_margin_w)+"px";
		$("featured_box").style.top  = (page_scroll[1]+l_margin_h)+"px";

		$("featured_box").style.display = "block";

		f.method = "post";
		f.target = "ifr_featured_box";
		f.action = "/common/showSpecialPropose_Result.asp?mbr_id="+encodePartnrId+"&prps_gbn="+prpsGbn+"&mnnr_yn="+mnnrYn+"&expir_dttm="+escape(expirDttm);
		f.submit();
    },

    sendSpecialPropose:function(procUrl) {
        var f = document.frm;

        f.txt_memo.value = f.txt_memo.value.replace("[Type your message here.]","");
        f.txt_memo.value = f.txt_memo.value.replace("Messages are not allowed to contain any of your contact information or your","");
        f.txt_memo.value = f.txt_memo.value.replace("account will be terminated automatically without warning.","");
        f.txt_memo.value = f.txt_memo.value.replace("No refund will be given for any unused credits in such a case.","");

        //메모값 체크
        if (isEmpty(f.txt_memo.value)) {
            alert(Message.getMessage("MSG00304"));
            f.txt_memo.focus();
            return;
        }else if(getByteLength(f.txt_memo.value) > 1000) {
    		alert(Message.getMessage("MSG00306") + "(" + getByteLength(f.txt_memo.value) + ")" );
    		return false;
    	}

        //금치어 체크
        if(isValidMessage(f.txt_memo.value) == false) {
            f.txt_memo.select();
            f.txt_memo.focus();
            return;
        }

		//숫자 및 연락처 공개 금지
		for(var i=0; i<=9; i++) {
			if(f.txt_memo.value.indexOf(i.valueOf()) > -1) {
				alert(Message.getMessage("MSG00391"));
				return;
			}
		}

		//전화번호 체크
		str = f.txt_memo.value;
		regu = /[\~!@#$%\^&*()\_\-+=\\|{}:;'"<>,/? ]/gi;
		if(regu.test(str)){
			str=str.replace(regu,"");
		}

        // 프러포즈 책임 동의
        if(!f.chk_prps_use_warn_yn.checked) {
            alert(Message.getMessage("MSG00668"));
            return;
        }

    	// 프러포즈 중복 발송 방지 처리
        $("send_s").style.display = "none";

        f.method = "post";
        f.target = "if_proc";
        f.action = procUrl;
        f.submit();
    },

    sendSpecialProposeRslt:function(flag,msg,encodePartnrId,prpsGbn,mnnrYn,expirDttm) {
        var f = document.frm;

        if(flag == "True") {
            parent.profile.showFeaturedResultBox(encodePartnrId,prpsGbn,mnnrYn,expirDttm);
        }else {
            message(msg);
            parent.profile.hideFeaturedBox();
        }
    },

    popConsultant:function(empCustNo) {
        var top  = screen.height/2 - 700/2;
        var left = screen.width/2 - 500/2;
        var sFeatures = "top=" + top + ",left=" + left + ",width=500,height=700,scrollbars=yes,menubar=no,status=no,resizable=no";

		window.open("/common/popCommunityConsultant.asp?txt_emp_cust_no="+empCustNo ,"popConsultant" ,sFeatures);
    },

    //고민상담하기
    popDateCoach:function(emailAddr) {
        var top  = screen.height/2 - 460/2;
        var left = screen.width/2 - 500/2;
        var sFeatures = "top=" + top + ",left=" + left + ",width=500,height=460,scrollbars=no,menubar=no,status=no,resizable=no";

		window.open("/common/popDateCoach.asp?recv_email_addr="+emailAddr,"popDateCoach",sFeatures);
    },

    scheck_people:function(sex) {
		if(sex == "m") {
            $("dv_view_f_1").style.display = "none";
            $("dv_view_f_2").style.display = "none";

            $("dv_view_m_1").style.display = "";
            $("dv_view_m_2").style.display = "";
            $("dv_view_m_3").style.display = "";

            $("dv_con_1").className = "ht575 bg_img9";
            $("dv_con_2").className = "ht575 pl12 pr12 bg_img10";
		}else {
            $("dv_view_m_1").style.display = "none";
            $("dv_view_m_2").style.display = "none";
            $("dv_view_m_3").style.display = "none";

            $("dv_view_f_1").style.display = "";
            $("dv_view_f_2").style.display = "";

            $("dv_con_1").className = "ht535 bg_img9";
            $("dv_con_2").className = "ht535 pl12 pr12 bg_img10";
		}
    },

    charSearchResult:function() {
        var f = document.frm;

        $("if_result").style.height = "100px";

        f.method = "get";
        f.target = "if_result";
        f.action = "profile_advancedCharacter_SearchResult.asp";
        f.submit();
    },

    showProfileBox:function(srcStr,widthStr,heightStr) {
        var f = document.frm;

		var l_width  = widthStr;
		var l_height = heightStr;

		var page_scroll = getPageScroll();

		var maxsize_w = getWindowWidth();
		var maxsize_h = getWindowHeight();
		if(maxsize_w < 500) maxsize_w = 500;
		if(maxsize_h < 500) maxsize_h = 500;

		var l_margin_w = (maxsize_w - l_width) / 2;
		var l_margin_h = (maxsize_h - l_height) / 2;

		$("featured_box").style.width  = l_width+"px";
		$("featured_box").style.height = l_height+"px";

		$("featured_box").style.left = (page_scroll[0]+l_margin_w)+"px";
		$("featured_box").style.top  = (page_scroll[1]+l_margin_h)+"px";

		$("featured_box").style.display = "block";

		f.method = "post";
		f.target = "ifr_featured_box";
		f.action = srcStr;
		f.submit();
    },

    hideProfile:function() {
        $("featured_box").style.display   = "none";
        $("featured_blind").style.display = "none";
        if(IE6) showSelect();
    },

	hideProfileApply:function() {
        location.href='/singles/featured-profiles.asp';
    },

    quickPropose:function(encodeCustNo,prpsGbn) {
        openPopMatchingPage('PARTNR',encodeCustNo,'/matching/profile-main.asp?quickPrpsGbn='+prpsGbn);
    },

    checkedPhotoView:function(obj){
        var f = document.frm;

        if(obj.checked){
            f.hid_photo_exist_yn.value = "Y";
        }
        else {
            f.hid_photo_exist_yn.value = "N";
        }
        f.submit();
    },

		// 스페셜프러포즈 신청하기(메인모델)
	goApply:function(){
		var f = document.frm;

		var procFlag = false;

		if(isEmpty(js_vg_login_id)){

			alert(Message.getMessage("MSG00180"));
			return;
		}

		//if (gbn=="mtm"){
		if(isEmpty($("sel_dcl_typ").value))
		{
			alert(Message.getMessage("MSG00483"));
			$("sel_dcl_typ").focus();
		    return;
		}
		//}
		if(isEmpty($("txt_ttl").value))
		{
			alert(Message.getMessage("MSG00020"));
   			$("txt_ttl").focus();
            return;

		}
		if(isEmpty($("txt_content").value))
		{
			alert(Message.getMessage("MSG00021"));
   			$("txt_content").focus();
            return;
		}

		if(isEmpty($("txt_email").value))
		{
			alert(Message.getMessage("MSG00179"));
   			$("txt_email").focus();
            return;
		}

		if(isValidEmail($("txt_email").value) == false)
		{
			alert(Message.getMessage("MSG00019"));
			$("txt_email").focus();
			return;
		}


		if (!confirm(Message.getMessage("MSG00462")))
		{
        	return;
		}

		procFlag = true;

		f.method = "post";
        f.target = "if_report";
        f.action = "featured-profiles-applyProc.asp";
        f.submit();

	},

	//스페셜프러포즈 등록처리 결과
	reportRslt:function(flag,msg)
	{
		procFlag = false;
        message(msg);

		if(flag == "True")
		{
			location.href = "/singles/featured-profiles.asp";
		}

	},

	scrolltop:function(){
	window.scrollTo(0,0);
	}

}
