﻿var p_couple=
{
	c_obj:null,
	c_obj2:null,
	c_obj3:null,
	c_obj4:null,
	c_obj5:null,


	popup_toggle:function()
	{
		if($("header_popup").style.display!="block")
		{
			document._onclick=document.onclick;
			document.onclick=function()
			{
				if($("header_popup").style.display!="block")
				{
					$("header_popup").style.display="block";
				}
				else
				{
					$("header_popup").style.display="none";
					document.onclick=document._onclick;
					document._onclick=null;
				}
			}
		}
	},

	popup_skipto:function()
	{
		if($("header_skipto").style.display!="block")
		{
			document._onclick=document.onclick;
			document.onclick=function()
			{
				if($("header_skipto").style.display!="block")
				{
					$("header_skipto").style.display="block";
				}
				else
				{
					$("header_skipto").style.display="none";
					document.onclick=document._onclick;
					document._onclick=null;
				}
			}
		}
	},

	popup_skipto2:function(v_id)
	{
		if($(v_id).style.display!="block")
		{
			document._onclick=document.onclick;
			document.onclick=function()
			{
				if($(v_id).style.display!="block")
				{
					$(v_id).style.display="block";
				}
				else
				{
					$(v_id).style.display="none";
					document.onclick=document._onclick;
					document._onclick=null;
				}
			}
		}
	},

	mover:function(v_obj,v_obj2)
	{

		if(v_obj2==null) v_obj2=p_couple.c_obj;

		if(v_obj!=v_obj2)
		{
			if(v_obj!=null) v_obj.style.backgroundPosition="left bottom";
		}
	},

	mout:function(v_obj,v_obj2)
	{
		if(v_obj2==null) v_obj2=p_couple.c_obj;

		if(v_obj!=v_obj2)
		{
			v_obj.style.backgroundPosition="left top";
		}
	},

	mclick3:function(v_obj)
	{
		v_obj.style.backgroundPosition="left bottom";
		if(p_couple.c_obj3!=null) p_couple.c_obj3.style.backgroundPosition="left top";
		p_couple.c_obj3=v_obj;
	},

	mfocus:function(v_id,v_obj)
	{
		$(v_id).className="input_box1_out_f";
		v_obj.style.backgroundImage="url(/img/w3c/s.gif)";
	},

	mfocus_qa:function(v_id,v_obj)
	{
		$(v_id).className="input_box2_out_f";
		v_obj.style.backgroundImage="url(/img/w3c/s.gif)";
	},

	mblur:function(v_id)
	{
		$(v_id).className="input_box1_out";
	},

	mblur_qa:function(v_id)
	{
		$(v_id).className="input_box2_out";
	},

	mfocus2:function(v_obj,v_class)
	{
		v_obj.className=v_class+"_f";
	},

	mblur2:function(v_obj,v_class)
	{
		v_obj.className=v_class;
	},

	fixup:function()
	{
		if(IE6)
		{
			if($("chk_save_id")!=null) $("chk_save_id").style.top="-4";
			if($("chk_save_id")!=null) $("chk_save_id").style.left="-4";

			if($("lover_repts_bottom")!=null) $("lover_repts_bottom").style.height="7px";
			if($("talk_englishforum_top")!=null) $("talk_englishforum_top").style.paddingTop="3px";
			if($("talk_bottom")!=null) $("talk_bottom").style.height="5px";
		}

		if(SAF)
		{
			if($("lover_repts_item3")!=null) $("lover_repts_item3").style.paddingLeft="0px";
			if($("harmony_match_item")!=null) $("harmony_match_item").style.letterSpacing="-1px";
		}

		if(CR)
		{
			if($("lover_repts_item3")!=null) $("lover_repts_item3").style.paddingLeft="0px";
		}

		if(OP)
		{
			if($("lover_repts_main")!=null) $("lover_repts_main").style.height="109px";
			if($("talk_bottom")!=null) $("talk_bottom").style.height="7px";
		}

		if($("sub_container")!=null)
		{
			var h1=$("sub_left").offsetHeight;
			var h2=$("sub_main").offsetHeight;

			if(h1>h2)
			{
				$("sub_container").style.height=""+h1+"px";
			}
			else
			{
				$("sub_container").style.height=""+h2+"px";
			}
		}
	},

	save_id:function()
	{
		if($("chk_save_id").checked)
		{
			$("chk_save_id").checked=false;
		}
		else
		{
			$("chk_save_id").checked=true;
		}
	},

	party_banner:function(v_img,v_link)
	{
		var l_s="<a href=\"#\" onclick=\"location.href='"+v_link+"';return false;\" onkepress=\"location.href='"+v_link+"';return false;\"><img src='"+v_img+"' width='170' height='67' alt='이벤트 배너' /></a>";
		//var l_s="<img src='"+v_img+"' width='170' height='67' alt='이벤트 배너' />";
		$("party_event_banner_img").innerHTML=l_s;
	},

	view_rank:function()
	{
		$("today_rank_tab1").style.backgroundPosition="left bottom";
		$("today_rank_tab2").style.backgroundPosition="left top";

		$("tbl_todayRank").style.display="block";
		$("tbl_newMember").style.display="none";
		showTodayRank();
	},

	view_member:function()
	{
		$("today_rank_tab1").style.backgroundPosition="left top";
		$("today_rank_tab2").style.backgroundPosition="left bottom";

		$("tbl_todayRank").style.display="none";
		$("tbl_newMember").style.display="block";
	},

	// p_ajax(v_url,fct,v_fctvars,v_type,v_vars,v_method)
	get_data1:function(v_var1,v_var2)
	{
		p_ajax("/samp1.xml", p_couple.get_data1_sub,new Array(v_var1,v_var2));
	},

	get_data1_sub:function(response,vars)
	{
		var l_var1 = vars[0];
		var l_var2 = vars[1];

		alert(l_var1);
		alert(l_var2);

		var l_s="", l_result="";

		if(response.getElementsByTagName("item")[0]!=null)
		{
			var loopCount=response.getElementsByTagName("item").length;

			for(var i=0; i < loopCount; i++)
			{
				l_result=response.getElementsByTagName("item")[i];

				l_title=getXMLval(l_result,"title","str",false,"");
				l_desc=getXMLval(l_result,"desc","str",false,"");

				alert("["+i+"] "+l_title+"<br />"+l_desc);

				l_s += "["+i+"] "+l_title+"<br />"+l_desc+"<br /><br />" ;
			}
		}

		alert(l_s);

		$("couple").innerHTML = l_s;
	},

	show_toggle:function(v_id)
	{
		if($(v_id).style.display!="block")
		{
			$(v_id).style.display="block";
		}
		else
		{
			$(v_id).style.display="none";
		}

		p_couple.fixup();
	},

	//연도 선택
	chgYear:function(obj)
	{

		$(obj).value = "";

		$(obj).options.length = 0;
		$(obj).options.add(new Option("월선택",""));

		if($("sel_birth_yy").value !="")
		{

			var today = new Date();
			var year  = today.getYear();
    		var month = today.getMonth()+1;

    		var maxMonth = 0;

    		if($("sel_birth_yy").value < year) {
    			maxMonth = 12;
    		}else if($("sel_birth_yy").value == year) {
    			maxMonth = month;
    		}

    		for(var i=1; i<=12; i++) {

    			if(i<10)
				{
    				$(obj).options.add(new Option("0"+i,"0"+i));
				}
    			else
				{
    				$(obj).options.add(new Option(i,i));
				}
    		}

		}
	},

	// 월 변경
    chgMonth:function(obj,mode) {

        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);

        $(obj).options.length = 0;
        if(mode=="match"){
            $(obj).options.add(new Option("-Select-",""));
        }else{
            $(obj).options.add(new Option("일선택",""));
        }


        //윤달인 경우
        if(($("sel_birth_yy").value % 4 == 0 && $("sel_birth_yy").value % 100 != 0) || ($("sel_birth_yy").value % 400 == 0))
            arrMaxDay[1] = "29";

        var tmpDay = ""

        for(var i=1; i<=parseInt(arrMaxDay[parseInt($("sel_birth_mm").value,10)-1],10); i++) {
            if(i<10)
                tmpDay = "0" + i;
            else
                tmpDay = i;

            $(obj).options.add(new Option(tmpDay,tmpDay));
        }
    },

	//양력 음력
	chgYangum:function()
	{

		var oYangUm = document.getElementsByName("rdo_yangum");
		var oRdoLeap = document.getElementsByName("rdo_leap");

		if(oYangUm[1].checked){
			oRdoLeap[1].disabled = true;
			oRdoLeap[0].checked  =true;
		}else{
			oRdoLeap[1].disabled = false;
		}
	},

	//애정운
	loveConsultRpt:function()
	{
		try
		{
			var oCustNm = $("txt_cust_nm"); //고객명
			var oGenderTyp = document.getElementsByName("rdo_gender_typ"); //성별
			var oSelYear = $("sel_birth_yy"); //년도
			var oSelMonth = $("sel_birth_mm"); //월
			var oSelDay = $("sel_birth_dd"); //일
			var oYangUm = document.getElementsByName("rdo_yangum"); //양력/음력
			var oLeap = document.getElementsByName("rdo_leap"); //평달/운달
			var oBlood = $("sel_bld_typ"); //혈액형

			if(oCustNm.value=="")
			{
				alert(Message.getMessage("MSG00043"));
				oCustNm.focus();
				return;
			}
			else if(oGenderTyp[0].checked == false &&oGenderTyp[1].checked == false)
			{
				alert(Message.getMessage("MSG00050"));
				return;
			}
			else if(oSelYear.value =="")
			{
				alert(Message.getMessage("MSG00044"));
				oSelYear.focus();
				return;
			}
			else if(oSelMonth.value =="")
			{
				alert(Message.getMessage("MSG00045"));
				oSelMonth.focus();
				return;
		   }
		   else if(oSelDay.value =="")
		  {
				alert(Message.getMessage("MSG00046"));
				oSelDay.focus();
				return;
		  }
		  else if(oYangUm[0].checked == false && oYangUm[1].checked == false)
		  {
				alert(Message.getMessage("MSG00092"));
				return;
		  }
		  else if(oLeap[0].checked == false && oLeap[1].checked == false)
		 {
				alert(Message.getMessage("MSG00093"));
				return;
		  }
		  else if(oBlood.value=="")
		  {
				alert(Message.getMessage("MSG00047"));
				oBlood.focus();
				return;
		  }

		if(oGenderTyp[0].checked)
		{
			gender_typ = "M";
		}else{
			gender_typ = "F";
		}

		if(oYangUm[0].checked){
			yangum = "음";
		}else{
			yangum = "양";
		}

		if(oLeap[0].checked){
			leap = "평달";
		}else{
			leap = "윤달";
		}


		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 = "/service/loveConsultRpt_pop.asp?rdo_gender_typ=" + escape(gender_typ) + "&txt_name=" + escape(oCustNm.value) + "&sel_year=" +escape(oSelYear.value) + "&sel_month=" + escape(oSelMonth.value) + "&sel_day=" + escape(oSelDay.value) + "&sel_blood=" + escape(oBlood.value) + "&rdo_yangum=" + escape(yangum) + "&rdo_leap=" + escape(leap);

		//var mUrl = "/service/loveConsultRpt_pop.asp?rdo_gender_typ=" + escape(gender_typ) + "&amp;txt_name=" + escape(oCustNm.value) + "&amp;sel_year=" +escape(oSelYear.value) + "&amp;sel_month=" + escape(oSelMonth.value) + "&amp;sel_day=" + escape(oSelDay.value) + "&amp;sel_blood=" + escape(oBlood.value) + "&amp;rdo_yangum=" + escape(yangum) + "&amp;rdo_leap=" + escape(leap);

		//window.open("/service/loveConsultRpt_pop.asp?rdo_gender_typ=" + gender_typ + "&txt_name=" + oCustNm.value + "&sel_year=" +oSelYear.value + "&sel_month=" + oSelMonth.value + "&sel_day=" + oSelDay.value + "&sel_blood=" + oBlood.value + "&rdo_yangum=" + yangum + "&rdo_leap=" + leap  ,"",sFeatures);
		window.open(mUrl ,"",sFeatures);

		}
		catch (e)
		{
			alert(e);
		}

	}

}


//메인플래시 이동
function menu1() {
    location.href = "/singles/profile_featuredProfilesView.asp?txt_board_typ=03&txt_main_seq=190&txt_rply_seq=000";
}
function menu2() {
    location.href = "/singles/profile_featuredProfilesView.asp?txt_board_typ=03&txt_main_seq=185&txt_rply_seq=000";
}
function menu3() {
    location.href = "/singles/profile_featuredProfilesView.asp?txt_board_typ=03&txt_main_seq=188&txt_rply_seq=000";
}
function menu4() {
	location.href = "/singles/profile_featuredProfilesView.asp?txt_board_typ=03&txt_main_seq=189&txt_rply_seq=000";
}
function menu5() {
	location.href = "/singles/profile_featuredProfilesView.asp?txt_board_typ=03&txt_main_seq=184&txt_rply_seq=000";
}
function menu6() {
	location.href = "/singles/profile_featuredProfilesView.asp?txt_board_typ=03&txt_main_seq=186&txt_rply_seq=000";
}

function btn1() {
	location.href = "/service/specialPropose.asp";
}


var p_rolling=
{
	rolling_speed:5,
	count:[],
	flag:[],

	init:function(v_id,v_height,v_interval,v_over)
	{


		var v_total=0;
		var v_timeid=p_rolling.count.length;

		p_rolling.count[v_timeid]=0;
		p_rolling.flag[v_timeid]=0;

		for(var i=0;i<$(v_id).childNodes.length;i++)
		{
			if($(v_id).childNodes[i].nodeName=="DIV")
			{
				v_total++;
			}
		}

		$(v_id).innerHTML = $(v_id).innerHTML + $(v_id).innerHTML;

		if(v_over)
		{
			if(IE)
			{
				if($(v_id)!=null)
				{
					$(v_id).onmouseover = function() { p_rolling.rover(v_timeid);};
					$(v_id).onmouseout = function() { p_rolling.rout(v_timeid);};
				}
			}
			else
			{
				if($(v_id)!=null)
				{
					$(v_id).setAttribute("onmouseover","p_rolling.rover("+v_timeid+");");
					$(v_id).setAttribute("onmouseout","p_rolling.rout("+v_timeid+");");
				}
			}
		}

		p_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)
	{
		//alert("id:" + v_timeid);
		//alert("cnt:"+p_rolling.count.length);
		if(p_rolling.flag[v_timeid]==0)
		{
			p_rolling.count[v_timeid]++;
			if(p_rolling.count[v_timeid]==v_total*10) p_rolling.count[v_timeid] = 0;
		}

		$(v_id).style.top="-"+(2*p_rolling.count[v_timeid])+"px";

		if(p_rolling.count[v_timeid]%10 == 0)
		{
			setTimeout("p_rolling.rolling('"+v_id+"',"+v_height+","+v_interval+","+v_over+","+v_timeid+","+v_total+");",v_interval);
		}
		else
		{
			setTimeout("p_rolling.rolling('"+v_id+"',"+v_height+","+v_interval+","+v_over+","+v_timeid+","+v_total+");",p_rolling.rolling_speed);
		}
	},

	rover:function(v_timeid)
	{
		p_rolling.flag[v_timeid]=1;
	},

	rout:function(v_timeid)
	{
		p_rolling.flag[v_timeid]=0;
	}
}

var p_blind=
{
	show:function()
	{
		var arrayPageSize=getPageSize();

		if(IE)
		{
			$("blind").style.filter="alpha(opacity=60)";
		}
		else
		{
			$("blind").style.opacity="0.6";
		}

		$("blind").style.width=arrayPageSize[0]+"px";
		$("blind").style.height=arrayPageSize[1]+"px";

		$("blind").style.display="block";
	},

	hide:function()
	{
		$("blind").style.display="none";
	}
}

//var p_hompy=
//{
//	c_cate:null,
//	c_sub:null,
//	c_tab:null,
//	c_pro:null,
//	c_body:null,
//
//	choice_tab:function(v_id,v_obj)
//	{
//		p_hompy.c_tab.className = p_hompy.c_tab.className.replace("harmony_profile_choice","harmony_profile");
//		//v_obj.className = v_obj.className.replace("harmony_profile","harmony_profile_choice");
//		p_hompy.c_tab=v_obj;
//
//		p_hompy.c_body.style.display="none";
//		$(v_id).style.display="block";
//
//		p_hompy.c_body=$(v_id);
//	},
//
//
//	popup:function()
//	{
//		if($("my_comments").style.display!="block")
//		{
//			document._onclick=document.onclick;
//			document.onclick=function()
//			{
//				if($("my_comments").style.display!="block")
//				{
//					$("my_comments").style.display="block";
//				}
//				else
//				{
//					$("my_comments").style.display="none";
//					document.onclick=document._onclick;
//					document._onclick=null;
//				}
//			}
//		}
//	},
//
//	popup2:function(v_id,v_width,v_height)
//	{
//		var l_width=v_width;
//		var l_height=v_height;
//
//		p_blind.show();
//		if(IE6) hideSelect();
//
//		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;
//
//		$("box").style.width=l_width+"px";
//		$("box").style.height=l_height+"px";
//
//		$("box").innerHTML=$(v_id).innerHTML;
//
//		$("box").style.left=(page_scroll[0]+l_margin_w)+"px";
//		$("box").style.top=(page_scroll[1]+l_margin_h)+"px";
//
//		$("box").style.display="block";
//	},
//
//	// view_memo:function(v_id)
//	// {
//	// 	p_ajax("/memo_"+v_id+".xml", p_hompy.view_memo_sub,v_id);
//	// },
//    //
//	// view_memo_sub:function(response,vars)
//	// {
//	// 	var l_s="",l_from="",l_to="",l_date="",l_content="",l_previous=0,l_next=0;
//	// 	var l_id=vars;
//    //
//	// 	l_from=getXMLval(response,"from","str",false,"");
//	// 	l_to=getXMLval(response,"to","str",false,"");
//	// 	l_date=getXMLval(response,"date","str",false,"0000.00.00. 00:00");
//	// 	l_content=getXMLval(response,"content","str",false,"...");
//	// 	l_previous=getXMLval(response,"previous","int",false,0);
//	// 	l_next=getXMLval(response,"next","int",false,0);
//    //
//	// 	l_s="<div class='wh480 ht268'>"
//	// 	+"	<div class='wh480 ht52 bg_img65'>"
//	// 	+"		<div class='pl18 pt30 fl'><img src='/img/w3c/matching_2/box_icon3.gif' width='2' height='13' alt='' /></div>"
//	// 	+"		<div class='pl4 pt28 fl'><span class='text15 f_color16 b'>쪽지읽기</span> <span class='ftverdana11 f_color16'>Read Memo</span></div>"
//	// 	+"		<div class='wh11 ht11 pr12 pt12 fr cur' onclick='p_hompy.hide();'><img src='/img/w3c/matching_2/config_close.gif' width='11' height='11' alt='닫기' /></div>"
//	// 	+"	</div>"
//	// 	+"	<div class='wh444 pl18 pr18 bg_img66'>"
//	// 	+"		<div class='wh442 ht159 border101'>"
//	// 	+"			<div class='ht29 border45 bg_color28'>"
//	// 	+"				<div class='pl13 pt10 fl'><img src='/img/w3c/matching_2/box_arrow.gif' width='9' height='9' alt=''  /></div>"
//	// 	+"				<div class='pl4 pt8 fl'>보낸이 <span class='ftverdana11 f_color53'>From</span> <span class='f_color51'>: " + l_from + "</span></div>"
//	// 	+"				<div class='pl13 pt10 fl'><img src='/img/w3c/matching_2/box_arrow.gif' width='9' height='9' alt=''  /></div>"
//	// 	+"				<div class='pl4 pt8 fl'>받는이 <span class='ftverdana11 f_color53'>To</span> <span class='f_color51'>: " + l_to + "</span></div>"
//	// 	+"				<div class='pl13 pt8 fl'><span class='f_color54'>" + l_date + "</span></div>"
//	// 	+"			</div>"
//	// 	+"			<div class='wh422 ht108 bg_white pd10 f_color53'>" + l_content + "</div>"
//	// 	+"		</div>"
//	// 	+"		<div class='wh444 ht6'><img src='/img/w3c/matching_2/memo_sub_bottom.gif' width='444' height='6' alt='' /></div>"
//	// 	+"		<div class='ht21 pt9 pb13 tar'>"
//	// 	+"			<span class='cur' onclick='p_hompy.view_memo("+l_previous+");'><img src='/img/w3c/matching_2/btn_previous.gif' width='72' height='21' alt='이전' /></span>"
//	// 	+"			<span class='cur' onclick='p_hompy.view_memo("+l_next+");'><img src='/img/w3c/matching_2/btn_next.gif' width='65' height='21' alt='다음' /></span>"
//	// 	+"			<img src='/img/w3c/s.gif' width='80' height='1' alt='' />"
//	// 	+"			<span class=''><img src='/img/w3c/matching_2/btn_delete2.gif' width='65' height='21' alt='삭제' /></span>"
//	// 	+"			<img src='/img/w3c/s.gif' width='1' height='1' alt='' />"
//	// 	+"		</div>"
//	// 	+"	</div>"
//	// 	+"	<div class='wh480 ht8'><img src='/img/w3c/matching_2/memo_bottom.gif' width='480' height='8' alt='' /></div>"
//	// 	+"</div>";
//    //
//	// 	var l_width=480;
//	// 	var l_height=268;
//    //
//	// 	p_blind.show();
//	// 	if(IE6) hideSelect();
//    //
//	// 	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;
//    //
//	// 	$("box").style.width=l_width+"px";
//	// 	$("box").style.height=l_height+"px";
//    //
//	// 	$("box").innerHTML=l_s;
//    //
//	// 	$("box").style.left=(page_scroll[0]+l_margin_w)+"px";
//	// 	$("box").style.top=(page_scroll[1]+l_margin_h)+"px";
//    //
//	// 	$("box").style.display="block";
//	// },
//
//	hide:function()
//	{
//		if(IE6) showSelect();
//		$("box").style.display="none";
//		$("box").innerHTML="";
//		p_blind.hide();
//	},
//
//	mover:function(v_obj)
//	{
//		var k = 0;
//
//		if(v_obj!=p_hompy.c_cate)
//		{
//			for(var i=0;i<v_obj.childNodes.length;i++)
//			{
//				if(v_obj.childNodes[i].nodeName=="SPAN")
//				{
//					if(k==0)
//					{
//						v_obj.childNodes[i].className="text12 b orange5";
//					}
//					else if(k==1)
//					{
//						v_obj.childNodes[i].className="orange6 ftverdana9_2";
//					}
//
//					k++;
//				}
//			}
//		}
//	},
//
//	mout:function(v_obj)
//	{
//		var k = 0;
//
//		if(v_obj!=p_hompy.c_cate)
//		{
//			for(var i=0;i<v_obj.childNodes.length;i++)
//			{
//				if(v_obj.childNodes[i].nodeName=="SPAN")
//				{
//					if(k==0)
//					{
//						v_obj.childNodes[i].className="text12 b blue18";
//					}
//					else if(k==1)
//					{
//						v_obj.childNodes[i].className="blue19 ftverdana9_2";
//					}
//
//					k++;
//				}
//			}
//		}
//	},
//
//	mmover:function(v_obj)
//	{
//		var k = 0;
//
//		if(v_obj!=p_hompy.c_sub)
//		{
//			for(var i=0;i<v_obj.childNodes.length;i++)
//			{
//				if(v_obj.childNodes[i].nodeName=="SPAN")
//				{
//					if(k==0)
//					{
//						v_obj.childNodes[i].className="text11 orange7";
//					}
//					else if(k==1)
//					{
//						v_obj.childNodes[i].className="orange8 ftverdana9_2";
//					}
//
//					k++;
//				}
//			}
//		}
//	},
//
//	mmout:function(v_obj)
//	{
//		var k = 0;
//
//		if(v_obj!=p_hompy.c_sub)
//		{
//			for(var i=0;i<v_obj.childNodes.length;i++)
//			{
//				if(v_obj.childNodes[i].nodeName=="SPAN")
//				{
//					if(k==0)
//					{
//						v_obj.childNodes[i].className="text11 blue16";
//					}
//					else if(k==1)
//					{
//						v_obj.childNodes[i].className="blue17 ftverdana9_2";
//					}
//
//					k++;
//				}
//			}
//		}
//	},
//
//	mmover2:function(v_obj,v_width)
//	{
//		if(v_obj!=p_hompy.c_tab)
//		{
//			v_obj.className="wh"+v_width+" ht27 pl18 pt3 harmony_profile_choice mr2 fl";
//		}
//	},
//
//	mmout2:function(v_obj,v_width)
//	{
//		if(v_obj!=p_hompy.c_tab)
//		{
//			v_obj.className="wh"+v_width+" ht27 pl18 pt3 harmony_profile mr2 fl";
//		}
//	},
//
//	mmover3:function(v_obj)
//	{
//		v_obj.style.backgroundColor="#fffef4";
//	},
//
//	mmout3:function(v_obj)
//	{
//		v_obj.style.backgroundColor="#ffffff";
//	},
//
//	mmover4:function(v_obj)
//	{
//		v_obj.className="b text11 f_color83 tdu cur";
//	},
//
//	mmout4:function(v_obj)
//	{
//		v_obj.className="b text11 f_color84 cur";
//	},
//
//	qu_over:function(v_id)
//	{
//		$(v_id).style.display="block";
//	},
//
//	qu_out:function(v_id)
//	{
//		$(v_id).style.display="none";
//	}
//}

var p_file=
{
	c_file:null,
	c_obj:null,

	list_file:function()
	{
		// 초기 리스트
		p_ajax("/file.xml", p_file.list_file_sub,"");
	},

	list_file_sub:function(response,vars)
	{
		var l_s="",l_result="",l_filename,l_filesize;

		if(response.getElementsByTagName("item")[0]!=null)
		{
			var loopCount=response.getElementsByTagName("item").length;

			for(var i=0; i < loopCount; i++)
			{
				l_result=response.getElementsByTagName("item")[i];

				l_filename=getXMLval(l_result,"filename","str",false,"");
				l_filesize=getXMLval(l_result,"filesize","str",false,"");

				l_s += "<div class='ht17 pt1 cur' onclick=\"p_file.choice_file('"+l_filename+"',this);\"><span class='pl10'>" + l_filename + "</span> <span class='pl10'>" + l_filesize + "</span></div>" ;
			}
		}

		$("upload_list").innerHTML=l_s;
	},

	choice_file:function(v_name,v_obj)
	{
		p_file.c_file = v_name;

		if(p_file.c_obj!=null)
		{
			p_file.c_obj.style.color="";
			p_file.c_obj.style.fontWeight="normal";
		}

		p_file.c_obj=v_obj;

		p_file.c_obj.style.color="red";
		p_file.c_obj.style.fontWeight="bold";
	},

	delete_file:function()
	{
		if(p_file.c_file!=null)
		{
			// 삭제 후 리스트
			p_ajax("/file2.xml", p_file.list_file_sub,"");
		}
		else
		{
			alert("선택된 파일이 없습니다.");
		}
	},

	file_submit:function()
	{
		alert("실행");
		form = document.filefrm;
		form.submit();
	}
}

var p_calendar=
{
	cal_id:0,

	show_calendar:function(v_obj,v_form)
	{
		p_calendar.cal_id++;
		var ParentNode=v_obj.parentNode;
		if(ParentNode.childNodes.length==1)
		{
			var l_s="<div id='cal_"+p_calendar.cal_id+"' class='calendar'></div>";

			var objChildNode=document.createElement("DIV");
			 objChildNode.className="embed_frame";
			 objChildNode.style.position="absolute";

			//objChildNode.outerHTML = "<div class='embed_frame' style='position:absolute; top:0px; left:0px;'></div>";

			objChildNode.innerHTML=l_s;

			if(IE6) hideSelect();
			ParentNode.appendChild(objChildNode);

			p_calendar.get_calendar("cal_"+p_calendar.cal_id,v_form);
		}
		else if(ParentNode.childNodes.length==2)
		{

			ParentNode.removeChild(ParentNode.childNodes[1]);
			if(IE6) showSelect();
		}
	},
	

	show_calendar2:function(v_obj,v_form) //마이페이지 신규적용
	{
		p_calendar.cal_id++;
		var ParentNode=v_obj.parentNode;

		if(ParentNode.childNodes.length==6)
		{
			var l_s="<div id='cal_"+p_calendar.cal_id+"' class='calendar' style='background-color:#ffffff;'></div>";

			var objChildNode=document.createElement("DIV");
			objChildNode.className="embed_frame";
			objChildNode.style.position="absolute";
			objChildNode.innerHTML=l_s;

			if(IE6) hideSelect();
			ParentNode.appendChild(objChildNode);

			p_calendar.get_calendar("cal_"+p_calendar.cal_id,v_form);
		}
		else if(ParentNode.childNodes.length==7)
		{
			ParentNode.removeChild(ParentNode.childNodes[6]);
			if(IE6) showSelect();
		}
	},

	get_calendar:function(v_id,v_form,year,month)
	{
		if((year==null)|(month==null))
		{
			if($(v_form).value!="")
			{
				var v_array=$(v_form).value.split("-");

				year=parseInt(v_array[0]);

				if((v_array[1]=="10")|(v_array[1]=="11")|(v_array[1]=="12"))
				{
					month=parseInt(v_array[1])-1;
				}
				else
				{
					month=parseInt(v_array[1].substring(1))-1;
				}
			}
			else
			{
				var today=new Date();
				year=today.getFullYear();
				month=today.getMonth();
			}
		}

		var pre_year=year;
		var next_year=year;
		var pre_month=month-1;
		var next_month=month+1;

		if(pre_month<0)
		{
			pre_year--;
			pre_month=11;
		}

		if(next_month>11)
		{
			next_year++;
			next_month=0;
		}

		var firstOfMonth = new Date(year,month,1);
		var firstDay=firstOfMonth.getDay();

		var lastDate = p_calendar.totaldays(year,month);

		var today=new Date();
		var c_year=today.getFullYear();
		var c_month=today.getMonth();
		var c_date=today.getDate();

		var l_s="";

		l_s+="<table class='cal_table' style='width:100%; border-collapse: collapse;' bgcolor='#ffffff'>";
		l_s+="<caption><div style='text-align:center;margin-bottom:10px;font-weight:bold;font-size:11px;'><span onclick=\"p_calendar.get_calendar('"+v_id+"','"+v_form+"',"+pre_year+","+pre_month+");\" style=\"cursor:pointer;padding-right:5px;\"><img src='/kr/img/w3c/common/new/cal-pre.gif' width='5' height='7' /></span> "+year+". "+(month+1)+" <span onclick=\"p_calendar.get_calendar('"+v_id+"','"+v_form+"',"+next_year+","+next_month+");\" style=\"cursor:pointer;padding-left:5px;\"><img src='/kr/img/w3c/common/new/cal-next.gif' width='5' height='7' /></span></div></caption>";
		l_s+="<tr>";
		l_s+="<th class='cal_week' style='color:red;'>일</div></td>";
		l_s+="<th class='cal_week'>월</div></td>";
		l_s+="<th class='cal_week'>화</div></td>";
		l_s+="<th class='cal_week'>수</div></td>";
		l_s+="<th class='cal_week'>목</div></td>";
		l_s+="<th class='cal_week'>금</div></td>";
		l_s+="<th class='cal_week' style='color:blue;'>토</div></td>";
		l_s+="</tr>";

		var dayNum=1;
		var curCol=1;
		var cal_today="";

		for(var i=1;i<=Math.ceil((lastDate + firstDay)/7);i++,j++)
		{
 			l_s+="<tr align='center' valign='top'>";

 			for(var j=1;j<=7;j++)
 			{
				if((c_year==year)&(c_month==month)&(c_date==dayNum))
				{
					cal_today=" cal_today";
				}
				else
				{
					cal_today="";
				}

 		  	if(dayNum>lastDate) break;

				if(curCol<firstDay+1)
 		  	{
 		    	l_s+="<td class='cal_day'></td>";
 		    	curCol++;
 		  	}
 		  	else
 		  	{
 		  		switch(j)
 		  		{
						case 1 : l_s+="<td class='cal_day cal_sun"+cal_today+"' onclick=\"p_calendar.choice_day(this,'"+v_form+"',"+year+","+month+","+dayNum+");\">"+dayNum+"</td>";
										 break;
						case 7 : l_s+="<td class='cal_day cal_sat"+cal_today+"' onclick=\"p_calendar.choice_day(this,'"+v_form+"',"+year+","+month+","+dayNum+");\">"+dayNum+"</td>";
										 break;
						default: l_s+="<td class='cal_day"+cal_today+"' onclick=\"p_calendar.choice_day(this,'"+v_form+"',"+year+","+month+","+dayNum+");\">"+dayNum+"</td>";
					}

					dayNum++;
				}
			}

			l_s+="</tr>";
		}

		l_s+="<table>";

		$(v_id).innerHTML=l_s;
	},

	choice_day:function(v_obj,v_form,year,month,day)
	{
		var l_month,l_day;

		if(month<=8)
		{
			l_month="0"+(month+1);
		}
		else
		{
			l_month=""+(month+1);
		}

		if(day<=9)
		{
			l_day="0"+day;
		}
		else
		{
			l_day=""+day;
		}

		$(v_form).value=""+year+"-"+l_month+"-"+l_day;

		var ParentNode=v_obj.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;

		ParentNode.removeChild(ParentNode.childNodes[6]);
		if(IE6) showSelect();
	},

	totaldays:function(year,month)
	{
		var tempDay=new Array(31,28,31,30,31,30,31,31,30,31,30,31);

		if(((year %4==0)&&(year%100!=0))||(year%400==0)) tempDay[1]=29;
		else tempDay[1]=28;

		return tempDay[month];
	}
}
