//##############################################################################
//# ÇÁ·Î±×·¥ID : common.js
//# ÆäÀÌÁö¼³¸í : ÇØ´ç »çÀÌÆ® °íÀ¯ ½ºÅ©¸³Æ®
//# È­¸é¼³°èÀÚ : arthur-park
//# À¥µðÀÚÀÌ³Ê : arthur-park
//# ÇÁ·Î±×·¡¸Ó : arthur-park
//##############################################################################


//--------------------------------------------------------------------------
// ´Ù¿î·Îµå
//--------------------------------------------------------------------------
function jsDownload(i_fullname) {
    location.href = "/contents/cf/download.asp?FullName=" + i_fullname;
}

//==============================================================================
// ÀÌº¥Æ® °ü·Ã
//==============================================================================
    //--------------------------------------------------------------------------
    // ÆäÀÌÁö ·Îµå ÈÄ °Ô½ÃÆÇ Å¸ÀÌÆ² ½ºÅ¸ÀÏ Àû¿ë
    //--------------------------------------------------------------------------
    function jsListStyle() {
        var trs = jsGetElementsByClass("head");

        for ( var i=0; i < trs.length; i++ ) {
              for ( var x=0; x < trs[i].childNodes.length; x++ ) {
                    var item = trs[i].childNodes[x];

                    if ( item == trs[i].firstChild ) {
                         item.style.backgroundImage    = "url(/images/xn_bg_table_left.gif)";
                         item.style.backgroundRepeat   = "no-repeat";
                         item.style.backgroundPosition = "left top";
                    }
                    else if ( item == trs[i].lastChild ) {
                         item.style.backgroundImage    = "url(/images/xn_bg_table_right.gif)";
                         item.style.backgroundRepeat   = "no-repeat";
                         item.style.backgroundPosition = "right top";
                    }
              }
        }
    }


//==============================================================================
// ÄÁÅÙÃ÷ °ü·Ã
//==============================================================================
    //--------------------------------------------------------------------------
    // ¸Þ´º ¼±ÅÃ
    //--------------------------------------------------------------------------
    function jsSelectMenu( i_menu ) {
        var main       = parseInt(i_menu.substring(0, 2), 10);
        var sub        = parseInt(i_menu.substring(2, 4), 10);
        var third      = parseInt(i_menu.substring(4, 6), 10);
        var main_menu  = jsGetElementsByClass("cssMainMenu", "table")[0];
        var sub_menu   = jsGetElementsByClass("cssSubMenu", "ul")[0];
        var third_menu = jsGetElementsByClass("cssThirdMenu", "ul");

        // °ø¹é ÅØ½ºÆ® ³ëµå Á¦°Å
        jsIgnoreWhiteSpace(main_menu);
        jsIgnoreWhiteSpace(sub_menu);

        // 3Â÷¸Þ´º ¼û±è
        for ( var i=0; i < third_menu.length; i++ ) {
              third_menu[i].style.display = "none";
        }

        // ¸ÞÀÎ¸Þ´º ¼±ÅÃ
        if ( main_menu ) main_menu = main_menu.getElementsByTagName("a");

        if ( (main > 0) && (main <= main_menu.length) ) {
             var main_item = main_menu[main - 1].parentNode;

             main_item.className = "selected";
        }

        // ¼­ºê¸Þ´º ¼±ÅÃ
        if ( sub_menu && (sub > 0) && (sub <= sub_menu.childNodes.length) ) {
             var sub_item = sub_menu.childNodes[sub - 1];

             sub_item.className = "selected";

             // 3Â÷¸Þ´º È®Àå
             third_menu = sub_item.getElementsByTagName("ul")[0];
             if ( third_menu ) {
                  sub_item.firstChild.style.backgroundColor = "#F0C38C";
                  third_menu.style.display = "block";

                  // 3Â÷¸Þ´º ¼±ÅÃ
                  if ( (third > 0) && (third <= third_menu.childNodes.length) ) {
                       var third_item = third_menu.childNodes[third - 1];

                       third_item.className = "selected";
                  }
             }
        }
    }


	function setCookie( name, value, expiredays )
	{
		var todayDate = new Date();
		todayDate.setDate( todayDate.getDate() + expiredays );
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
	}

	function closeWin(CookieName)
	{
		setCookie( CookieName, "no" , 1);
		self.close();
	}
