/*******************************************************************************
* cody by hjkim ( hjkim@axgroup.co.kr )
* description :
*   ¸ÞÀÎÆäÀÌÁö¿¡ ¶ç¿ï °øÁö popup¿¡ °ü·ÃµÈ javascript ¸ðÀ½
*******************************************************************************/

// °øÁö ÆË¾÷ ¶ç¿ì±â
function popupNotice(date, num, lcate, expireterm)
{
	var url = "./popup/popup_" + date + ".php";
	PopupURL( url, date );

	//noticeWin = window.open("/jsps/bbs/popup_notice.jsp?p_bbs_table=normal&p_bbs_id=17328518&p_num="+num+"&p_lcate="+lcate+"&p_expireterm="+expireterm +"&p_club_id=24", "popup_notice", "fullscreen=no,titlebar=no,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=450,height=490");
}

function popupNotice1(date, num, lcate, expireterm)
{
	var url = "../popup/popup_" + date + ".php";
	PopupURL( url, date );

	//noticeWin = window.open("/jsps/bbs/popup_notice.jsp?p_bbs_table=normal&p_bbs_id=17328518&p_num="+num+"&p_lcate="+lcate+"&p_expireterm="+expireterm +"&p_club_id=24", "popup_notice", "fullscreen=no,titlebar=no,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=450,height=490");
}

////////////hoon Ãß°¡ 20100316//////////////////
function notice_getCookie( name )
{
        var nameOfCookie = name + "=";
        var x = 0;
        while ( x <= document.cookie.length )
        {
                var y = (x+nameOfCookie.length);
                if ( document.cookie.substring( x, y ) == nameOfCookie ) {
                        if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
                                endOfCookie = document.cookie.length;
                        return unescape( document.cookie.substring( y, endOfCookie ) );
                }
                x = document.cookie.indexOf( " ", x ) + 1;
                if ( x == 0 )
                        break;
        }
        return "";
}

function notice_setCookie( name, value, expiredays )
    {
        var todayDate = new Date();
        todayDate.setDate( todayDate.getDate() + expiredays );
        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
        }


function notice_closeWin() 
{ 
        if ( document.forms[0].Notice.checked ) 
                notice_setCookie( "Notice", "done" , 1); // 1=ÇÏ·íµ¿¾È °øÁöÃ¢ ¿­Áö ¾ÊÀ½
        self.close(); 
}

///////////////////////////////////////////////////////////////////////



// ÄíÅ°°ª °¡Á®¿À±â
function getCookie( name ) {
	var nameOfCookie = name +"=";
	var x = 0;
	while (x <= document.cookie.length )
	{
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie )
		{
			if ( (endOfCookie = document.cookie.indexOf( ";". y) ) == -1)
			{
				endOfCookie = document.cookie.length;
			}
			return unescape( document.cookie.sugstring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) +1;
		if ( x == 0 )
		{
			break;
		}
	}
	return "";
}

// ÄíÅ° ¼³Á¤
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()
{
	if ( document.popup.notice.checked )
		setCookie( "notice", "1" , 1);  // ¿À¸¥ÂÊ ¼ýÀÚ´Â ÄíÅ°¸¦ À¯ÁöÇÒ ±â°£À» ¼³Á¤ÇÕ´Ï´Ù
	self.close();
}

// Ã¢ ¶ç¿ì±â
function PopupURL(url, id, w, h, r)
{
	if ( !w ) var w = 400;
	if ( !h ) var h = 520;
	if ( !r ) var r = 'no';
	var position = 'width='+w+', height='+h+', ';
	position += 'location=no, menubar=no, scrollbars=no, status=no, toolbar=no, resizable='+r; //+', ';
	//position += 'left='+((screen.width - w ) / 2)+', top='+((screen.height - h ) / 2);
	notice = window.open(url, id, position);

	notice.opener = self;
} 

