function cookie_key()
{
    var d = new Date();
// return "3d"
    return d.getDate();
}

function popup_open(theURL, left, top, width, height, winName)
{
    var w=null;
    var f = 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar=0,menubar=0,status=0,scrollbars=1,resizable=0';

 if (popup_CookieGet(cookie_key()) != "opened" ) 
 {
        w = window.open(theURL,winName,f);
 }
 return w;
}

function popup_close(cookie_setting_mode) 
{
 if (cookie_setting_mode)
     popup_CookieSet(cookie_key(), "opened" , 1); // 3¹øÂ° 1Àº ÇÏ·ç¸¦ ÀÇ¹Ì! 
 top.self.close(); 
} 

function popup_CookieGet(name) 
{
 var nameOfCookie = name + "=";
 var x = 0;
    var len = document.cookie.length;

 while ( x <= len )
 { 
        var y = (x+nameOfCookie.length); 
        if ( document.cookie.substring( x, y ) == nameOfCookie )
        { 
            if ((endOfCookie=document.cookie.indexOf(";", y))==-1)
                endOfCookie = len; 
            return unescape(document.cookie.substring(y, endOfCookie)); 
        } 
        x = document.cookie.indexOf( " ", x ) + 1; 
        if ( x == 0 ) 
            break; 
 } 
 return ""; 
}

function popup_CookieSet( name, value, expiredays ) 
{ 
 var today = new Date(); 
 var s = "";
 today.setDate( today.getDate() + expiredays ); 

 s += name + "=" + escape( value );
 s += "; path=/; expires=";
 s += today.toGMTString() + ";" ;
 document.cookie = s;
} 

