﻿    var rollingStartFlag = false;

    var rolling = {
    	rolling_speed:5,
    	count:[],
    	flag:[],

    	init:function(v_id,v_height,v_interval,v_over) {
    		var v_total  = 0;
    		var v_timeid = rolling.count.length;

            rollingStartFlag = true;

    		rolling.count[v_timeid] = 0;
    		rolling.flag[v_timeid]  = 0;

    		for(var i=0;i<$(v_id).childNodes.length;i++) {
    			if($(v_id).childNodes[i].nodeName == "LI") {
    				v_total++;
    			}
    		}

    		$(v_id).innerHTML = $(v_id).innerHTML + $(v_id).innerHTML;

    		if(v_over) {
    			if(IE) {
    				if($(v_id)!=null) {
    					$(v_id).onmouseover = function() { rolling.rover(v_timeid);};
    					$(v_id).onmouseout  = function() { rolling.rout(v_timeid);};
    				}
    			}else {
    				if($(v_id)!=null) {
    					$(v_id).setAttribute("onmouseover","rolling.rover("+v_timeid+");");
    					$(v_id).setAttribute("onmouseout","rolling.rout("+v_timeid+");");
    				}
    			}
    		}

    		rolling.rolling(v_id,v_height,v_interval,v_over,v_timeid,v_total);
    	},

    	rolling:function(v_id,v_height,v_interval,v_over,v_timeid,v_total) {
    		if(rolling.flag[v_timeid] == 0) {
    			rolling.count[v_timeid]++;
    			if(rolling.count[v_timeid] == v_total*19) rolling.count[v_timeid] = 0;
    		}

    		$(v_id).style.top = "-"+(1*rolling.count[v_timeid])+"px";

    		if(rolling.count[v_timeid]%19 == 0) {
    			setTimeout("rolling.rolling('"+v_id+"',"+v_height+","+v_interval+","+v_over+","+v_timeid+","+v_total+");",v_interval);
    		}else {
    			setTimeout("rolling.rolling('"+v_id+"',"+v_height+","+v_interval+","+v_over+","+v_timeid+","+v_total+");",rolling.rolling_speed);
    		}
    	},

    	rover:function(v_timeid) {
    		rolling.flag[v_timeid] = 1;
    	},

    	rout:function(v_timeid) {
    		rolling.flag[v_timeid] = 0;
    	}
    }


    // 셀프랭킹 롤링정보
    var rankObj = null;

    var start_self_rolling = false;

    // 투데이랭킹 보기
    function showTodayRank() {
        try{
            rankObj = new Object();
            rankObj.timerId    = null;
            rankObj.calIdxFalg = true;
            rankObj.showIdx    = 0;
            rankObj.hideIdx    = 0;

            //var oRank = document.getElementsByName("most_ranking");

            if(start_self_rolling) {
                viewSelfRankInfo();
            }else {
				//for (j=1; j<4; j++ ){
				//	var oRank = document.getElementsByName("most_ranking_"+j);
				//	if(oRank.length > 1) {
						start_self_rolling = true;
						rankObj.timerId = setTimeout(viewSelfRankInfo,2000);
				//	}
				//}
            }
        }catch(e){
            alert(e);
        }
    }

    // 이미지 소멸/표현
    function viewSelfRankInfo() {
        try{
			var ss = 0;
			for (j=1; j<4; j++ ){
				var oRank = document.getElementsByName("most_ranking_"+j);

				/*switch(j){
				  case "1" : img_rank_name = ""; break;
				  case "2" : img_rank_name = ""; break;
				  case "3" : img_rank_name = ""; break;
				}*/


				if(rankObj.calIdxFalg == true) {
					for(var i=0; i<oRank.length; i++) {
						if(oRank[i].style.display == "")
						rankObj.showIdx = i+1;
					}

					if(rankObj.showIdx >= oRank.length)
					rankObj.showIdx = 0;

					if(rankObj.showIdx > 0){
						rankObj.hideIdx = rankObj.showIdx - 1;
					}else{
						rankObj.hideIdx = oRank.length - 1;
					}

					rankObj.calIdxFalg = false;
				}

				var imgRankCust = document.getElementsByName("img_rank_cust_"+j);


				if(IE == 1){
					switch(imgRankCust[rankObj.hideIdx].style.filter) {
						case "alpha(Opacity:100)" :
							imgRankCust[rankObj.hideIdx].style.filter = "alpha(Opacity:90)";
						break;

						case "alpha(Opacity:90)"  :
							imgRankCust[rankObj.hideIdx].style.filter = "alpha(Opacity:80)";
						break;

						case "alpha(Opacity:80)"  :
							imgRankCust[rankObj.hideIdx].style.filter = "alpha(Opacity:70)";
						break;

						case "alpha(Opacity:70)"  :
							imgRankCust[rankObj.hideIdx].style.filter = "alpha(Opacity:60)";
						break;

						case "alpha(Opacity:60)"  :
							imgRankCust[rankObj.hideIdx].style.filter = "alpha(Opacity:50)";
						break;

						case "alpha(Opacity:50)"  :
							imgRankCust[rankObj.hideIdx].style.filter = "alpha(Opacity:40)";
						break;

						case "alpha(Opacity:40)"  :
							imgRankCust[rankObj.hideIdx].style.filter = "alpha(Opacity:30)";
						break;

						case "alpha(Opacity:30)"  :
							imgRankCust[rankObj.hideIdx].style.filter = "alpha(Opacity:20)";
						break;

						case "alpha(Opacity:20)"  :
							imgRankCust[rankObj.hideIdx].style.filter = "alpha(Opacity:10)";
						break;

						case "alpha(Opacity:10)"  :
							imgRankCust[rankObj.hideIdx].style.filter = "alpha(Opacity:0)";
						break;

						case "alpha(Opacity:0)"   :
							oRank[rankObj.hideIdx].style.display = "none";
							oRank[rankObj.showIdx].style.display = "";

							switch(imgRankCust[rankObj.showIdx].style.filter) {
								case "alpha(Opacity:0)"   :
									imgRankCust[rankObj.showIdx].style.filter = "alpha(Opacity:10)";
								break;

								case "alpha(Opacity:10)"  :
									imgRankCust[rankObj.showIdx].style.filter = "alpha(Opacity:20)";
								break;

								case "alpha(Opacity:20)"  :
									imgRankCust[rankObj.showIdx].style.filter = "alpha(Opacity:30)";
								break;

								case "alpha(Opacity:30)"  :
									imgRankCust[rankObj.showIdx].style.filter = "alpha(Opacity:40)";
								break;

								case "alpha(Opacity:40)"  :
									imgRankCust[rankObj.showIdx].style.filter = "alpha(Opacity:50)";
								break;

								case "alpha(Opacity:50)"  :
									imgRankCust[rankObj.showIdx].style.filter = "alpha(Opacity:60)";
								break;

								case "alpha(Opacity:60)"  :
									imgRankCust[rankObj.showIdx].style.filter = "alpha(Opacity:70)";
								break;

								case "alpha(Opacity:70)"  :
									imgRankCust[rankObj.showIdx].style.filter = "alpha(Opacity:80)";
								break;

								case "alpha(Opacity:80)"  :
									imgRankCust[rankObj.showIdx].style.filter = "alpha(Opacity:90)";
								break;

								case "alpha(Opacity:90)"  :
									imgRankCust[rankObj.showIdx].style.filter = "alpha(Opacity:100)";
								break;

								case "alpha(Opacity:100)" :
									rankObj.calIdxFalg = true;
								break;
					}
				}
			//IE 이외
			}else{

				switch(imgRankCust[rankObj.hideIdx].style.opacity) {
					case "1" :
						imgRankCust[rankObj.hideIdx].style.opacity= "0.9";
					break;

					case "0.9"  :
						imgRankCust[rankObj.hideIdx].style.opacity= "0.8";
					break;

					case "0.8"  :
						imgRankCust[rankObj.hideIdx].style.opacity= "0.7";
					break;

					case "0.7"  :
						imgRankCust[rankObj.hideIdx].style.opacity= "0.6";
					break;

					case "0.6"  :
						imgRankCust[rankObj.hideIdx].style.opacity= "0.5";
					break;

					case "0.5"  :
						imgRankCust[rankObj.hideIdx].style.opacity= "0.4";
					break;

					case "0.4"  :
						imgRankCust[rankObj.hideIdx].style.opacity= "0.3";
					break;

					case "0.3"  :
						imgRankCust[rankObj.hideIdx].style.opacity= "0.2";
					break;

					case "0.2"  :
						imgRankCust[rankObj.hideIdx].style.opacity= "0.1";
					break;

					case "0.1"  :
						imgRankCust[rankObj.hideIdx].style.opacity= "0";
					break;

					case "0"   :
						oRank[rankObj.hideIdx].style.display = "none";
						oRank[rankObj.showIdx].style.display = "";

						switch(imgRankCust[rankObj.showIdx].style.opacity) {
							case "0"   :
								imgRankCust[rankObj.showIdx].style.opacity= "0.1";
							break;

							case "0.1"  :
								imgRankCust[rankObj.showIdx].style.opacity= "0.2";
							break;

							case "0.2"  :
								imgRankCust[rankObj.showIdx].style.opacity= "0.3";
							break;

							case "0.3"  :
								imgRankCust[rankObj.showIdx].style.opacity= "0.4";
							break;

							case "0.4"  :
								imgRankCust[rankObj.showIdx].style.opacity= "0.5";
							break;

							case "0.5"  :
								imgRankCust[rankObj.showIdx].style.opacity= "0.6";
							break;

							case "0.6"  :
								imgRankCust[rankObj.showIdx].style.opacity= "0.7";
							break;

							case "0.7"  :
								imgRankCust[rankObj.showIdx].style.opacity= "0.8";
							break;

							case "0.8"  :
								imgRankCust[rankObj.showIdx].style.opacity= "0.9";
							break;

							case "0.9"  :
								imgRankCust[rankObj.showIdx].style.opacity= "1";
							break;

							case "1" :
								rankObj.calIdxFalg = true;
							break;
						}

					}

				}
			}//
            if(rankObj.calIdxFalg == true) {
                rankObj.timerId = setTimeout(viewSelfRankInfo,3000);
            }else {
                rankObj.timerId = setTimeout(viewSelfRankInfo,50);
            }

        }catch(e){
            alert(e);
        }
    }

    function viewMode(mode) {
        if(mode == "MOST_POPULAR") {
            if($("box_left2").style.display == "") {
                rolling.flag[0] = 1;
                showTodayRank();

                $("li_rankMem").className = "a1_off";
                $("li_newMem").className  = "a2_on";

                $("img_rankMem").src = "/images/most_popular_main.gif";
                $("img_newMem").src  = "/images/new_members1_main.gif";

                $("box_left2").style.display = "none";
                document.getElementsByName("most_popular")[0].style.display = "";
                document.getElementsByName("most_popular")[1].style.display = "none";
                document.getElementsByName("most_popular")[2].style.display = "none";
            }
        }else if(mode == "NEW_MEMBER") {
            if($("box_left2").style.display != "") {
                if(rankObj.timerId != null) {
                    clearTimeout(rankObj.timerId);
                }
                // 시작된적이 있을경우
                if(rollingStartFlag) {
                    rolling.flag[0] = 0;
                }else {
                    rolling.init("ul_new_members",20,3000,true);
                }

                $("li_rankMem").className = "a1_on";
                $("li_newMem").className  = "a2_off";

                $("img_rankMem").src = "/images/most_popular1_main.gif";
                $("img_newMem").src  = "/images/new_members_main.gif";

                $("box_left2").style.display = "";
                document.getElementsByName("most_popular")[0].style.display = "none";
                document.getElementsByName("most_popular")[1].style.display = "none";
                document.getElementsByName("most_popular")[2].style.display = "none";
            }
        }
    }

    // FEATURED PROFILES FLASH
    function menuswf(swfNum) {
        var main_seq;

        switch (swfNum)
        {
            case 1  :
                main_seq  = 256;
                break;
            case 2  :
                main_seq  = 257;
                break;
            case 3  :
                main_seq  = 258;
                break;
            case 4  :
                main_seq  = 261;
                break;
            case 5  :
                main_seq  = 259;
                break;
            case 6  :
                main_seq  = 260;
                break;
        }
        location.href = "/profile/featured-profiles-view.asp?txt_board_typ=03&txt_main_seq="+main_seq+"&txt_rply_seq=000&txt_curPage=1";
    }

    // FEATURED PROFILES FLASH
    function mainswf(seq) {
        location.href = "/profile/featured-profiles-view.asp?txt_board_typ=03&txt_main_seq="+seq+"&txt_rply_seq=000&txt_curPage=1";
    }

    // MATCHING SERVICES LAYER SHOW
    function layerOver(layerId) {
        var f = document.frm;

        $(layerId).style.display = "";

        switch(layerId) {
            case "div_layer_2" : f.sel_birth_yy.style.visibility = "hidden";
                                 f.sel_birth_mm.style.visibility = "hidden";
                                 f.sel_birth_dd.style.visibility = "hidden";
                                 break;

            case "div_layer_3" : f.sel_birth_yy.style.visibility = "hidden";
                                 f.sel_birth_mm.style.visibility = "hidden";
                                 f.sel_birth_dd.style.visibility = "hidden";
                                 f.sel_bld_typ.style.visibility  = "hidden";
                                 break;

            case "div_layer_4" : f.sel_birth_yy.style.visibility = "hidden";
                                 f.sel_birth_mm.style.visibility = "hidden";
                                 f.sel_birth_dd.style.visibility = "hidden";
                                 f.sel_bld_typ.style.visibility  = "hidden";
                                 break;

            case "div_layer_5" : f.sel_birth_yy.style.visibility = "hidden";
                                 f.sel_birth_mm.style.visibility = "hidden";
                                 f.sel_birth_dd.style.visibility = "hidden";
                                 f.sel_bld_typ.style.visibility  = "hidden";
                                 break;
        }
    }

    // MATCHING SERVICES LAYER CLOSE
    function layerOut(layerId) {
        var f = document.frm;

        $(layerId).style.display = "none";

        switch(layerId) {
            case "div_layer_2" : f.sel_birth_yy.style.visibility = "visible";
                                 f.sel_birth_mm.style.visibility = "visible";
                                 f.sel_birth_dd.style.visibility = "visible";
                                 break;

            case "div_layer_3" : f.sel_birth_yy.style.visibility = "visible";
                                 f.sel_birth_mm.style.visibility = "visible";
                                 f.sel_birth_dd.style.visibility = "visible";
                                 f.sel_bld_typ.style.visibility  = "visible";
                                 break;

            case "div_layer_4" : f.sel_birth_yy.style.visibility = "visible";
                                 f.sel_birth_mm.style.visibility = "visible";
                                 f.sel_birth_dd.style.visibility = "visible";
                                 f.sel_bld_typ.style.visibility  = "visible";
                                 break;

            case "div_layer_5" : f.sel_birth_yy.style.visibility = "visible";
                                 f.sel_birth_mm.style.visibility = "visible";
                                 f.sel_birth_dd.style.visibility = "visible";
                                 f.sel_bld_typ.style.visibility  = "visible";
                                 break;
        }
    }

    // CHANGE EVENT BANNER IMAGE
    function chgEventBanner(bnnrImg,linkUrl) {
        var imgHtml = "";

        if(bnnrImg.indexOf("/images/blank_noimg.gif") >= 0) {
            imgHtml = "<a href='#' onclick=\"location.href='"+linkUrl+"'; return false;\"><img src='"+bnnrImg+"' style='margin:8px 0 0 60px;' alt='Event' /></a>";
        }else {
            imgHtml = "<a href='#' onclick=\"location.href='"+linkUrl+"'; return false;\"><img src='"+bnnrImg+"' style='width:170px; height:67px;' alt='Event' /></a>";
        }

        $("quick_banner").innerHTML = imgHtml;
    }

    function chgBirthYear() {
		var f = document.frm;

		f.sel_birth_mm.value = "";
		f.sel_birth_dd.value   = "";

		f.sel_birth_mm.options.length = 0;
		var opt = new Option("Select","");
		opt.title = "Select";
		f.sel_birth_mm.options.add(opt);

		var today = new Date();
		var year  = today.getYear();
		var month = today.getMonth()+1;

		var maxMonth = 0;

		if(f.sel_birth_yy.value < year) {
			maxMonth = 12;
		}else if(f.sel_birth_yy.value == year) {
			maxMonth = month;
		}

        if(isEmpty(f.sel_birth_yy.value) == false) {
    		for(var i=1; i<=12; i++) {
    			if(i<10) {
    			    opt = new Option("0"+i,"0"+i);
		            opt.title = "0"+i;
    				f.sel_birth_mm.options.add(opt);
    			}else {
    			    opt = new Option(i,i);
		            opt.title = i;
    				f.sel_birth_mm.options.add(opt);
    			}
    		}
    	}

		f.sel_birth_dd.options.length = 0;
		opt = new Option("Select","");
		opt.title = "Select";
		f.sel_birth_dd.options.add(opt);
    }

    function chgBirthMonth() {
        var f = document.frm;
        var today = new Date();
        var year  = today.getYear();
        var month = today.getMonth()+1;
        var day   = today.getDate();
        var arrMaxDay = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

        f.sel_birth_dd.options.length = 0;
		var opt = new Option("Select","");
		opt.title = "Select";
        f.sel_birth_dd.options.add(opt);
        //윤달인 경우
        if((f.sel_birth_yy.value % 4 == 0 && f.sel_birth_yy.value % 100 != 0) || (f.sel_birth_yy.value % 400 == 0))
            arrMaxDay[1] = "29";

        var tmpDay = ""

        for(var i=1; i<=parseInt(arrMaxDay[parseInt(f.sel_birth_mm.value,10)-1],10); i++) {
            if(i<10)
                tmpDay = "0" + i;
            else
                tmpDay = i;

            opt = new Option(tmpDay,tmpDay);
		    opt.title = tmpDay;
            f.sel_birth_dd.options.add(opt);
        }
    }

    // 애정운 리포트
    function goLoveConsultRpt() {
        var f = document.frm;
        var gender_typ = "";
        var yangum = "";
        var leap = "";

        if(isEmpty(f.txt_cust_nm.value)) {
			alert(Message.getMessage("MSG00043"));
			f.txt_cust_nm.focus();
			return;
        }
        if(f.rdo_gender_typ[0].checked == false && f.rdo_gender_typ[1].checked == false) {
			alert(Message.getMessage("MSG00050"));
			return;
        }else if(f.rdo_gender_typ[0].checked) {
            gender_typ = "M";
        }else {
            gender_typ = "F";
        }
        if(isEmpty(f.sel_birth_yy.value)) {
			alert(Message.getMessage("MSG00044"));
			f.sel_birth_yy.focus();
			return;
        }
        if(isEmpty(f.sel_birth_mm.value)) {
			alert(Message.getMessage("MSG00045"));
			f.sel_birth_mm.focus();
			return;
        }
        if(isEmpty(f.sel_birth_dd.value)) {
			alert(Message.getMessage("MSG00046"));
			f.sel_birth_dd.focus();
			return;
        }
        if(f.rdo_yangum[0].checked == false && f.rdo_yangum[1].checked == false) {
			alert(Message.getMessage("MSG00092"));
			return;
        }else if(f.rdo_yangum[0].checked) {
            yangum = "음";
        }else {
            yangum = "양";
        }
        if(f.rdo_leap[0].checked == false && f.rdo_leap[1].checked == false) {
			alert(Message.getMessage("MSG00093"));
			return;
        }else if(f.rdo_leap[0].checked) {
            leap = "평달";
        }else {
            leap = "윤달";
        }
        if(isEmpty(f.sel_bld_typ.value)) {
			alert(Message.getMessage("MSG00047"));
			f.sel_bld_typ.focus();
			return;
        }

		var top  = screen.height/2 - 750/2;
		var left = screen.width/2 - 750/2;
		var sFeatures = "top=" + top + ",left=" + left + ",width=748,height=750,scrollbars=yes,menubar=no,status=no,resizable=no";

		var mUrl = "/common/romance-report.asp?rdo_gender_typ=" + escape(gender_typ) + "&txt_name=" + escape(f.txt_cust_nm.value) + "&sel_year=" +escape(f.sel_birth_yy.value) + "&sel_month=" + escape(f.sel_birth_mm.value) + "&sel_day=" + escape(f.sel_birth_dd.value) + "&sel_blood=" + escape(f.sel_bld_typ.value) + "&rdo_yangum=" + escape(yangum) + "&rdo_leap=" + escape(leap);
		window.open(mUrl ,"",sFeatures);
    }

    function onChgCntnt(obj) {
        var f = document.frm;
        var sql = "";

        f.sel_birth_nation_cd.options.length = 0;
        var opt = new Option("Country","");
        opt.title = "Country";
        f.sel_birth_nation_cd.options.add(opt);

        if(isEmpty(obj.value) == false) {
            var url    = "/common/getCntrySidoList.asp";
            var params = "";
            params = "sql_type=" + escape("COUNTRY") + "&lang_typ=" + escape("ALL") + "&obj_val=" + escape(obj.value);
            url += "?" + params;

    		var objHTTP = MakeHttpObject();
    		if(IE){
    		    objHTTP.open("GET", url, false);
    		}else{
    		    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");

                        for(var i=0; i<cntrySidoCdArr.length; i++) {
                            opt = new Option(cntrySidoNmArr[i].firstChild.nodeValue,cntrySidoCdArr[i].firstChild.nodeValue);
                            opt.title = cntrySidoNmArr[i].firstChild.nodeValue;
                            f.sel_birth_nation_cd.options.add(opt);
                            opt = null;
                        }
                    }
                }
            }

    		objHTTP.send(null);
        }
    }

    // 회원가입
    function goJoinMember() {
        var f = document.frm;
        var cust_rcp_typ = "";

        if(f.rdo_cust_rcp_typ[0].checked == false && f.rdo_cust_rcp_typ[1].checked == false) {
            cust_rcp_typ = ""
        }else if(f.rdo_cust_rcp_typ[0].checked) {
            cust_rcp_typ = "01";
        }else {
            cust_rcp_typ = "02";
        }

        location.href = "/join/questionnaires.asp?birth_nation_cd="+f.sel_birth_nation_cd.value+"&cust_rcp_typ="+cust_rcp_typ;
    }


    document.onkeydown = getkey;

    function getkey(e) {
        var keyVal = null;
        var tname = null;

        if(typeof(e) != "undefined") {
            keyVal = e.which;
            tname  = e.target.name;
        }else {
            keyVal = event.keyCode;
            tname  = event.srcElement.name;
        }

        if(keyVal == 13) {
            if(tname == "txt_header_mbr_id" || tname == "txt_header_mbr_pw") {
                setLogin();
            }
        }
    }

    function setLogin() {
        var f = document.frm;

        if(isEmpty(f.txt_header_mbr_id.value)) {
            alert(Message.getMessage("MSG00002"));
            f.txt_header_mbr_id.focus();
            return;
        }
        if(isEmpty(f.txt_header_mbr_pw.value)) {
            alert(Message.getMessage("MSG00003"));
            f.txt_header_mbr_pw.focus();
            return;
        }

        f.method = "post";
        f.target = "if_default";
        f.action = "/loginProc.asp";
        f.submit();
    }

    function setLoginRslt(flag, msg, popupArr, encodeCustNo, loginAfterMoveUrl) {
        if(flag == "True") {
            // 운영
            if(location.href.indexOf("www.couple.net") >= 0) {
                location.href = location.href.replace("http://","https://");
            // 개발
            }else {
                location.href = location.href;
            }

            if(isEmpty(loginAfterMoveUrl) == false) {
                location.href = loginAfterMoveUrl;
            }else {
                for(var i=0; i<popupArr.length; i++) {
                    window.open(popupArr[i].url, popupArr[i].windowName, popupArr[i].windowFeatures);
                }
            }
        }else {
            alert(msg);
        }
    }

    function setLogout() {
        var f = document.frm;

        f.method = "post";
        f.target = "if_default";
        f.action = "/logoutProc.asp";
        f.submit();
    }

    function setLogoutRslt(flag,msg) {
        if(flag == "True") {
            location.href = location.href;
        }else {
            alert(msg);
        }
    }

    function setIdCookie() {
        var cookies = document.cookie;
        var idx = cookies.indexOf("coupleSaveId=");
        var userId = cookies.substring(idx+13,cookies.length);

        if(userId.indexOf(";") > 0)
            userId = userId.substring(0,userId.indexOf(";"));

        if(idx > -1) {
            document.getElementsByName("chk_save_id")[0].checked = true;
            document.getElementsByName("txt_header_mbr_id")[0].style.backgroundImage = "";
            document.getElementsByName("txt_header_mbr_id")[0].value = userId;
            document.getElementsByName("chk_save_id")[0].focus();
            document.getElementsByName("txt_header_mbr_pw")[0].focus();
        }else {
            document.getElementsByName("chk_save_id")[0].checked = false;
        }
    }

	//센터홈보기
	function openCenterMain(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("/Corporate/center-branch.asp?orgCd="+orgCd,"",sFeatures);
	}

	//매니저 정보보기 팝업
	function popConsultant(mngrCustNm) {
        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=EN","popConsultant",sFeatures);
    }

    //About Couple.net Matching & Dating Services.
    function clickedAbout() {
        if($("dv_about_desc").style.display != "none") {
            $("dv_about_desc").style.display = "none";
            $("box_footer").style.top = "0px";
        }else {
            $("dv_about_desc").style.display = "";
            $("box_footer").style.top = "50px";
        }
    }

	//메인 회원가입 폼 체크
	function verifyUsername(){

        var f = document.frm;

        if(isEmpty(f.txt_mbr_id.value)) {
            alert(Message.getMessage("MSG00002"));
            f.txt_mbr_id.focus();
            return;
        }
        if(!isAlphaNumericMark(trim(f.txt_mbr_id.value))) {
            alert(Message.getMessage("MSG00052"));
            f.txt_mbr_id.focus();
            return false;
        }
        if(trim(f.txt_mbr_id.value).length < 6 || trim(f.txt_mbr_id.value).length > 15) {
            alert(Message.getMessage("MSG00051"));
            f.txt_mbr_id.focus();
            return;
        }
        if(!isAlphaNumeric(trim(f.txt_mbr_id.value))){
            alert(Message.getMessage("MSG00052"));
            f.txt_mbr_id.focus();
            return;
        }
        var top  = screen.height/2 - 280/2;
        var left = screen.width/2 - 400/2;
        var sFeatures = "top=" + top + ",left=" + left + ",width=400,height=280,scrollbars=no,menubar=no,status=no,resizable=no";

        window.open("","verifyUsername",sFeatures);

        f.method = "post";
        f.target = "verifyUsername";
        f.action = "/join/pop-verify-username.asp";
        f.submit();
    }

	function reset_nm1() {
		f = document.frm;

		if (f.txt_cust_nm1.value == "First Name"){
			f.txt_cust_nm1.value = "";
		}else if (isEmpty(f.txt_cust_nm1.value)) {
			f.txt_cust_nm1.value == "First Name";
		}
	}

	function reset_nm2() {
		f = document.frm;

		if (f.txt_cust_nm2.value == "Last Name"){
			f.txt_cust_nm2.value = "";
		}else if (isEmpty(f.txt_cust_nm2.value)) {
			f.txt_cust_nm2.value == "Last Name";
		}
	}

	function reset_id() {
		f = document.frm;

		if (f.txt_mbr_id.value == "6 to 15 characters"){
			f.txt_mbr_id.value = "";
		}else if (isEmpty(f.txt_mbr_id.value)) {
			f.txt_mbr_id.value == "6 to 15 characters";
		}
	}




	function chk_frm(){
		var f = document.frm;
//이름
		if(isEmpty(f.txt_cust_nm1.value) || f.txt_cust_nm1.value=="First Name") {
            alert(Message.getMessage("MSG00043"));
            f.txt_cust_nm1.focus();
            return;
        }

		if(isEmpty(f.txt_cust_nm2.value) || f.txt_cust_nm2.value=="Last Name") {
            alert(Message.getMessage("MSG00043"));
            f.txt_cust_nm2.focus();
            return;
        }


// 성별구분
        if(f.rdo_gender_typ[0].checked == false && f.rdo_gender_typ[1].checked == false) {
	        alert(Message.getMessage("MSG00050"));

	        return;
		}
// 결혼구분
        if(f.rdo_cust_rcp_typ[0].checked == false && f.rdo_cust_rcp_typ[1].checked == false) {
	        alert(Message.getMessage("MSG00434"));

	        return;
		}
// 생년월일
        if(isEmpty(f.sel_year.value)) {
            alert(Message.getMessage("MSG00044"));
            document.getElementById("err_DateofBirth").style.color = "#ef4028";
            f.sel_year.focus();
            return;
        }
        if(isEmpty(f.sel_month.value)) {
            alert(Message.getMessage("MSG00045"));
            document.getElementById("err_DateofBirth").style.color = "#ef4028";
            f.sel_month.focus();
            return;
        }
        if(isEmpty(f.sel_day.value)) {
            alert(Message.getMessage("MSG00046"));
            document.getElementById("err_DateofBirth").style.color = "#ef4028";
            f.sel_day.focus();
            return;
        }

// 아이디
        if(isEmpty(f.txt_mbr_id.value)) {
            alert(Message.getMessage("MSG00002"));
            document.getElementById("err_Username").style.color = "#ef4028";
            f.txt_mbr_id.focus();
            return;
        }
        if(trim(f.txt_mbr_id.value).length < 6 || trim(f.txt_mbr_id.value).length > 15) {
            alert(Message.getMessage("MSG00051"));
            document.getElementById("err_Username").style.color = "#ef4028";
            f.txt_mbr_id.focus();
            return;
        }
        if(!isAlphaNumeric(trim(f.txt_mbr_id.value))){
            alert(Message.getMessage("MSG00052"));
            document.getElementById("err_Username").style.color = "#ef4028";
            f.txt_mbr_id.focus();
            return;
        }
        if(trim(f.txt_mbr_id.value) != trim(f.txt_checked_id.value)){
            alert(Message.getMessage("MSG00009"));
            document.getElementById("err_Username").style.color = "#ef4028";
            f.txt_mbr_id.focus();
            return;
        }

// 비밀번호
        if(isEmpty(f.txt_mbr_pw.value)) {
            alert(Message.getMessage("MSG00003"));
            document.getElementById("err_Password").style.color = "#ef4028";
            f.txt_mbr_pw.focus();
            return false;
        }
        if(trim(f.txt_mbr_pw.value).length < 8 || trim(f.txt_mbr_pw.value).length > 15) {
            alert(Message.getMessage("MSG00072"));
            document.getElementById("err_Password").style.color = "#ef4028";
            f.txt_mbr_pw.focus();
            return;
        }
        if(!isAlphaNumeric(trim(f.txt_mbr_pw.value))){
            alert(Message.getMessage("MSG00071"));
            document.getElementById("err_Password").style.color = "#ef4028";
            f.txt_mbr_pw.focus();
            return;
        }
/*		if(isEmpty(f.txt_mbr_pw2.value)) {
			alert(Message.getMessage("MSG00409"));
			document.getElementById("err_ConfirmPassword").style.color = "#ef4028";
            f.txt_mbr_pw2.focus();
            return;
		}
        if(trim(f.txt_mbr_pw.value) != trim(f.txt_mbr_pw2.value)) {
            alert(Message.getMessage("MSG00073"));
            document.getElementById("err_ConfirmPassword").style.color = "#ef4028";
            f.txt_mbr_pw2.focus();
            return;
        }
*/
//이메일
		if(isEmpty(f.txt_email.value)) {
			alert(Message.getMessage("MSG00179"));
			f.txt_email.focus();
			return;
		}
		if(!isValidEmail(f.txt_email.value)) {
			alert(Message.getMessage("MSG00019"));
			f.txt_email.focus();
			return;
		}
		f.txt_cust_nm.value = f.txt_cust_nm1.value + " " + f.txt_cust_nm2.value

		f.method = "post";
		f.target = "_self";
		f.action = "/join/questionnaires.asp";
		f.submit();

	}



    // 날짜세팅(년)
	function chgYear() {
		var f = document.frm;
		var opt = null

		f.sel_month.value = "";
		f.sel_day.value   = "";

		f.sel_month.options.length = 0;
		opt = new Option("Month","")
		opt.title = "Month";
		f.sel_month.options.add(opt);

		var today = new Date();
		var year  = today.getYear();
		var month = today.getMonth()+1;

		var maxMonth = 0;

		if(f.sel_year.value < year) {
			maxMonth = 12;
		}else if(f.sel_year.value == year) {
			maxMonth = month;
		}

        if(isEmpty(f.sel_year.value) == false) {
    		for(var i=1; i<=12; i++) {
    			if(i < 10) {
            		opt = new Option("0"+i,"0"+i)
            		opt.title = "0"+i;
    				f.sel_month.options.add(opt);
    			}else {
            		opt = new Option(i,i)
            		opt.title = i;
    				f.sel_month.options.add(opt);
    			}
    		}
    	}

		f.sel_day.options.length = 0;
		opt = new Option("Day","")
		opt.title = "Day";
		f.sel_day.options.add(opt);
	}

	// 날짜세팅(월)
    function chgMonth() {
        var f = document.frm;
        var opt = null

        var today = new Date();
        var year  = today.getYear();
        var month = today.getMonth()+1;
        var day   = today.getDate();
        var arrMaxDay = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

        f.sel_day.options.length = 0;
		opt = new Option("Day","")
		opt.title = "Day";
		f.sel_day.options.add(opt);

        //윤달인 경우
        if((f.sel_year.value % 4 == 0 && f.sel_year.value % 100 != 0) || (f.sel_year.value % 400 == 0))
            arrMaxDay[1] = "29";

        var tmpDay = ""

        for(var i=1; i<=parseInt(arrMaxDay[parseInt(f.sel_month.value,10)-1],10); i++) {
            if(i<10)
                tmpDay = "0" + i;
            else
                tmpDay = i;

    		opt = new Option(tmpDay,tmpDay)
    		opt.title = tmpDay;
            f.sel_day.options.add(opt);
        }
    }
