/*
 * go to Section (flash top menu click event...)
 */
function goSection (cdSect) {
	var urlSection	= "";
	if (cdSect=="market") {
		urlSection	= "/market/";
	} else if (cdSect=="info") {
		urlSection	= "/info/";
	} else if (cdSect=="room") {
		urlSection	= "/room/";
	} else if (cdSect=="myfund") {
		urlSection	= "/myfund/";
	}

	if (urlSection != "") {
		document.location.href = urlSection;
	}
}	// end function :: goSection

function scrollLayer(p_obj_name, p_gap_point) 
{ 
    var start_point, end_point, timer; 

    var obj_layer   = document.getElementById(p_obj_name);  // ·¹ÀÌ¾î ¿ÀºêÁ§Æ®

    start_point = parseInt(obj_layer.style.top, 10); 

    if ( start_point < p_gap_point )    start_point = p_gap_point;

    end_point   = document.body.scrollTop + p_gap_point; 
    limit_point = parseInt(window.document.body.scrollHeight) - parseInt(obj_layer.offsetHeight) -10; 

    if ( end_point > limit_point )  end_point = limit_point; 

    if ( start_point != end_point ) 
    { 
        scroll_amount = Math.ceil( Math.abs( end_point - start_point ) / 15 ); 
        obj_layer.style.top = parseInt(start_point, 10) + ( ( end_point < start_point ) ? -scroll_amount : scroll_amount ); 
    } 

    timer = window.setTimeout ("scrollLayer('" + p_obj_name + "', " + p_gap_point + ");", 1); 
} 

function getXY(Obj)
{
	for(var sumTop=0, sumLeft=0; Obj != document.body; sumTop += Obj.offsetTop, sumLeft += Obj.offsetLeft, Obj = Obj.offsetParent);
	return {left:sumLeft,top:sumTop}
}

/*
 * Show Layer
 */
function showDivLayer(cdLayer, cdIndex, cdCmd)
{
//	try
//	{
		var lyTgrgetDiv = document.getElementById(cdLayer);

		var objBtnImage;
		if (typeof(cdIndex)=="undefined") {
			objBtnImage	= document.all.idBtnComm;
		} else {
			objBtnImage	= eval("document.all.idBtnComm" + cdIndex);
		}
//alert(cdIndex)
//alert(typeof(objBtnImage))
		lyTgrgetDiv.style.left = getXY(objBtnImage).left;
		lyTgrgetDiv.style.top = getXY(objBtnImage).top;

		if (typeof(cdCmd)=="undefined") {
			lyTgrgetDiv.style.top = getXY(objBtnImage).top+22;
		} else {
			if (cdCmd=="list") {
				lyTgrgetDiv.style.top = getXY(objBtnImage).top+18;
			}
		}

		lyTgrgetDiv.style.display = "block";
//	}
//	catch(e){}
}

/*
 * Hide Layer
 */
function hideDivLayer(cdLayer)
{
	try
	{
		var lyTgrgetDiv = document.getElementById(cdLayer);
		lyTgrgetDiv.style.display = "none";
	}
	catch(e){}
}

/*
 * go to fund save
 */
function gotoSaveFund (cdFund, strFundName, strUserID) {
	if (isUserLogged) {
		if (confirm("[" + strFundName + "] ÆÝµå¸¦ °ü½ÉÆÝµå·Î µî·ÏÇÏ½Ã°Ú½À´Ï±î?        ")) {
			var _url, objIfrmProc;
			_url	= "/myfund/fundProc.asp?cmd=fundcartsave";
			_url	= _url + "&fundcode=" + cdFund;
			_url	= _url + "&userid=" + strUserID;

			objIfrmProc	= document.getElementById("ifrmProc");
			objIfrmProc.src	= _url;
		}
	} else {
		var strMsg;
		strMsg	= "·Î±×ÀÎÀÌ ÇÊ¿äÇÕ´Ï´Ù.      \n\n·Î±×ÀÎ ÈÄ¿¡ ´Ù½Ã ÇÑ¹ø ½ÃµµÇÏ¿© ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.    ";
		alert(strMsg);
	}
}	// end function :: gotoSaveFund

/*
 * go to fund order
 */
function gotoOrderFund (cdFund, strFundName, cdSeller, strUserJumin) {
	if (isUserLogged) {
		var _url, strWinName;
		if (confirm("[" + strFundName + "] ÆÝµå¸¦ °¡ÀÔÇÏ½Ã°Ú½À´Ï±î?                \n\n[È®ÀÎ]À» ´©¸£½Ã¸é ÆÇ¸Å»ç·Î ÀÌµ¿ÇÕ´Ï´Ù.")) {
//				alert("Áõ±Ç»ç ¿¬µ¿À» ÁØºñÁßÀÔ´Ï´Ù.");
//return;

			var objFrm	= document.frmGoFund;
			if (cdSeller != "undefined") {
				if (cdSeller == "hana") {
				//	_url	= "http://www.hanaw.com/mall/product/etomato_forward.jsp?FUNDNO=" + cdFund;
				//	_url	+= "&CUSNO=" + strUserJumin;

					strWinName	= "hana_" + cdFund;

					window.open("", strWinName);

					objFrm.FUNDNO.value	= cdFund;
					objFrm.CUSNO.value	= strUserJumin;

					objFrm.action	= "http://www.hanaw.com/mall/product/etomato_forward.jsp";
					objFrm.target	= strWinName;
					objFrm.method	= "POST";
					objFrm.submit();
	
				} else if (cdSeller == "hyundai") {
					_url	= "http://www.hanaw.com/mall/product/etomato_forward.jsp?FUNDNO=";
					_url	+= cdFund;
					strWinName	= "hana_" + cdFund;
					window.open(_url, strWinName);
				}
				//alert(_url);
			} else {
				alert("Áõ±Ç»ç ¿¬µ¿À» ÁØºñÁßÀÔ´Ï´Ù.");
		    }
		}
	} else {
		var strMsg;
		strMsg	= "·Î±×ÀÎÀÌ ÇÊ¿äÇÕ´Ï´Ù.      \n\n·Î±×ÀÎ ÈÄ¿¡ ´Ù½Ã ÇÑ¹ø ½ÃµµÇÏ¿© ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.    ";
		alert(strMsg);
	}

}	// end function :: gotoOrderFund


/*
 * return js message
 */
function getMakeAltMsg (strmsg, cdformat) {
	var strRet;
	if (cdformat == 1) {
		strRet	= strmsg;
	} else if (cdformat == "input") {
		strRet	= "\n\n[" + strmsg + "]À» ÀÔ·ÂÇÏ¿© ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.     \n\n"
	} else if (cdformat == "select") {
		strRet	= "\n\n[" + strmsg + "]À» ¼±ÅÃÇÏ¿© ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.     \n\n"
	} else {
		strRet	= "\n\n" + strmsg + "     \n\n"
	}

	return strRet;
}	// end function :: getMakeAltMsg


