
/*******************************************************************************
 *	¸Þ´ºForm¿¡ ÆÄ¶ó¸ÞÅÍ °ªÀ» add ÇØ ÁÖ´Â ÇÔ¼ö
 *	sInputID : Parameter Name
 *	sValue : °ª
 *******************************************************************************/
function addForm(sInputID, sValue)
{
	var oForm = document.menuForm ;
	obj = document.createElement("<input type='hidden' name='" + sInputID + "'>") ;
	obj.setAttribute("value", sValue) ;
	oForm.appendChild(obj) ;
}


/*******************************************************************************
 *	¸Þ´ºForm¿¡¼­ Submit() ÇÏ´Â ÇÔ¼ö
 *	sAction : (String) Action °æ·Î ex) /mycredit/xxx.do
 *******************************************************************************/
function FormSubmit(sAction)
{
	document.menuForm.action = sAction ;
	document.menuForm.submit() ;
}


/*******************************************************************************
 *	¸Þ´ºForm¿¡ ÆÄ¶ó¸ÞÅÍ °ªÀ» ¼¼ÆÃ ÇØ ÁÖ´Â ÇÔ¼ö
 *	sInputID	: Parameter Name (String)
 *	sValue		: °ª (String) 
 *******************************************************************************/



function setForm(sInputID, sValue)
{
	try
	{
		//alert("1:"+sInputID);
		//alert("2:"+sValue);
		eval("document.menuForm." + sInputID).value = sValue ;		
	}
	catch (exception)
	{
		//alert(sInputID+"addform");
		addForm(sInputID, sValue);
		// error ¹«½Ã
	}

}

function removeForm(sInputID) {
	//alert("removeForm");
	var oForm = document.menuForm;
	var oElement = document.getElementsByName(sInputID);
	if(oElement(0) != null)
	{
  	var obj = eval("document.menuForm." + sInputID);
  	try
  	{
    	oForm.removeChild(obj);
    }
  	catch (exception)
  	{
  		// error ¹«½Ã   2006.05.29 ±¸ÀÚÁØ ÀÓ½ÃÁ¶Ä¡
  	}
  }
}

/*******************************************************************************
 *	¸Þ´ºForm¿¡ ³»¿ëÀ» Submit Form À¸·Î ¿Å°ÜÁÖ´Â ÇÔ¼ö
 *	sform : Form Name (String)
 *******************************************************************************/
function setTabForm(sform)
{
	var oForm ;
	if (typeof(sform) == "string")
	{
		oForm = eval("document." + sform) ;
	}

	obj = document.createElement("<input type='hidden' name='corp_cd' value='" + document.menuForm.corp_cd.value + "'>") ;
	oForm.appendChild(obj) ;
	obj = document.createElement("<input type='hidden' name='ui_cd' value='" + document.menuForm.ui_cd.value + "'>") ;
	oForm.appendChild(obj) ;	
	obj = document.createElement("<input type='hidden' name='menu_id' value='" + document.menuForm.menu_id.value + "'>") ;
	oForm.appendChild(obj) ;
	obj = document.createElement("<input type='hidden' name='menu_path' value='" + document.menuForm.menu_path.value + "'>") ;
	oForm.appendChild(obj) ;
	obj = document.createElement("<input type='hidden' name='pgm_id' value='" + document.menuForm.pgm_id.value + "'>") ;
	oForm.appendChild(obj) ;
	obj = document.createElement("<input type='hidden' name='pgm_nm' value='" + document.menuForm.pgm_nm.value + "'>") ;
	oForm.appendChild(obj) ;
	obj = document.createElement("<input type='hidden' name='pgm_id0' value='" + document.menuForm.pgm_id0.value + "'>") ;
	oForm.appendChild(obj) ;
	obj = document.createElement("<input type='hidden' name='pgm_nm0' value='" + document.menuForm.pgm_nm0.value + "'>") ;
	oForm.appendChild(obj) ;
	obj = document.createElement("<input type='hidden' name='pgm_id1' value='" + document.menuForm.pgm_id1.value + "'>") ;
	oForm.appendChild(obj) ;
	obj = document.createElement("<input type='hidden' name='pgm_nm1' value='" + document.menuForm.pgm_nm1.value + "'>") ;
	oForm.appendChild(obj) ;
	obj = document.createElement("<input type='hidden' name='pgm_id2' value='" + document.menuForm.pgm_id2.value + "'>") ;
	oForm.appendChild(obj) ;
	obj = document.createElement("<input type='hidden' name='pgm_nm2' value='" + document.menuForm.pgm_nm2.value + "'>") ;
	oForm.appendChild(obj) ;
	obj = document.createElement("<input type='hidden' name='pgm_id3' value='" + document.menuForm.pgm_id3.value + "'>") ;
	oForm.appendChild(obj) ;
	obj = document.createElement("<input type='hidden' name='pgm_nm3' value='" + document.menuForm.pgm_nm3.value + "'>") ;
	oForm.appendChild(obj) ;

}



/*******************************************************************************
 *	¸Þ´ºÀÌµ¿ ÇÔ¼ö
 *	menu_id : Menu ID
 *******************************************************************************/
function menu_open(menu_id)
{
	if (menu_id == null || menu_id == "") return false ;

	var menu1	= "" ;
	var menu2	= "" ;
	var menu3	= "" ;
	var menu4	= "" ;

	var sImgPathL_on	= "" ;
	var sImgPathL_off	= "" ;
	var sImgPathM_on	= "" ;
	var sImgPathM_off	= "" ;

	var sLinkL_on		= "" ;
	var sLinkL_off		= "" ;
	var sLinkS_on		= "" ;
	var sLinkS_off		= "" ;

	var img_name		= "" ;
	var div_name		= "" ;

	var oDivList ;
	var oImgList ;
	var oAList ;

	var oTable	= menu_table ;

	oDivList	= oTable.getElementsByTagName("div") ;
	oImgList	= oTable.getElementsByTagName("img") ;
	oAList		= oTable.getElementsByTagName("a") ;

	try
	{
		menu1 = menu_id.substring(0,2) ;
		menu2 = menu_id.substring(2,4) ;
		menu3 = menu_id.substring(4,6) ;
		menu4 = menu_id.substring(6) ;

		switch (menu1)
		{
			case "10" :
				sImgPathL_on	= "/mycredit/service/img/Mypage/Left_Blt_Lon.gif" ;
				sImgPathL_off	= "/mycredit/service/img/Mypage/Left_Blt_Loff.gif" ;
				sImgPathM_on	= "/mycredit/service/img/Mypage/Left_Blt_Mon.gif" ;
				sImgPathM_off	= "/mycredit/service/img/Mypage/Left_Blt_Moff.gif" ;
				sLinkL_on		= "Menu_my_on" ;
				sLinkL_off		= "Menu_my" ;
				sLinkS_on		= "Menu_mys_on" ;
				sLinkS_off		= "Menu_mys" ;
				break ;

			case "20" :
				sImgPathL_on	= "/mycredit/service/img/Info/Left_Blt_Lon.gif" ;
				sImgPathL_off	= "/mycredit/service/img/Info/Left_Blt_Loff.gif" ;
				sImgPathM_on	= "/mycredit/service/img/Info/Left_Blt_Mon.gif" ;
				sImgPathM_off	= "/mycredit/service/img/Info/Left_Blt_Moff.gif" ;
				sLinkL_on		= "Menu_in_on" ;
				sLinkL_off		= "Menu_in" ;
				sLinkS_on		= "Menu_ins_on" ;
				sLinkS_off		= "Menu_ins" ;
				break ;

			case "30" :
				sImgPathL_on	= "/mycredit/service/img/service/Left_Blt_Lon.gif" ;
				sImgPathL_off	= "/mycredit/service/img/service/Left_Blt_Loff.gif" ;
				sImgPathM_on	= "/mycredit/service/img/service/Left_Blt_Mon.gif" ;
				sImgPathM_off	= "/mycredit/service/img/service/Left_Blt_Moff.gif" ;
				sLinkL_on		= "Menu_ser_on" ;
				sLinkL_off		= "Menu_ser" ;
				sLinkS_on		= "Menu_sers_on" ;
				sLinkS_off		= "Menu_sers" ;
				break ;

			case "40" :
				sImgPathL_on	= "/mycredit/service/img/Center/Left_Blt_Lon.gif" ;
				sImgPathL_off	= "/mycredit/service/img/Center/Left_Blt_Loff.gif" ;
				sImgPathM_on	= "/mycredit/service/img/Center/Left_Blt_Mon.gif" ;
				sImgPathM_off	= "/mycredit/service/img/Center/Left_Blt_Moff.gif" ;
				sLinkL_on		= "Menu_cen_on" ;
				sLinkL_off		= "Menu_cen" ;
				sLinkS_on		= "Menu_cens_on" ;
				sLinkS_off		= "Menu_cens" ;
				break ;

			case "50" :
				sImgPathL_on	= "/mycredit/service/img/Member/Left_Blt_Lon.gif" ;
				sImgPathL_off	= "/mycredit/service/img/Member/Left_Blt_Loff.gif" ;
				sImgPathM_on	= "/mycredit/service/img/Member/Left_Blt_Mon.gif" ;
				sImgPathM_off	= "/mycredit/service/img/Member/Left_Blt_Moff.gif" ;
				sLinkL_on		= "Menu_my_on" ;
				sLinkL_off		= "Menu_my" ;
				sLinkS_on		= "Menu_mys_on" ;
				sLinkS_off		= "Menu_mys" ;
				break ;
		}

		// a class change (close)
		for (var i=0 ; i < oAList.length ; i++ )
		{
			if (oAList.item(i).className == sLinkS_on)
			{
				oAList.item(i).className = sLinkS_off ;
			}
			if (oAList.item(i).className == sLinkL_on)
			{
				oAList.item(i).className = sLinkL_off ;
			}
		}

		// image change (close)
		for (var i=0 ; i < oImgList.length ; i++ )
		{
			// LG menu Image
			if (oImgList.item(i).src == sImgPathL_on)
			{
				oImgList.item(i).src == sImgPathL_off ;
			}
			// MD menu Image
			else if (oImgList.item(i).src == sImgPathM_on)
			{
				oImgList.item(i).src == sImgPathM_off ;
			}
		}

		// div open
		for (var i=0 ; i < oDivList.length ; i++ )
		{
			div_name = oDivList.item(i).name ;

			if (div_name != "" && div_name != null)
			{
				if (div_name.substring(0,4) != (menu1 + menu2))
				{
					oDivList.item(i).style.display = "none" ;
				}
				else
				{
					if (div_name == (menu1 + menu2 + "0000"))
					{
						oDivList.item(i).style.display = "" ;
					}
					else if (div_name == (menu1 + menu2 + menu3 + "00"))
					{
						if (oDivList.item(i).style.display == "")
						{
							oDivList.item(i).style.display = "none" ;
						}
						else
						{
							oDivList.item(i).style.display = "" ;
						}
					}
				}
			}
		}// div open


		// image change
		for (var i=0 ; i < oImgList.length ; i++ )
		{
			img_name = oImgList.item(i).name ;

			if (img_name != "" && img_name != null)
			{
				if (img_name == (menu1 + menu2 + "0000"))
				{
					if (oImgList.item(i).src == sImgPathL_on)
					{
						oImgList.item(i).src == sImgPathL_off ;
					}
					else
					{
						oImgList.item(i).src == sImgPathL_on ;
					}
				
				}

				if (menu3 != "00")
				{
					if (img_name == (menu1 + menu2 + menu3 + "00"))
					{
						if (oImgList.item(i).src == sImgPathM_on)
						{
							oImgList.item(i).src == sImgPathM_off ;
						}
						else
						{
							oImgList.item(i).src == sImgPathM_on ;
						}
					}
				}
			}
		}// image change


		// a class change
		for (var i=0 ; i < oAList.length ; i++ )
		{
			if (oAList.item(i).name == (menu_id))
			{
				if (oAList.item(i).className == sLinkS_off)
				{
					oAList.item(i).className = sLinkS_on ;
				}
				else if (oAList.item(i).className == sLinkL_off)
				{
					oAList.item(i).className = sLinkL_on ;
				}

			}
		}
	}
	catch (exception)
	{
	}
}

/*******************************************************************************
 *	menu open function
 *	menu_id : menu id
 *	pgm_id	: program id
 *******************************************************************************/
function menu_onClick(menu_id, pgm_id)
{
	var menu_path = "" ;

	switch (menu_id.substring(0,2))
	{
		case "10" :
			menu_path		= "/service/common/menu/mypage.jsp" ;
			break ;

		case "20" :
			menu_path		= "/service/common/menu/info.jsp" ;
			break ;

		case "30" :
			menu_path		= "/service/common/menu/service.jsp" ;
			break ;

		case "40" :
			menu_path		= "/service/common/menu/center.jsp" ;
			break ;

		case "50" :
			menu_path		= "/service/common/menu/member.jsp" ;
			break ;
	}

	document.menuForm.action = "/mycredit/" + pgm_id + ".do" ;
	document.menuForm.pgm_id.value = pgm_id ;
	document.menuForm.menu_id.value = menu_id ;
	document.menuForm.menu_path.value = menu_path ;
	document.menuForm.submit() ;
}

function goContent(cont_cls) {
	var contCls3;
	var contCls4="";
	contCls3 = "CCS1_01_0"+cont_cls;

	addForm('cont_Cls3', contCls3);
	addForm('cont_Cls4', contCls4);
	setForm('menu_id', "70101001");
//	setForm('menu_path', "/service/common/menu/service.jsp");
	setForm('pgm_id', "counselCrList");

	FormSubmit("/mycredit/counselCrList.do");
}


function moveContent2(cont_cls) {
	var contCls3;
	var contCls4="";
	contCls3 = "CCS1_01_0"+cont_cls;

	addForm('cont_Cls3', contCls3);
	addForm('cont_Cls4', contCls4);
	
	
    SM_onClick('70101001','counselCrList','½Å¿ëÁ¤º¸»ó´ã')
	//setForm('pgm_id', "counselCrList");
	//setForm('menu_id', "70101001");
	//FormSubmit("/mycredit/counselCrList.do");
}

function jsCertPop()
    {
                
        openNameWindow(500, 380, '', 'opencert', '')
        addForm("buy_flag", "P000800001");
        document.menuForm.target = "opencert";        
        document.menuForm.action = "/mycredit/nonMemberCertFrm.do";    
        document.menuForm.submit();
        
    }

